"Notify" command question : X on red circle?
BlitzPlus Forums/BlitzPlus Programming/"Notify" command question : X on red circle?
| ||
The notify command allows you to display a message. the optionnal parameter allow you to make your message "serious". but i have a question... Normal message has the icon i bubble. Serious message has a /!\ icon. Is there any way for getting a message with a white X on a red circle as icon? (nb, thoses are window XP icon, i don't think they are the same for every version) thanks you! |
| ||
If there isn't one already, you need to create a folder called "userlibs" inside the BlitzPlus folder. You'll then have to create a plain text file, inside the "userlibs" folder, called "user32.decls" if one doesn't already exist, and add the following lines to it, then save it: .lib "user32.dll" MessageBoxA% (hWnd, lpText*, lpCaption*, uType) If the "user32.decls" already exists, just add the MessageBoxA line. (NB. It may already exist, in which case, don't bother!) Assuming that all goes OK, run this from the IDE: ; Flags that can be passed for different icons... Const MB_ICONSTOP = 16 Const MB_ICONQUESTION = 32 Const MB_ICONWARNING = 48 Const MB_ICONINFORMATION = 64 Function NotifyPlus (title$, message$, flags, query = 0) blitzwindow = SystemProperty ("AppHWND") messagebank = CreateBank (Len (message$) + 1) For b = 1 To Len (message$) PokeByte messagebank, b - 1, Asc (Mid (message$, b, 1)) Next PokeByte messagebank, b, 0 ; Windows needs terminating Chr (0) titlebank = CreateBank (Len (title$)) For b = 1 To Len (title$) PokeByte titlebank, b - 1, Asc (Mid (title$, b, 1)) Next PokeByte titlebank, b, 0 result = MessageBoxA (blitzwindow, messagebank, titlebank, flags Or query) FreeBank titlebank FreeBank messagebank Return result End Function ; Demo... NotifyPlus "Oh no!", "What are you trying to do?!!!", MB_ICONSTOP NotifyPlus "Oh no!", "What are you trying to do?!!!", MB_ICONQUESTION NotifyPlus "Oh no!", "What are you trying to do?!!!", MB_ICONWARNING NotifyPlus "Oh no!", "What are you trying to do?!!!", MB_ICONINFORMATION ; ... and with OK/Cancel flag... result = NotifyPlus ("Oh no!", "What are you trying to do?!!!", MB_ICONQUESTION, 1) Select result Case 1 NotifyPlus ("Oh no!", "You selected OK!", MB_ICONINFORMATION) Case 2 NotifyPlus ("Oh no!", "You selected Cancel!", MB_ICONWARNING) End Select |
| ||
Awesome! I'll familiarize with this when i have time. Many thanks! |