program Test;<br><br>uses Windows, Messages;<br><br>function WindowProc(HWin, MsgID, WParam, LParam: DWORD): DWORD; stdcall;<br>var<br> B:array[0..5] of Byte;<br><br>begin<br> Result := DefWindowProc(HWin, MsgID, WParam, LParam);<br><br> case MsgID of<br> WM_CREATE:<br> begin<br> SetClassWord(HWin, 0, Byte(1));<br> SetClassWord(HWin, 1, Byte(2));<br> SetClassWord(HWin, 2, Byte(3));<br> <br> SetWindowWord(HWin, 0, Byte(4));<br> SetWindowWord(HWin, 1, Byte(5));<br> SetWindowWord(HWin, 2, Byte(6));<br><br> B[0]:=GetClassWord(HWin, 0 );<br> B[1]:=GetClassWord(HWin, 1 );<br> B[2]:=GetClassWord(HWin, 2 );<br><br> B[3]:=GetWindowWord(HWin, 0 );<br> B[4]:=GetWindowWord(HWin, 1 );<br> B[5]:=GetWindowWord(HWin, 2 );<br>//没有任何错误,Windows 2003 + Delphi 7.0 通过<br> end;<br><br> WM_DESTROY:<br> begin<br> PostQuitMessage(0);<br> end;<br> end;<br>end;<br><br>var<br> WndClass: TWndClass;<br> ThreadMsg: TMsg;<br>begin<br> WndClass.Style := CS_HREDRAW or CS_VREDRAW;<br> WndClass.lpfnWndProc := @WindowProc;<br> WndClass.cbClsExtra := 3; // 类空间<br> WndClass.cbWndExtra := 3; // 窗体空间<br> WndClass.hInstance := hInstance;<br> WndClass.hIcon := LoadIcon(hInstance, 'cool');<br> WndClass.hCursor := LoadCursor(0, IDC_ARROW);<br> WndClass.hbrBackground := COLOR_WINDOW + 1;<br> WndClass.lpszMenuName := nil;<br> WndClass.lpszClassName := 'Test';<br><br> RegisterClass(WndClass);<br><br> CreateWindowEx(0, 'Test', 'Test',<br> WS_TILED or WS_VISIBLE or WS_SYSMENU, <br> 100, 100, 100, 70, 0, 0, hInstance, nil);<br><br> while GetMessage(ThreadMsg, 0, 0, 0) do<br> begin<br> TranslateMessage(ThreadMsg);<br> DispatchMessage(ThreadMsg);<br> end;<br>end. <br>