Hello,
i try to devolop a complet Window with the WinAPI,
but my Compiler (C::B) answers with Syntax errors. Can someone help me?
I am from Germany and post this question to the biggest german c++ board, but nobody have a answer for me. I hope here are more people.
resource.h :
Code:
#include <windows.h>
// ID of Main Dialogs
#define DLG_MAIN 101
#define DLG_LOGIN 102
// ID of Button Controls
#define IDC_BTN_START 1001
#define IDC_BTN_QUIT 1002
#define IDC_BTN_LOG 1003
#define IDC_CHECKBOX 1004
#define IDC_USER 1005
#define IDC_PW 1006
resource.rc :
Da wo die Kommentare mit den Zahlen befinden, sind die Fehler.
Code:
#include "resource.h"
DLG_MAIN DIALOGEX 6, 5, 194, 106
CAPTION "Dakron Bot v0.1"
FONT 8, "MS Sans Serif", 0, 0, 1
STYLE 0x10CE0804
BEGIN
CONTROL "&Start", IDC_BTN_START, "Button", 0x10010000, 138, 5, 46, 15
CONTROL "&Beenden", IDC_BTN_QUIT, "Button", 0x10010000, 138, 29, 46, 15
CHECKBOX "&Checkbox",IDC_CHECKBOX, "Checkbox", 0x10010000, 138, 44, 66, 15 // 14
END
DLG_LOGIN DIALOGEX 6, 5, 200, 100
CAPTION "Dakron Bot Login"
FONT 8, "MS Sans Serif", 0, 0, 1
STYLE 0x10CE0804
BEGIN
CONTROL "&Login", IDC_BTN_LOG, "Button", 0x10010000, 138, 5, 46, 15
LTEXT "Benutzername:", -1, 36, 24, 45, 8 // 27
EDITTEXT IDC_USER, 83,22,61,13, ES_AUTOHSCROLL | WS_BORDER // 28
LTEXT "Password:", -1, 36, 24, 45, 8 // 29
EDITTEXT IDC_PW, 83,22,61,13, ES_AUTOHSCROLL | WS_BORDER // 30
END
main.cpp
Code:
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "resource.h"
#include <iostream>
#include <stdio.h>
#include <tchar.h>
using namespace std;
int startgame();
HINSTANCE hInst;
BOOL CALLBACK DialogLogin(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_INITDIALOG:
return TRUE;
case WM_CLOSE:
EndDialog(hwndDlg, 0);
return TRUE;
case WM_COMMAND:
switch(LOWORD(wParam)) {
case IDC_BTN_LOG:
// check the login
return TRUE;
}
}
return FALSE;
}
BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
static HWND hEdit;
switch(uMsg)
{
case WM_INITDIALOG:
return TRUE;
case WM_CLOSE:
EndDialog(hwndDlg, 0);
return TRUE;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDC_BTN_QUIT:
EndDialog(hwndDlg, 0);
return TRUE;
case IDC_BTN_START:
startgame();
return TRUE;
}
}
return FALSE;
}
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
HWND hwndDlg;
hInst = hInstance;
// Start here the Login WIndow
DialogBox(hInstance, MAKEINTRESOURCE(DLG_LOGIN), NULL, DialogLogin);
// If login -> korrekt
// Start the main window.
return DialogBox(hInstance, MAKEINTRESOURCE(DLG_MAIN), NULL, DialogProc);
}
The error wasnt helpful for me:
resource.rc:x: syntax error