|
-
May 31st, 2000, 12:51 AM
#1
Thread Starter
Hyperactive Member
It's a foreign window. I tried SetWindowPos with window style WS_Border but it left a thin border that can be resized.
Thanks.
-
May 31st, 2000, 02:04 AM
#2
Frenzied Member
No problem, what we're gonna do is change the command ID of the size menu item to an arbitary unused one, -10, when you try to resize this windows tries to call this menu by looking for its command ID, but seeing as we've changed it, when we want to let the window resize again we swap it back.
here's some code
Code:
Option Explicit
Private Const MF_BYCOMMAND = &H0&
Private Const MF_GRAYED = &H1&
Private Const SC_SIZE = &HF000&
Private Const MF_ENABLED = &H0&
Private Const FOOL_VB = -10
Private Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Declare Function ModifyMenu Lib "user32" Alias "ModifyMenuA" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpString As Any) As Long
Public Sub DisableResize(hwnd As Long)
ModifyMenu GetSystemMenu(hwnd, 0), _
SC_SIZE, _
MF_BYCOMMAND Or MF_GRAYED, _
FOOL_VB, _
"Size"
DrawMenuBar hwnd
End Sub
Public Sub EnableResize(hwnd As Long)
ModifyMenu GetSystemMenu(hwnd, 0), _
FOOL_VB, _
MF_BYCOMMAND Or MF_ENABLED, _
SC_SIZE, _
"Size"
DrawMenuBar hwnd
End Sub
hope this helps
-
May 31st, 2000, 02:12 AM
#3
Thread Starter
Hyperactive Member
That's beautiful Sam.
Thanks.
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
|