Hi,
I am trying to learn to declare, define and use a class.
I found a tutorial on having a user defined class in c programming, to help with clarity in win32 programming source code.
http://www.functionx.com/win32/Lesson06.htm They have several examples on the page .... you decare the class in the .h file, and use in the .c file.
I am having trouble getting anything to compile at all. I have tried a few variations.
I will show the header file, and the source file.
Can anyone help me get it to compile in PellesC as a win32 exe ?
Here is the header file:
pragma once
#include <windows.h>
//---------------------------------------------------------------------------
void class WApplication
{
public:
// This constructor will initialize the application
WApplication(HINSTANCE hInst, char *ClasName,
WNDPROC WndPrc, LPCTSTR MenuName = NULL);
// Class Registration
void Register();
protected:
// Global variable that holds the application
WNDCLASSEX _WndClsEx;
};
//---------------------------------------------------------------------------
And now the Source file:
#include "WinApp.h"
//---------------------------------------------------------------------------
WApplication::WApplication(HINSTANCE hInst, char *ClsName,WNDPROC WndPrc, LPCTSTR MenuName)
{
// Initializing the application using the application member variable
_WndClsEx.cbSize = sizeof(WNDCLASSEX);
_WndClsEx.style = CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS;
_WndClsEx.lpfnWndProc = WndPrc;
_WndClsEx.cbClsExtra = 0;
_WndClsEx.cbWndExtra = 0;
_WndClsEx.hInstance = hInst;
_WndClsEx.hIcon = LoadIcon(NULL, IDI_APPLICATION);
_WndClsEx.hCursor = LoadCursor(NULL, IDC_ARROW);
_WndClsEx.hbrBackground = static_cast<HBRUSH>(GetStockObject(WHITE_BRUSH));
_WndClsEx.hbrBackground = GetStockObject(WHITE_BRUSH));
_WndClsEx.lpszMenuName = MenuName;
_WndClsEx.lpszClassName = ClsName;
_WndClsEx.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
}
//---------------------------------------------------------------------------
void WApplication::Register()
{
RegisterClassEx(&_WndClsEx);
}
//---------------------------------------------------------------------------
Also, though I used code tags, and my code indents nicely in my entry window, the indentation disappears in the preview ..... what is the trick to keep the code indentation in the post ?
Tx in advance,
Ed