|
|
|
0 registered members (),
25,115
guests, and 1
spider. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
MessageBox Hooks, Callbacks, User Defined Buttons & Icons
#222119
08/18/08 04:33
08/18/08 04:33
|
Joined: Aug 2008
Posts: 17
PiLX
OP
Newbie
|
OP
Newbie
Joined: Aug 2008
Posts: 17
|
MessageBox Hooks, Callbacks, User Defined Buttons & Icons Example For Lite-C (Pure or Legacy) #define MAKELANGID(p, s) ((((WORD )(s)) << 10) | (WORD )(p))
#define PRIMARYLANGID(lgid) ((WORD )(lgid) & 0x3ff)
#define SUBLANGID(lgid) ((WORD )(lgid) >> 10)
#define MAKEINTRESOURCEA(i) ((LPSTR)((ULONG_PTR)((WORD)(i))))
#define MAKEINTRESOURCE MAKEINTRESOURCEA
#define MB_USERICON 0x00000080L
typedef unsigned long ULONG_PTR;
typedef ULONG_PTR DWORD_PTR;
typedef void* MSGBOXCALLBACK;
typedef struct _MSGBOXPARAMS{
UINT cbSize;
HWND hwndOwner;
HINSTANCE hInstance;
LPCSTR lpszText;
LPCSTR lpszCaption;
DWORD dwStyle;
LPCSTR lpszIcon;
DWORD_PTR dwContextHelpId;
MSGBOXCALLBACK lpfnMsgBoxCallback;
DWORD dwLanguageId;
}MSGBOXPARAMS;
/*
...below is the id of the icon within the acknex.exe. its the only
way (and icon) you can display as a user defined icon unless you
build it yourself or do the resource hack they explain in the manual.
EDIT:
if you have an icon resource in a dll (see next post down)
*/
#define IDI_ICON 103
MSGBOXPARAMS mbp;
int _MessageBox(HWND hwndOwner, LPCSTR lpszText, LPCSTR lpszCaption, DWORD dwStyle, UINT lpszIcon)
{
mbp.cbSize = sizeof(MSGBOXPARAMS);
mbp.hwndOwner = hwndOwner;
mbp.hInstance = GetModuleHandle(NULL);
mbp.lpszText = lpszText;
mbp.lpszCaption = lpszCaption;
mbp.dwStyle = dwStyle | MB_USERICON;
mbp.lpszIcon = MAKEINTRESOURCE(lpszIcon);
mbp.dwContextHelpId = 0;
mbp.lpfnMsgBoxCallback = NULL;
mbp.dwLanguageId = MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT);
return MessageBoxIndirect(&mbp);
} call it like this... _MessageBox(NULL,"MessageBox Hooks, Callbacks, User Defined Buttons & Icons", "Lite-C", MB_OK, IDI_ICON); nothing to exciting.
|
|
|
|
|
|
|