Skip to content

Instantly share code, notes, and snippets.

@fschutt
Created October 23, 2016 14:44
Show Gist options
  • Save fschutt/e981ebde843635e0cf24c704567b5ee0 to your computer and use it in GitHub Desktop.
Save fschutt/e981ebde843635e0cf24c704567b5ee0 to your computer and use it in GitHub Desktop.
//Example of how to create a minimal MFC application
//1. Create a new Win32 project, select empty project
//2. Go to project options > Use MFC in a shared library (.dll)
//3. Make a new resource file with an empty dialog
//4. Give the dialog the name "IDD_INTERFACE1"
//5. Build and run.
//---------------------------------------
#include <afxwin.h>
#include "resource.h"
//---------------------------------------
//Globals
//CEdit* TEST;
class GAME_FORM : public CDialog
{
public:
GAME_FORM(CWnd* pParent = NULL) : CDialog(GAME_FORM::IDD, pParent) {};
//Dialog data, name of dialog here
enum { IDD = IDD_INTERFACE1 };
protected:
virtual void DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); };
//Called right after constructor. Initialize things here
virtual BOOL OnInitDialog()
{
CDialog::OnInitDialog();
//TEST = (CEdit*)GetDlgItem(IDC_TEST);
//TEST-&gt;SetWindowTextW(L"Hello!");
return true;
}
public:
DECLARE_MESSAGE_MAP()
};
//Actural App
class TheGame : public CWinApp
{
public:
TheGame() {};
virtual BOOL InitInstance()
{
CWinApp::InitInstance();
//SetRegistryKey(_T("Landkartenvertrieb"));
GAME_FORM dlg;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
return false;
}
};
//---------------------------------------------
//Need a Message Map Macro for both CDialog and CWinApp
BEGIN_MESSAGE_MAP(GAME_FORM, CDialog)
END_MESSAGE_MAP()
//---------------------------------------------
//Start application
TheGame theApp;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment