|
-
Apr 19th, 2001, 05:10 PM
#1
How do i draw a border around the window the mouse is over? I want to do this so the user knows which window hes getting info about.
-
Apr 20th, 2001, 04:40 AM
#2
Frenzied Member
I have it in VB. It is not to hard to translate it:
Code:
Public Sub DrawBorder(hWnd As Long)
Dim hDC As Long
Dim rc As RECT
Dim hPen As Long
Dim retval As Long
retval = GetWindowRect(hWnd, rc)
hDC = GetWindowDC(hWnd)
retval = SaveDC(hDC)
retval = SetROP2(hDC, R2_NOT)
hPen = CreatePen(PS_INSIDEFRAME, 3 * GetSystemMetrics(SM_CXBORDER), RGB(0, 0, 0))
retval = SelectObject(hDC, hPen)
retval = SelectObject(hDC, GetStockObject(NULL_BRUSH))
retval = Rectangle(hDC, 0, 0, rc.Right - rc.Left, rc.Bottom - rc.Top)
retval = RestoreDC(hDC, -1)
retval = ReleaseDC(hwndsubject, hDC)
retval = DeleteObject(hPen)
End Sub
-
Apr 20th, 2001, 12:32 PM
#3
I dont know VB, so could you post the translation?
-
Apr 20th, 2001, 04:05 PM
#4
Lively Member
Code:
void DrawBorder(HWND hwnd)
{
HDC hdc;
RECT rc;
long hPen;
GetWindowRect(hwnd, rc);
hdc = GetWindowDC(hwnd);
SaveDC(hdc);
SetROP2(hdc, R2_NOT);
hPen = CreatePen(PS_INSIDEFRAME, 3 * GetSystemMetrics(SM_CXBORDER), RGB(0,0,0));
SelectObject(hdc, hPen);
SelectObject(hdc, GetStockObject(NULL_BRUSH));
Rectangle(hdc, 0, 0, rc.right - rc.left, rc.bottom - rc.top);
RestoreDC(hdc, -1);
ReleaseDC(hwnd, hdc);
DeleteObject(hPen);
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|