In the spy++ app that comes with VC++ 6, when you use the Find Window part of it, what api does it use to draw that rect around the window the cursor over?
Posted on 2002-07-31 15:16:06 by ChimpFace9000
Posted on 2002-07-31 15:33:29 by bazik
Another possibility - here
Posted on 2002-07-31 16:02:57 by Fordy
i always thought it was PatBlt with the PATINVERT raster op.
Posted on 2002-07-31 20:33:06 by Sloat

In the spy++ app that comes with VC++ 6, when you use the Find Window part of it, what api does it use to draw that rect around the window the cursor over?


MayBe this:



DrawWindowFrame PROC EXPORT uses esi hwndSubject:HWND,bUseBlock:BOOL ;
LOCAL hdc:HDC
LOCAL rc:RECT
LOCAL hpen:HANDLE

;Retrieve location of window on-screen.
ASSUME esi: PTR RECT
lea esi,rc
iWin32 GetWindowRect,hwndSubject, esi

;Get a device context that allows us to write anywhere within the window.
;NOTE: GetDC would allow us to write only in the window's client area.
iWin32 GetWindowDC,hwndSubject
mov hdc,eax
;Save the original device context attributes.
iWin32 SaveDC,eax

;To guarantee that the frame will be visible, tell Windows to draw the
;frame using the inverse screen color.
iWin32 SetROP2,hdc, R2_NOT

;Create a pen that is two (three ) times the width of a nonsizeable border. The
;color will not be used to draw the frame, so its value could be
;anything. PS_INSIDEFRAME tells windows that the entire frame should be
;enclosed within the window.
iWin32 GetSystemMetrics,SM_CXBORDER
shl eax,1
iWin32 CreatePen,PS_INSIDEFRAME, eax,0
mov hpen,eax
iWin32 SelectObject,hdc, eax

;We must select a NULL brush so that the contents of the window will not
;be overwritten.
.if bUseBlock==TRUE
iWin32 GetStockObject,DKGRAY_BRUSH
.else
iWin32 GetStockObject,NULL_BRUSH
.endif
iWin32 SelectObject,hdc, eax

;Draw the frame. Because the device context is relative to the window,
;the top-left corner is (0, 0) and the lower right corner is (width of
;window, height of window).
mov eax,[esi].right
sub eax,[esi].left
mov edx,[esi].bottom
sub edx,[esi].top
iWin32 Rectangle,hdc, 0, 0, eax,edx

;Restore the original attributes and release the device context.
iWin32 RestoreDC,hdc, -1
; iWin32 ReleaseDC,hwndSubject, hdc

;We can destroy the pen only AFTER we have restored the DC because the DC
;must have valid objects selected into it at all times.
iWin32 DeleteObject,hpen
iWin32 InvalidateRect,hwndSubject,esi,FALSE ;Prepare for WM_PAINT in client
iWin32 ReleaseDC, hwndSubject, hdc
mov eax,hwndSubject
ASSUME esi:NOTHING
mov eax,hdc
ret
DrawWindowFrame ENDP
;
Posted on 2002-08-03 04:39:15 by Andycar