tony@cs.tamu.edu (Tony Encarnacion) (02/03/91)
I have been trying to use GetClientRect function with no success.
I hope somebody can explain what I have been doing wrong. The code
is given below (hWnd is actually a child window, a menu item similar
to the Word-for-Windows' menu below the standard menu bar). Thanks.
long FAR PASCAL menu_proc (HWND hWnd, unsigned iMessage,
WORD wParam, LONG lParam)
{
HDC hDC;
LPRECT lpRect;
switch (iMessage)
{
...
case WM_RBUTTONDOWN:
GetClientRect (hWnd, lpRect); /* <<-- this is where it bombs */
hDC = GetDC (hWnd); /* out; */
InvertRect (hDC, lpRect);
ReleaseDC (hWnd, hDC);
break;
...
};
}slh@wolf.cs.washington.edu (Scott Heyano) (02/04/91)
In article <11736@helios.TAMU.EDU> tony@cs.tamu.edu (Tony Encarnacion) writes: [stuff] | HDC hDC; | LPRECT lpRect; | | switch (iMessage) | { | ... | case WM_RBUTTONDOWN: | GetClientRect (hWnd, lpRect); /* <<-- this is where it bombs */ | hDC = GetDC (hWnd); /* out; */ | InvertRect (hDC, lpRect); | ReleaseDC (hWnd, hDC); [stuff] the declaration should be for a RECT, not a an LPRECT, and the uses should be taking the addr of the declared RECT. So, you have not declared storage for a RECT struct, just a pointer to one and the call to GetClientRect() writes into memory at god know's where.