flat assembler
Message board for the users of flat assembler.
Index
> Tutorials and Examples > ERRORMSG.DLL |
Author |
|
Sasha 24 Oct 2013, 01:54
I've written an enhanced version of the ERRORMSG.DLL that can be found in fasm examples. I had a less enhanced version for about a year, that helps me to catch bugs, but now I've added much more functionality. Since I've finished it just now, some bugs may still be there. Please, let me know about them and, in general, do you think it is useful? Is it clear how to use it, or a tutorial is needed?=)
|
|||||||||||
24 Oct 2013, 01:54 |
|
HaHaAnonymous 24 Oct 2013, 12:02
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 19:40; edited 1 time in total |
|||
24 Oct 2013, 12:02 |
|
revolution 24 Oct 2013, 12:25
Agreed. We need more examples anyway IMO and this fits the description.
Sasha: If you wish to add a tutorial then please feel free to do that. |
|||
24 Oct 2013, 12:25 |
|
Sasha 24 Oct 2013, 14:09
This is the first steps for creating a more powerful error handler, with logging to files and displaying the error log at program termination or by calling a specific function (Like ShowErrorLog) while still running. There should be a console version prior to logfile version, also, but I can't force it to work.
The most typical usage of this library: 1. Show a messagebox with "Error" title and "Undefined error" text: Code: invoke ShowError,HWND,NULL,NULL 2. Show messagebox with your own caption and message Code: invoke ShowError,HWND,"The place, where error happened","A description of the error" 3. Retrieve the last error code and translate it to error text message Code: invoke ShowError,HWND,"The place",1 This is enough to handle the most cases, but I've made more. SetLastErrorMessage works similar to the windows SetLastError, but it also sets the error message string. This can be done by creating a message tables (see http://msdn.microsoft.com/en-us/library/windows/desktop/ms680357(v=vs.85).aspx), but my way is much simpler. And it is one of the reasons why this will not work in multithreaded environment. 4. This can be called somewhere inside the procedure Code: invoke SetLastErrorMessage,"The message",APPLICATION_DEFINED_ERROR_CODE and then after it returns: Code: invoke ShowError,HWND,"Caption",1 5. SetLastErrorCaption function works the same, but you provide just the string, no error codes Code: invoke SetLastErrorCaption,"An error has occurred" and then Code: invoke ShowError,HWND,1,"A description of the error" There are also miscellaneous functions that may be helpful in some situations. Last edited by Sasha on 25 Oct 2013, 14:06; edited 2 times in total |
|||
24 Oct 2013, 14:09 |
|
Sasha 24 Oct 2013, 17:05
I thought a little and decided to remove all unnecessary things and to make the library really simple, but still more functional, than the original fasm example. So here it is ERRORMSG.DLL version 2.0
It seems to be multithread compatible. This version has a different, much simplier usage and it is more close to the original dll. We have here 2 functions: BOOL ShowLastError(HWND hWnd,LPCTSTR lpCaption,LPCTSTR lpErrorMessage); BOOL ShowError(HWND hWnd,LPCTSTR lpCaption,DWORD dwErrCode); Examples: 1. MessageBox with "Error" caption and retrieved last error message Code: invoke ShowLastError,HWND_DESKTOP,NULL,NULL 2. No comments Code: invoke ShowLastError,HWND_DESKTOP,"Hello World!","An error has occurred" 3. If you set the last error code with 29 bit set you will get an "Undefined error" message. Until you specify the message table. Code: invoke SetLastError,APPLICATION_DEFINED_ERROR_CODE invoke ShowLastError,HWND_DESKTOP,NULL,NULL 4. You have an error code, and just want to format it to sring? Use ShowError Code: invoke ShowError,HWND_DESKTOP,"An error has occurred",1
|
|||||||||||
24 Oct 2013, 17:05 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.