I tried compileing this script:
Code:
#include <windows.h>
/*
* This function is a wrapper for the shell function SHMessageBoxCheck.
*
* See the documentation for SHMessageBoxCheck at:
* http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/shlwapi/others/shmessageboxcheck.asp
*
* The ordinals were provided by a usenet post:
* http://groups-beta.google.com/group/microsoft.public.platformsdk.shell/msg/d638e49f001752b4
*/
int MessageBoxCheck(HWND hwnd, LPCTSTR pszText, LPCTSTR pszTitle, UINT uType, int iDefault, LPCTSTR pszRegVal)
{
typedef (WINAPI * PSHMBC) (HWND, LPCTSTR, LPCTSTR, UINT, int, LPCTSTR);
HMODULE hShlwapi = NULL;
PSHMBC shMessageBoxCheck = NULL;
int retValue = -1;
WORD ordinalSHMBC = (sizeof(TCHAR) == sizeof(WCHAR) ? 191 : 185);
hShlwapi = LoadLibrary(TEXT("shlwapi.dll"));
if (hShlwapi)
{
shMessageBoxCheck = (PSHMBC) GetProcAddress(hShlwapi, (LPCSTR) ordinalSHMBC);
if (shMessageBoxCheck)
{
/* For some reason SHMessageBoxCheck seems to require that the thread has a
* message queue to work correctly. So we call PeekMessage to force the
* creation of a message queue. */
MSG msg; PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE);
retValue = shMessageBoxCheck(hwnd, pszText, pszTitle, uType, iDefault, pszRegVal);
}
FreeLibrary(hShlwapi);
}
return retValue;
}
/*
* Sample showing how to use MessageBoxCheck.
* Note: You must provide a new guid before using this code in a distributed program.
*/
int main(void)
{
if (-1 == MessageBoxCheck( NULL, TEXT("Your computer is broken."), TEXT("Warning"),
MB_OK | MB_ICONEXCLAMATION, IDOK,
TEXT("{D85055F7-4AD0-49d9-9686-35F5A53B2233}") ))
{
/* If our checked box message box failed, show an ordinary message box. */
MessageBox(NULL, TEXT("Your computer is broken."), TEXT("Warning"),
MB_OK | MB_ICONEXCLAMATION);
}
}
But an error came up.
ISO C++ forbids declaration of 'PSHMBC' with no type
Why is it doing this?
I am using "Dev-C++" compiler.
Thanks in advance, August.