F
Frank DeLuccia
Hello All,
I was wondering how to call API functions within .NET. I'm getting:
An unhandled exception of type
'System.Runtime.InteropServices.MarshalDirectiveException' occurred in
WindowsApplication1.exe
Additional information: PInvoke restriction: can not return variants.
when running this code:
Declare Function GetWindowThreadProcessID Lib "user32" (ByVal hwnd As Long,
ByVal lpdwProcessID As Long)
************************************************************
Dim objExcel As New Excel.ApplicationClass()
Dim lngProcessID As Long
Dim lngHwnd As Long
With objExcel
lngHwnd = .Hwnd
GetWindowThreadProcessID(lngHwnd, lngProcessID) <---- error occurs
.Quit()
End With
I have no clue why this is happening. Any ideas or guidance would be
greatly appreciated.
Thanks,
Frank
I was wondering how to call API functions within .NET. I'm getting:
An unhandled exception of type
'System.Runtime.InteropServices.MarshalDirectiveException' occurred in
WindowsApplication1.exe
Additional information: PInvoke restriction: can not return variants.
when running this code:
Declare Function GetWindowThreadProcessID Lib "user32" (ByVal hwnd As Long,
ByVal lpdwProcessID As Long)
************************************************************
Dim objExcel As New Excel.ApplicationClass()
Dim lngProcessID As Long
Dim lngHwnd As Long
With objExcel
lngHwnd = .Hwnd
GetWindowThreadProcessID(lngHwnd, lngProcessID) <---- error occurs
.Quit()
End With
I have no clue why this is happening. Any ideas or guidance would be
greatly appreciated.
Thanks,
Frank