我按照教程: http://www.winprog.org/tutorial/simple_window.html
我对教程中的所有内容以及我的测试程序的工作原理有一个合理的理解。我试图使用导入的DLL的hInstance和winamp给我的插件的父hwnd为winamp创建一个插件。
它进入消息循环但没有任何可见。
const char windowClassName[] = "LastScrobblerConfig";
WNDCLASSEX wc;
HWND hwnd;
MSG msg;
// the window class
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = 0;
wc.lpfnWndProc = WinEvents;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = plugin.hDllInstance;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszMenuName = NULL;
wc.lpszClassName = windowClassName;
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
if (!RegisterClassEx(&wc))
{
MessageBox(NULL, "Window Registration Failed!", "Error!",
MB_ICONEXCLAMATION | MB_OK);
return 0;
}
hwnd = CreateWindowEx (
WS_EX_WINDOWEDGE,
windowClassName,
plugin.description,
WS_TILEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
400,
400,
plugin.hwndParent,
NULL,
plugin.hDllInstance,
NULL
);
if (hwnd == NULL)
{
MessageBox(NULL, "Window Create Failed!", "Error!",
MB_ICONEXCLAMATION | MB_OK);
return 0;
}
ShowWindow(hwnd, 1);
UpdateWindow(hwnd);
while(GetMessage(&msg, NULL, 0, 0) > 0)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}