It's a foreign window. I tried SetWindowPos with window style WS_Border but it left a thin border that can be resized.
Thanks.
Printable View
It's a foreign window. I tried SetWindowPos with window style WS_Border but it left a thin border that can be resized.
Thanks.
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
hope this helpsCode: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
That's beautiful Sam.
Thanks. ;)