[RESOLVED] "Unable to find an entry point named 'GetForegroundwindow' in DLL 'User32.dll'."
Hello,
I don't know why I got the error.
Code:
EntryPointNotFoundException was unhandled by user code
Thanks for help.
Code:
Private Declare Function SetForegroundwindow Lib "User32" (ByVal hwnd As IntPtr) As IntPtr
Private Declare Function GetForegroundwindow Lib "User32.dll" () As IntPtr
Private Declare Function SetActiveWindow Lib "user32" Alias "SetActiveWindow" (ByVal hwnd As Long) As Long
Private Declare Function GetActiveWindow Lib "user32" Alias "GetActiveWindow" () As Long
Public Overrides Function Execute(ByVal xmlInput As System.Xml.XmlElement, ByVal oInputValues As System.Collections.IDictionary) As System.Xml.XmlElement
' ....
Dim handler As IntPtr
handler = GetForegroundWindow() ' Error here
SetActiveWindow(handler)
Re: "Unable to find an entry point named 'GetForegroundwindow' in DLL 'User32.dll'."
Don't know where you got your declarations, but all of them should be Int32, and not IntPtr :
Code:
Private Declare Function GetForegroundWindow Lib "user32.dll" () As Int32
Private Declare Function SetForegroundWindow Lib "user32.dll" (ByVal hwnd As Int32) As Int32
Private Declare Function SetActiveWindow Lib "user32.dll" (ByVal hwnd As Int32) As Int32
Private Declare Function GetActiveWindow Lib "user32.dll" () As Int32
I'd suggest you get a copy of API Viewer 2004
Also, APIs are case sensitive, as they originate from C / C++ - so that may also cause a problem
Re: "Unable to find an entry point named 'GetForegroundwindow' in DLL 'User32.dll'."
Re: "Unable to find an entry point named 'GetForegroundwindow' in DLL 'User32.dll'."
Like Hannes said, entry point names are case sensitive. That is your only issue.
Code:
Private Declare Function GetForegroundWindow Lib "User32.dll" () As IntPtr
Re: [RESOLVED] "Unable to find an entry point named 'GetForegroundwindow' in DLL 'Use
Yep, it seems I was smoking something that affected my braincells today. IntPtr is correct, Ddh! Hannes! :)
Sorry zhshqzyc - I'm just human afterall :blush: LOL!