我真的不明白这些来自网络的例子。它们都是零碎的。没有一个简单简洁的示例如何制作经典的查找文本对话框。
我将我所知道的放入其中,但没有显示任何窗口并返回: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;
}
您能否为我提供有效的代码,以便我可以从中构建。