请问如何重绘一个应用程序的窗体或内部 Object 的边缘,就像 SPY++ 的 FindWindow Tool 实现的样式???(100分)

  • 主题发起人 主题发起人 shuixin13
  • 开始时间 开始时间
S

shuixin13

Unregistered / Unconfirmed
GUEST, unregistred user!
在 CSDN 上另有百分相送!<br>http://expert.csdn.net/Expert/topic/1887/1887333.xml?temp=.2047998
 
查找窗口的TRECT,再用TCanvas绘它的窗边。
 
你看看XPMenu的源码吧,写的很清楚<br>www.playico.com有下
 
不会吧,有这么简单??<br>
 
现在www.playicq.com变为new.playicq.com啦~~<br><br>试试再说啦~[:D]
 
意思是实现像 SPY++ 那样闪烁某个指定的窗口的边框的效果<br>SPY++ 没有使用<br>DrawEdge<br>也没有使用任何消息<br><br>OffsetRect<br>GetWindowRect<br>GetWindowDC<br>是使用了的
 
我知道,你看过VC++自带的例子吗?那不是有个类似SPY的程序么,你仿制一下啊~
 
TO JamesBond_L,<br>:) 是吗??我这没有VC,麻烦你发一个给我吧<br>shuixin13@163.com
 
我现在也没有,呵呵~
 
没有哪位同志用 VC ??<br>如有用的话,请帮忙查一查啦!<br>
 
很简单,一个API函数 FlashWindow<br>&nbsp; FlashWindow(Handle,True);<br>OK
 
procedure InvertTracker(hwndDest: HWND);<br>//画边框<br>var<br>&nbsp; hdcDest &nbsp; : HWND;<br>&nbsp; hPen &nbsp; &nbsp; &nbsp;: HWND;<br>&nbsp; hOldPen &nbsp; : HWND;<br>&nbsp; hOldBrush : HWND;<br>&nbsp; cr &nbsp; &nbsp; &nbsp; &nbsp;: HWND;<br>&nbsp; rc &nbsp; &nbsp; &nbsp; &nbsp;: TRect;<br>begin<br>&nbsp; GetWindowRect(hwndDest, rc);<br>&nbsp; hdcDest := GetWindowDC(hwndDest);<br>&nbsp; SetROP2(hdcDest,R2_NOT);<br>&nbsp; cr &nbsp; &nbsp;:= clBlack;<br>&nbsp; hPen &nbsp;:= CreatePen(PS_INSIDEFRAME,2,cr);<br><br>&nbsp; hOldPen &nbsp; := SelectObject(hdcDest, hPen);<br>&nbsp; hOldBrush := SelectObject(hdcDest, GetStockObject(NULL_BRUSH));<br>&nbsp; Rectangle(hdcDest, 0, 0, rc.Right - rc.Left, rc.Bottom - rc.Top);<br>&nbsp; SelectObject(hdcDest, hOldBrush);<br>&nbsp; SelectObject(hdcDest, hOldPen);<br><br>&nbsp; ReleaseDC(hwndDest, hdcDest);<br>&nbsp; DeleteObject(hPen);<br>end;
 
轻舞肥羊 &nbsp;的也可以用啦!<br><br>procedure HighlightWindow(hWndWindow: HWND; Flash: Boolean);<br>var hDCWindow: HDC;<br>&nbsp; &nbsp; RECT: TRect;<br>&nbsp; &nbsp; DINV: Integer;<br>begin<br>&nbsp; if (hWndWindow = 0) or (Not IsWindow(hWndWindow)) then<br>&nbsp; &nbsp; Exit<br>&nbsp; else begin<br>&nbsp; &nbsp; hDCWindow := GetWindowDC(hWndWindow);<br>&nbsp; &nbsp; Windows.GetWindowRect(hWndWindow, RECT);<br>&nbsp; &nbsp; OffsetRect(RECT, -RECT.Left,-RECT.Top);<br><br>&nbsp; &nbsp; DINV := 4;<br>&nbsp; &nbsp; if Not IsRectEmpty(RECT) then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; PatBlt(hDCWindow, RECT.Left, RECT.Top, RECT.Right - RECT.Left, DINV, DSTINVERT);<br>&nbsp; &nbsp; &nbsp; PatBlt(hDCWindow, RECT.left, RECT.bottom - DINV, DINV,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -(RECT.bottom - RECT.top - 2 * DINV), DSTINVERT);<br>&nbsp; &nbsp; &nbsp; PatBlt(hDCWindow, RECT.right - DINV, RECT.top + DINV, DINV,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RECT.bottom - RECT.top - 2 * DINV, DSTINVERT);<br>&nbsp; &nbsp; &nbsp; PatBlt(hDCWindow, RECT.right, RECT.bottom - DINV, -(RECT.right - RECT.left),<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DINV, DSTINVERT);<br>&nbsp; &nbsp; end;<br>&nbsp; &nbsp; ReleaseDC(hWndWindow, hDCWindow);<br>&nbsp; end;<br>end;<br><br><br>不过这两个都无法实现异型窗体的高亮,<br><br>:)
 
后退
顶部