Click here to Skip to main content
15,914,368 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Which function called when drop file on Exe Pin
rp_suman10-Dec-06 14:42
rp_suman10-Dec-06 14:42 
GeneralRe: Which function called when drop file on Exe Pin
Michael Dunn10-Dec-06 14:47
sitebuilderMichael Dunn10-Dec-06 14:47 
GeneralThanks Pin
rp_suman10-Dec-06 14:52
rp_suman10-Dec-06 14:52 
QuestionHow coding to FrontMic setting in Mixer? Pin
boy21c10-Dec-06 12:59
boy21c10-Dec-06 12:59 
QuestionHeap Corruption Question Pin
Richard Andrew x6410-Dec-06 12:50
professionalRichard Andrew x6410-Dec-06 12:50 
AnswerRe: Heap Corruption Question Pin
Stephen Hewitt10-Dec-06 13:35
Stephen Hewitt10-Dec-06 13:35 
GeneralRe: Heap Corruption Question Pin
Richard Andrew x6410-Dec-06 13:59
professionalRichard Andrew x6410-Dec-06 13:59 
QuestionMFC Graphics Debug Assertation Error Pin
CoffeeAddict1910-Dec-06 12:32
CoffeeAddict1910-Dec-06 12:32 
I'm getting a debug assertation error on my MFC program. It compiles fine with no warnings or anything, but I'm still getting the error. When I hit "retry" it points to this line:

Background_dcPtr->DrawText("It Works!", ItWorksDimensions, DT_CENTER);

The rest of the code is here:

#include "game_interface.h"
#include <afxwin.h>
#include "game_ids.h"

using namespace std;

CGameWin::CGameWin() : CGameKeyBindingDialog("CKeyboardDialog")
{
Create(NULL, "Ard-Ri", WS_OVERLAPPEDWINDOW,
rectDefault, NULL, "Game");
CGameKeyBindingDialog.setMainWnd(this);
OffSetX, OffSetY = 0;
}
CDC* CGameWin::DrawBackground()
{
CDC* Background_dcPtr = new CDC;
CRect ItWorksDimensions;

ItWorksDimensions.left = 0;
ItWorksDimensions.top = 0;
ItWorksDimensions.right = 50;
ItWorksDimensions.bottom = 20;
Background_dcPtr->DrawText("It Works!", ItWorksDimensions, DT_CENTER);

return Background_dcPtr;
}
afx_msg void CGameWin::OnPaint()
{
CPaintDC Screen(this);
CRect WindowArea;
CDC* Background = NULL;

GetClientRect(&WindowArea);
OffSetX = WindowArea.right / 4;
OffSetY = WindowArea.bottom / 4;
Background = DrawBackground();
Screen.CreateCompatibleDC(Background);
Screen.BitBlt(OffSetX, OffSetY, OffSetX + 50, OffSetY + 20, Background, 0, 0, SRCCOPY);
delete Background;
}
afx_msg void CGameWin::OnExit()
{
SendMessage(WM_CLOSE);
}
BEGIN_MESSAGE_MAP(CGameWin, CFrameWnd)
ON_WM_PAINT()
ON_COMMAND(IDM_EXIT, OnExit)
END_MESSAGE_MAP()

CGameKeyBindingDialog::CGameKeyBindingDialog(char* lpszName) : CDialog(lpszName)
{
}
BOOL CGameKeyBindingDialog::OnInitDialog()
{
CDialog::OnInitDialog();

return TRUE;
}
CGameWin* CGameKeyBindingDialog::getMainWnd()
{
return m_pMainWnd;
}
void CGameKeyBindingDialog::setMainWnd(CGameWin* mp)
{
m_pMainWnd = mp;
}
afx_msg void CGameKeyBindingDialog::OnExitDialog()
{
EndDialog(IDM_EXIT);
}

BEGIN_MESSAGE_MAP(CGameKeyBindingDialog, CDialog)
ON_COMMAND(IDM_EXIT, OnExitDialog)
END_MESSAGE_MAP()

The header file:

#ifndef GAME_INTERFACE_H
#define GAME_INTEFRACE_H

#include <afxwin.h>

using namespace std;

class CGameWin;

class CGameKeyBindingDialog : public CDialog
{
public:
CGameKeyBindingDialog(char* lpszName);
BOOL OnInitDialog();
CGameWin* getMainWnd();
void setMainWnd(CGameWin* mp);
void InitAll();
afx_msg void OnExitDialog();
private:
CGameWin* m_pMainWnd; //pointer to main window

DECLARE_MESSAGE_MAP()
};

class CGameWin : public CFrameWnd
{
public:
CGameWin();
afx_msg void OnPaint();
//file menu "File"
afx_msg void OnExit();

private:
CDC* DrawBackground();
CGameKeyBindingDialog CGameKeyBindingDialog;
int OffSetX;
int OffSetY;

DECLARE_MESSAGE_MAP()
};

#endif

I'd appreciate any help.
AnswerRe: MFC Graphics Debug Assertation Error Pin
Michael Dunn10-Dec-06 13:17
sitebuilderMichael Dunn10-Dec-06 13:17 
AnswerRe: MFC Graphics Debug Assertation Error Pin
Mark Salsbery10-Dec-06 13:31
Mark Salsbery10-Dec-06 13:31 
GeneralRe: MFC Graphics Debug Assertation Error Pin
CoffeeAddict1910-Dec-06 14:53
CoffeeAddict1910-Dec-06 14:53 
GeneralRe: MFC Graphics Debug Assertation Error Pin
Mark Salsbery10-Dec-06 15:25
Mark Salsbery10-Dec-06 15:25 
Questionwin-like application [modified] Pin
arnluci10-Dec-06 8:40
arnluci10-Dec-06 8:40 
AnswerRe: win-like application Pin
Mark Salsbery10-Dec-06 9:39
Mark Salsbery10-Dec-06 9:39 
AnswerRe: win-like application Pin
Joe Woodbury10-Dec-06 9:53
professionalJoe Woodbury10-Dec-06 9:53 
Questionhow to allow horizontal scroll for picture or custom control? Pin
cyn810-Dec-06 1:39
cyn810-Dec-06 1:39 
AnswerRe: how to allow horizontal scroll for picture or custom control? Pin
Hamid_RT10-Dec-06 6:43
Hamid_RT10-Dec-06 6:43 
GeneralRe: how to allow horizontal scroll for picture or custom control? Pin
cyn810-Dec-06 13:34
cyn810-Dec-06 13:34 
QuestionAny help to merge multiple PDFs in a single PDF: Using any thing like VC++ or VB Pin
helpcode10-Dec-06 1:16
helpcode10-Dec-06 1:16 
QuestionHow can i play a wma file? Pin
Sina Parastgary9-Dec-06 19:18
Sina Parastgary9-Dec-06 19:18 
AnswerRe: How can i play a wma file? Pin
Mark Salsbery10-Dec-06 5:48
Mark Salsbery10-Dec-06 5:48 
Questionany idea to use CToolBar in this way? Pin
includeh109-Dec-06 6:38
includeh109-Dec-06 6:38 
AnswerRe: any idea to use CToolBar in this way? Pin
Mark Salsbery9-Dec-06 7:08
Mark Salsbery9-Dec-06 7:08 
AnswerRe: any idea to use CToolBar in this way? Pin
Mark Salsbery9-Dec-06 8:09
Mark Salsbery9-Dec-06 8:09 
Questionhelp reading integer string "Zero-based index of the button string" Pin
swarup9-Dec-06 5:56
swarup9-Dec-06 5:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.