keep getting an error(win api) - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

keep getting an error(win api)

header files

#define ID_FILE_EXIT 1000
#define ID_HELP_ABOUT 1001
#define IDOK 2000
#define IDEMAIL 2001
#define IDAZTEK 2003
#define IDBSRF 2004



Resource file:



#include "my_header.h"

ABOUTDLG DIALOG 19, 17, 182, 71
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "About"
FONT 8, "MS Sans Serif"
BEGIN
CTEXT "Written by AZTEK", 101, 17, 30, 81, 11
GROUPBOX "About", 102, 11, 11, 95, 48, WS_TABSTOP
DEFPUSHBUTTON "&Ok", IDOK, 112, 6, 64, 14
PUSHBUTTON "&E-mail AZTEK", IDEMAIL, 112, 21, 64, 14
PUSHBUTTON "Visit &AZTEK", IDAZTEK, 112, 36, 64, 14
PUSHBUTTON "Visit &Blacksun", IDBSRF, 112, 51, 64, 14
END

ID_MENU MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "E&xit", ID_FILE_EXIT
END
POPUP "&Help"
BEGIN
MENUITEM "&About", ID_HELP_ABOUT
END
END







Source Code:



#include

#include "my_header.h"

LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);

BOOL CALLBACK DlgProc(HWND, UINT, WPARAM, LPARAM);

static char gszClassName[] = "MyWindowClass";

static HINSTANCE ghInstance = NULL;

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {

WNDCLASSEX WndClass;

HWND hwnd;

MSG Msg;

ghInstance = hInstance;

WndClass.cbSize = sizeof(WNDCLASSEX);

WndClass.style = NULL;

WndClass.lpfnWndProc = WndProc;

WndClass.cbClsExtra = 0;

WndClass.cbWndExtra = 0;

WndClass.hInstance = ghInstance;

WndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);

WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);

WndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);

WndClass.lpszMenuName = NULL;

WndClass.lpszClassName = gszClassName;

WndClass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);

if(!RegisterClassEx(&WndClass)) {

MessageBox(0, "Window Registration Failed!", "Error!", MB_ICONSTOP | MB_OK);

return 0;

}

hwnd = CreateWindowEx(

WS_EX_STATICEDGE,

gszClassName,

"Windows Title",

WS_OVERLAPPEDWINDOW,

CW_USEDEFAULT, CW_USEDEFAULT,

320, 240,

NULL, NULL,

ghInstance,

NULL);

if(hwnd == NULL) {

MessageBox(0, "Window Creation Failed!", "Error!", MB_ICONSTOP | MB_OK);

return 0;

}

ShowWindow(hwnd, nCmdShow);

UpdateWindow(hwnd);

while(GetMessage(&Msg, NULL, 0, 0)) {

TranslateMessage(&Msg);

DispatchMessage(&Msg);

}

return Msg.wParam;

}

LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) {

switch(Message) {

case WM_COMMAND:

switch(LOWORD(wParam)) {

case ID_FILE_EXIT:

PostMessage(hwnd, WM_CLOSE, 0, 0);

break;

case ID_HELP_ABOUT:

DialogBox(ghInstance, "ABOUTDLG", hwnd, DlgProc);

break;

}

break;

case WM_CLOSE:

DestroyWindow(hwnd);

break;

case WM_DESTROY:

PostQuitMessage(0);

break;

default:

return DefWindowProc(hwnd, Message, wParam, lParam);

}

return 0;

}

BOOL CALLBACK DlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) {

switch(Message) {

case WM_INITDIALOG:

return TRUE;

case WM_COMMAND:

switch(LOWORD(wParam)) {

case IDOK:

EndDialog(hwnd, IDOK);

return TRUE;

case IDEMAIL:

ShellExecute(hwnd, "open", "mailto:[email protected]", 0, 0, 0);

EndDialog(hwnd, IDEMAIL);

return TRUE;

case IDAZTEK:

ShellExecute(hwnd, "open", "http://aztek.faction7.com", 0, 0, 0);

EndDialog(hwnd, IDAZTEK);

return TRUE;

case IDBSRF:

ShellExecute(hwnd, "open", "http://blacksun.box.sk", 0, 0, 0);

EndDialog(hwnd, IDBSRF);

return TRUE;

}

break;

}

return FALSE;

}



I'm gettting an error within the resource file.


Comments

Sign In or Register to comment.