2014-03-19 02:03:55 +04:00
|
|
|
|
|
|
|
#include <winpr/crt.h>
|
|
|
|
#include <winpr/wnd.h>
|
2014-05-22 21:50:01 +04:00
|
|
|
#include <winpr/tchar.h>
|
2014-03-19 02:03:55 +04:00
|
|
|
#include <winpr/library.h>
|
|
|
|
|
|
|
|
static LRESULT CALLBACK TestWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
PCOPYDATASTRUCT pCopyData;
|
|
|
|
|
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
case WM_COPYDATA:
|
2019-11-06 17:24:51 +03:00
|
|
|
{
|
|
|
|
pCopyData = (PCOPYDATASTRUCT)lParam;
|
2014-03-19 02:03:55 +04:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
if (!pCopyData)
|
|
|
|
break;
|
2014-03-19 02:03:55 +04:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
printf("WM_COPYDATA: cbData: %" PRIu32 " dwData: %" PRIu32 "\n", (int)pCopyData->cbData,
|
|
|
|
(int)pCopyData->dwData);
|
|
|
|
}
|
|
|
|
break;
|
2014-03-19 02:03:55 +04:00
|
|
|
|
|
|
|
case WM_CLOSE:
|
|
|
|
printf("WM_CLOSE\n");
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2019-11-06 17:24:51 +03:00
|
|
|
printf("TestWndProc: uMsg: 0x%08" PRIX32 "\n", uMsg);
|
2014-03-19 02:03:55 +04:00
|
|
|
return DefWindowProc(hwnd, uMsg, wParam, lParam);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int TestWndWmCopyData(int argc, char* argv[])
|
|
|
|
{
|
|
|
|
HWND hWnd;
|
|
|
|
HMODULE hModule;
|
|
|
|
HINSTANCE hInstance;
|
|
|
|
WNDCLASSEX wndClassEx;
|
|
|
|
|
|
|
|
hModule = GetModuleHandle(NULL);
|
|
|
|
|
|
|
|
ZeroMemory(&wndClassEx, sizeof(WNDCLASSEX));
|
|
|
|
wndClassEx.cbSize = sizeof(WNDCLASSEX);
|
|
|
|
wndClassEx.style = 0;
|
|
|
|
wndClassEx.lpfnWndProc = TestWndProc;
|
|
|
|
wndClassEx.cbClsExtra = 0;
|
|
|
|
wndClassEx.cbWndExtra = 0;
|
|
|
|
wndClassEx.hInstance = hModule;
|
|
|
|
wndClassEx.hIcon = NULL;
|
|
|
|
wndClassEx.hCursor = NULL;
|
|
|
|
wndClassEx.hbrBackground = NULL;
|
|
|
|
wndClassEx.lpszMenuName = _T("TestWndMenu");
|
|
|
|
wndClassEx.lpszClassName = _T("TestWndClass");
|
|
|
|
wndClassEx.hIconSm = NULL;
|
|
|
|
|
|
|
|
if (!RegisterClassEx(&wndClassEx))
|
|
|
|
{
|
|
|
|
printf("RegisterClassEx failure\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
hInstance = wndClassEx.hInstance;
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
hWnd = CreateWindowEx(0, wndClassEx.lpszClassName, 0, 0, 0, 0, 0, 0, HWND_MESSAGE, 0, hInstance,
|
|
|
|
NULL);
|
2014-03-19 02:03:55 +04:00
|
|
|
|
|
|
|
if (!hWnd)
|
|
|
|
{
|
|
|
|
printf("CreateWindowEx failure\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
SendMessage(hWnd, WM_CLOSE, 0, 0);
|
|
|
|
|
|
|
|
DestroyWindow(hWnd);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|