#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);
}