I am using It Just Works to call many Win32APIs from managed C++. I
have seen in one book that with PInvoke that you should NOT call
GetLastError via PInvoke but that you should call
Marshal::GetLastWin32Error.
What am I supposed to do when I am using the IJW interop interface?
Thanks
-------------------------------------------
Roy Chastain
KMSystems, Inc.
The problem is, the interop code itself may call some API which sets the
last error code.
With PInvoke, we can set the SetLastError field of the DllImport attribute
to true, and call Marshal::GetLastWin32Error to retrieve the error value
cached by the interop layer.
There's no such mechanism in IJW, so I'm afraid you need to fall back to
PInvoke if you want to call GetLastError for that API call.
Hope this helps.
Regards,
Xin
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. (c) 2003 Microsoft Corporation. All
rights reserved.
Roy Chastain - 29 Jul 2003 19:31 GMT
Does this fact make IJW a little useless for a large majority of API
calls?
>The problem is, the interop code itself may call some API which sets the
>last error code.
[quoted text clipped - 14 lines]
>You assume all risk for your use. (c) 2003 Microsoft Corporation. All
>rights reserved.
-------------------------------------------
Roy Chastain
KMSystems, Inc.
"Xin Huang" - 30 Jul 2003 08:11 GMT
Yes, in cases if you want to get the last error value.
Regards,
Xin
This posting is provided "AS IS" with no warranties, and confers no rights.
Microsoft Security Announcement: Have you installed the patch for Microsoft
Security Bulletin MS03-026? If not Microsoft strongly advises you to review
the information at the following link regarding Microsoft Security Bulletin
MS03-026 http://www.microsoft.com/security/security_bulletins/ms03-026.asp
and/or to visit Windows Update at http://windowsupdate.microsoft.com to
install the patch. Running the SCAN program from the Windows Update site
will help to insure you are current with all security patches, not just
MS03-026.