Windows-API-examples/strings/winapi_shell_search.c
2016-04-07 15:43:36 +02:00

25 lines
445 B
C

#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;
}