Can't find DLL entry point.....user32
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
Re: Can't find DLL entry point.....user32
Did you do a formal installation on the target machine or just copy the program over?
Re: Can't find DLL entry point.....user32
Just copied the program over. I created a new project with only this code in it -ran it ok on dev PC then copy and paste onto target.
Thanks
Re: Can't find DLL entry point.....user32
The only way copying will work is if VB itself is installed on the machine.
You must create a form installation and setup package, send the package to the desired machine, and have the user of the machine run the resulting Setup.exe to install your program.
Re: Can't find DLL entry point.....user32
Thanks for the reply. I have VB installed on both machines. I can copy the project on to either machine hit F5 and it runs no problem on the first PC. On the second it falls over at the hmenu = getsystemmenu(me.hwnd,0).
User32.dll must be present on the machine and there is but a single version of it -right?
Re: Can't find DLL entry point.....user32
Are the versions and service packs identical on both machines?
Re: Can't find DLL entry point.....user32
Yes -same VB6 install, both XP sp2.
What us user32? Does it install with VB or belong to windows?
Re: Can't find DLL entry point.....user32
User32.dll is a Windows core and basic dll. Its on all versions of Windows.
See here for the definition and specifics.
http://allapi.mentalis.org/apilist/GetSystemMenu.shtml
Re: Can't find DLL entry point.....user32
Compare the date/time stamp and size of user32.dll on the machine without the problem and the user32.dll file on the machine with the problem.
Re: Can't find DLL entry point.....user32
Its shouldnt matter as the API call is available in versions of Windos back to NT 3.1 and 95
Re: Can't find DLL entry point.....user32
It would matter if the file is corrupt.
Re: Can't find DLL entry point.....user32
Would a corrupt file show a modification/revision version change?
If it was corrupt then there would be more appearant "issues" thoughout all of his Windows, no?