- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If I try to load dynamicly a dll, and the file is corrupt, the error message I get (using GetLastError and FormatMessage functions) is:
"%1 is not a valid Win32 application"
What can I do with "%1"? In this case I know it is the name of the file. But in a different error it can change.
The dwLanguageId I am using is 1024 (Default language), so the error appears on the OS language.
Thanks
"%1 is not a valid Win32 application"
What can I do with "%1"? In this case I know it is the name of the file. But in a different error it can change.
The dwLanguageId I am using is 1024 (Default language), so the error appears on the OS language.
Thanks
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Not many system error codes have arguments (%1, %2) etc. You can conveniently interpret them using FORMAT_MESSAGE_ARGUMENT_ARRAY, but you'll have to decide what to put there on case-by case basis.
Here's a sample which uses FORMAT_MESSAGE_FROM_STRING, but you can easily adapt it to FORMAT_MESSAGE_FROM_SYSTEM:
Jugoslav
Here's a sample which uses FORMAT_MESSAGE_FROM_STRING, but you can easily adapt it to FORMAT_MESSAGE_FROM_SYSTEM:
lpObjs = LOC('whateverdll.dll'C) iLen = FormatMessage(FORMAT_MESSAGE_FROM_STRING+FORMAT_MESSAGE_ARGUMENT_ARRAY, & LOC(szFormat), idMsg, 0, LOC(szText), LEN(szText), LOC(lpObjs))Note that Arguments argument requires double indirection -- it is an address of (an array of) address(es) of string(s).
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks.
The problem now is, What to put on lpObjs? How do I know that the first argument is the dll name? What is the second argument?
The problem now is, What to put on lpObjs? How do I know that the first argument is the dll name? What is the second argument?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The complete list of error messages is in help page "System errors - numerical order" (there's link to it from GetLastError). There's only about a dozen messages containing arguments (like %1), and it's pretty obvious what kind of value is expected. (Of these, some ten refer to image names, and other few to drive names).
Jugoslav
Jugoslav

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page