mirror of
https://github.com/janbodnar/Windows-API-examples.git
synced 2024-11-24 11:25:30 +00:00
Create winapi_shell_search.c
This commit is contained in:
parent
bcc62396ae
commit
a52d337904
24
strings/winapi_shell_search.c
Normal file
24
strings/winapi_shell_search.c
Normal file
@ -0,0 +1,24 @@
|
||||
#include <windows.h>
|
||||
#include <wchar.h>
|
||||
#include "Shlwapi.h"
|
||||
|
||||
#pragma comment(lib, "Shlwapi.lib")
|
||||
|
||||
int wmain(void) {
|
||||
|
||||
wchar_t buf[] = L"Today is a rainy day.";
|
||||
wchar_t *search_word = L"rainy";
|
||||
int len = wcslen(search_word);
|
||||
|
||||
LPWSTR pr = StrStrW(buf, search_word);
|
||||
|
||||
if (pr == NULL) {
|
||||
|
||||
wprintf(L"No match\n", buf);
|
||||
} else {
|
||||
|
||||
wprintf(L"%.*ls is found\n", len, pr);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user