Originally Posted by
Coolmo
I'm kinda use to using standard Visual Basic whereas you can size your userform down to what ever size you want and/or not even show the title bar. Is there a way or a trick to getting the userforms in AutoCAD VBA to do this or at least make them size down smaller than they are? The userform is too wide for what I'm doing and it won't even let me type a small number in the properties box for the form's width. It only goes down to 92.25 width. Ideas? Tricks o' the trade?
I don't know about the width issue but for disbling the close box or removing the titlebar completely I use the following.
Code:
Option Explicit
Private Declare Function GetActiveWindow Lib "user32.dll" () As Long
Private Declare Function GetSystemMenu Lib "user32.dll" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Declare Function RemoveMenu Lib "user32.dll" (ByVal hMenu As Long, ByVal uPosition As Long, ByVal uFlags As Long) As Long
Private Declare Function DrawMenuBar Lib "user32.dll" (ByVal hwnd As Long) As Long
Private Declare Function GetWindowLong Lib "user32.dll" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Sub DisableClose()
Dim hwnd As Long
Dim hMenu As Long
hwnd = GetActiveWindow()
hMenu = GetSystemMenu(hwnd, 0)
Call RemoveMenu(hMenu, 6, &H400)
Call RemoveMenu(hMenu, 5, &H400)
Call DrawMenuBar(hwnd)
End Sub
Public Sub Remove()
Dim hwnd As Long
Dim dwNewLong As Long
hwnd = GetActiveWindow()
dwNewLong = GetWindowLong(hwnd, -16)
dwNewLong = dwNewLong And Not &HC00000
Call SetWindowLong(hwnd, -16, dwNewLong)
DrawMenuBar hwnd
End Sub
Regards - Nathan