LoadCursor (NULL, IDC_ARROW) ; wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ; wndclass.lpszMenuName = NULL ; wndclass.lpszClassName = szAppName ; if (!RegisterClass (&wndclass)) { MessageBox ( NULL, TEXT ("This program requires Windows NT!"), szAppName, MB_ICONERROR) ; return 0 ; } hwnd = CreateWindow (szAppName, TEXT ("Simple Clipboard Viewer (Text Only)"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL) ; ShowWindow (hwnd, iCmdShow) ; UpdateWindow (hwnd) ; while (GetMessage (&msg, NULL, 0, 0)) { TranslateMessage (&msg) ; DispatchMessage (&msg) ; } return msg.wParam ; }
LRESULT CALLBACK WndProc ( HWND hwnd, UINT message, WPARAM wParam,LPARAM lParam) { static HWND hwndNextViewer ; HGLOBAL hGlobal ; HDC hdc ; PTSTR pGlobal ; PAINTSTRUCT ps ; RECT rect ; switch (message) { case WM_CREATE: hwndNextViewer = SetClipboardViewer (hwnd) ; return 0 ; case WM_CHANGECBCHAIN: if ((HWND) wParam == hwndNextViewer) hwndNextViewer = (HWND) lParam ; else if (hwndNextVie |