I really do not understand these examples from the web. They're all fragmentary. There is nowhere a simple concise example how to make a classic find text dialog.
I put what I know into this , but is is not showing any window and returns: 2147500037
0x80004005
#include <windows.h>
#include <iostream>
#include <iomanip>
int main() {
using namespace std;
UINT uFindReplaceMsg; // message identifier for FINDMSGSTRING
uFindReplaceMsg = RegisterWindowMessage(FINDMSGSTRING);
wstring search_str = L"text to search";
HWND findDialog = NULL;
wchar_t szFindWhat[MAX_PATH];
FINDREPLACEW fr;
ZeroMemory( & fr, sizeof( FINDREPLACEW ) );
fr.lStructSize = sizeof( FINDREPLACEW );
fr.hwndOwner = NULL;
fr.lpstrFindWhat = szFindWhat;
fr.wFindWhatLen = MAX_PATH;
findDialog = FindTextW(&fr);
cout << GetLastError() << endl;
cout << hex << GetLastError() << endl;
}
Could you provide me with code that works so I can build from that.