I am using Vb6 and trying to hide or disable the form close button.
The code I am using is below.
On my development machine (WinXP sp2.0) this works but on the target machine (WinXP sp2.0) I get the following error
Can't find DLL entrypoint GetSystemMenu in user32.
Can any body help!!vb Code:
Private Const MF_BYPOSITION = &H400 Private Const MF_REMOVE = &H1000 Private Declare Function DrawMenuBar Lib "user32" _ (ByVal hwnd As Long) As Long Private Declare Function GetMenuItemCount Lib "user32" _ (ByVal hMenu As Long) As Long Private Declare Function GetSystemMenu Lib "user32" _ (ByVal hwnd As Long, _ ByVal bRevert As Long) As Long Private Declare Function RemoveMenu Lib "user32" _ (ByVal hMenu As Long, _ ByVal nPosition As Long, _ ByVal wFlags As Long) As Long Private Sub Form_Load() Dim hMenu As Long Dim menuItemCount As Long 'Obtain the handle to the form's system menu hMenu = GetSystemMenu(Me.hwnd, 0) If hMenu Then 'Obtain the number of items in the menu menuItemCount = GetMenuItemCount(hMenu) 'Remove the system menu Close menu item. 'The menu item is 0-based, so the last 'item on the menu is menuItemCount - 1 Call RemoveMenu(hMenu, menuItemCount - 1, _ MF_REMOVE Or MF_BYPOSITION) 'Remove the system menu separator line Call RemoveMenu(hMenu, menuItemCount - 2, _ MF_REMOVE Or MF_BYPOSITION) 'Force a redraw of the menu. This 'refreshes the titlebar, dimming the X Call DrawMenuBar(Me.hwnd) End If End Sub




Reply With Quote