I've been trying to get a Dialog box working all day now, and I've had it. I'm working with dev c++ on Windows Vista. Throughout my search on the net I've encountered my problem here and there, but nothing they suggested even came close to solving the problem. The code I'm about to copy is not my own, it's largely taken from one of the sites I stumbled across today. I've tried every source I found, and NONE (that's right, NONE) of them compiled.
My project is linked with libcommctrl32.a.
BOOL CALLBACK AboutDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
int about = DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(ID_ABOUT), hwnd, AboutDlgProc); //Call Our Dialog
if(about == IDOK) //If Out Dialog Returns With Our 'IDOK' Value
MessageBox(hwnd, "Dialog exited with IDOK.", "Notice", MB_OK | MB_ICONINFORMATION);
else if(about == IDCANCEL) //Else If Our Dialog Returns With Our 'IDCANCEL' Value
MessageBox(hwnd, "Dialog exited with IDCANCEL.", "Notice", MB_OK | MB_ICONINFORMATION);
else if(about == -1) //Else If Our Dialog Returns '-1', It Means It Didnt Work
MessageBox(hwnd, "Dialog failed!", "Error", MB_OK | MB_ICONINFORMATION);
//The Dialogs Window Control
BOOL CALLBACK AboutDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
case IDOK: //If our dialog returns IDOK
EndDialog(hwnd, IDOK); //Close The Dialog
case IDCANCEL: //If our dialog returns IDCANCEL
EndDialog(hwnd, IDCANCEL); //Close The Dialog
//Define Our Dialogs Name
#define ID_ABOUT 101
#include "resource.h" //Include our file
DLG_About DIALOG 20, 20, 400, 400
STYLE WS_POPUP | WS_DLGFRAME
CAPTION "Just an ordinary dialogbox"
FONT 8, "MS Sans Serif"
CTEXT "Some text lines", -1, 0, 0, 300, 8
CTEXT "Some more text lines", -1, 0, 8, 300, 8
CTEXT "And even more text lines.", -1, 0, 16, 300, 8
DEFPUSHBUTTON "OK", IDOK, 130, 152, 32, 14,
I ALWAYS get following errors :
Line 5 in file resource.rc : syntax error
Any help? Please?