Original Post
Ive been trying to set up a class for creating and registering a basic win32 application so i can work on my game , but im getting lots of errors... can u give me some advice on this?
// cApplication.h
// Creates and Manages Win32 Window Application
// Armando Alva@2005
#ifndef CAPPLICATION_H__
#define CAPPLICATION_H__
#include <windows.h>
#include <iostream>
class cApplication
{
public:
// Constructor Destructor
cApplication();
~cApplication();
// WindowClassEx
WNDCLASSEX wcex;
// WindowHandle
HWND hWnd;
// Methods
void CreateWnd();
void RegisterWnd();
private:
}
#endif
// cApplication.cpp
// Definition for cApplication.h
// Armando Alva@2005
#include "cApplication.h"
// -----------------------------------------------------
// Constructor Destructor
// -----------------------------------------------------
cApplication()
{
RegisterWnd();
CreateWnd();
}
~cApplication()
{
// Do Nothing (for now)
}
// -----------------------------------------------------
// RegisterWnd()
// -----------------------------------------------------
void cApplication::RegisterWnd()
{
// Registering Window Class
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = 0;
wcex.lpfnWndProc = MsgProc; // Points to the name of the MsgProcedure funct.
wcex.cbWndExtra = 0L;
wcex.cbClsExtra = 0L;
wcex.hInstance = GetModuleHandle(NULL); // Or hInstance
wcex.hIcon = NULL;
wcex.hCursor = NULL;
wcex.hbrBackground = NULL;
wcex.hIconSm = NULL;
wcex.lpszMenuName = NULL;
wcex.lpszClassName = "Game Class";
if(!RegisterClassEx(&wcex))
{
MessageBox(NULL, "Window Registration Failed!", "Error!", MB_OK);
}
}
// -----------------------------------------------------
// CreateWnd()
// -----------------------------------------------------
void cApplication::CreateWnd()
{
hWnd = CreateWindowEx(NULL, "Game Class", "Double Dragon Clone",
WS_OVERLAPPEDWINDOW, 100, 100, 300, 300,
NULL, NULL, wcex.hInstance, NULL);
}
// -----------------------------------------------------
// WinMain.cpp
// Application Main Starting Point
// Armando Alva@2005
// -----------------------------------------------------
#include <windows.h>
#include "cApplication.h"
INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR, INT)
{
cApplication TestApp;
}