Win32 VS2005 Dialog box classes

Started by
4 comments, last by nivlekio 16 years, 1 month ago
I was trying to make a class for my dialog box ( just learned about this a couple of hrs ago by mistake) and im pretty much confused tho i sorta now whats going on. Was wondering if any one knows any good tutorials sites? I have been looking for some the past hr or so and cant find jack. Thanks.
Advertisement
What exactly do you mean by "class"? A C++ (or some other language) class? Or a window class (as in WNDCLASSEX, RegisterClassEx, etc.) to be used for a dialog box?
Check out FunctionX .. Google search it its got some good stuff for win32 api.

As for future post it does help us out greatly here at game dev if you tell use what langauge you are currently useing for the project or what you are learning so we know what direction you are trying to head in.

Regards Jouei.
Sorry for the lack of information the topic was new to me. Just found out the topic is Microsoft Foundation Class (MFC) I am looking for a good tutorial to make a simple MFC class where I can make a modeless dialog boxes for the interface of the program which will be a Lan server for the game I am working on.

I have found some stuff but they do too indepth and I dont want to do anything fancy I have other stuff to learn (working on group project and I am doing networking) and this is not really important for the project I am worknig on. I am coding in VS2005 and using C++.

I found this tutorial

Quote:
http://www.devarticles.com/c/a/Cplusplus/Using-MFC-in-Cplus-Basic-Application-Skeleton/


It was originally done in VS 6 and when I compile the turial in VS2005 I get errors ive managed to sus most of them out except for a couple so its kinda anoying me.

This is the error I get

Quote:
------ Build started: Project: FFS!, Configuration: Debug Win32 ------
Compiling...
MYclass.cpp
WINVER not defined. Defaulting to 0x0502 (Windows Server 2003)
Linking...
MYclass.obj : error LNK2001: unresolved external symbol "protected: virtual struct AFX_MSGMAP const * __thiscall CMainWin::GetMessageMap(void)const " (?GetMessageMap@CMainWin@@MBEPBUAFX_MSGMAP@@XZ)
C:\Documents and Settings\Kelvin\My Documents\Visual Studio 2005\Projects\FFS!\Debug\FFS!.exe : fatal error LNK1120: 1 unresolved externals


And here is the code i have in the .h

class CMainWin : public CFrameWnd{public:CMainWin();DECLARE_MESSAGE_MAP()};class CApp : public CWinApp{public:BOOL InitInstance();};


and in the .cpp

// Header for the MFC classes#include <afxwin.h>#include "MYclass.h"CMainWin::CMainWin(){   	Create(NULL, "My MFC Application");}BOOL CApp::InitInstance(){	try	{		m_pMainWnd = new CMainWin;		m_pMainWnd->ShowWindow(m_nCmdShow);		m_pMainWnd->UpdateWindow();		return TRUE;	}	catch(...)	{		return FALSE;	}}


If it helps I went to new project then chosse Win32 Project, the i picked empty project and created it, then in Properties and Genral I changed "Use Unicode Character Set" to "Use Multi-Byte Character Set" and I also chose "Use MFC in a Shared DLL".

thanks for any helps guys.
I'm not at all an MFC expert (I've never even used it, I just know some basics), but I'm pretty sure you need to but the BEGIN_MESSAGE_MAP() macro in the class implementation for CMainWin. Something like this:

BEGIN_MESSAGE_MAP(CMainWin, CFrameWnd)	ON_WM_CREATE()END_MESSAGE_MAP()



You need to define the method "GetMessageMap" since it's declared as part of the DECLARE_MESSAGE_MAP macro.


Thanks man that worked!!!!!!!!!! you rock

This topic is closed to new replies.

Advertisement