Click here to Skip to main content
15,887,676 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: WSA Events Pin
csrss19-Jun-11 5:43
csrss19-Jun-11 5:43 
QuestionRe: WSA Events Pin
Mark Salsbery19-Jun-11 9:38
Mark Salsbery19-Jun-11 9:38 
GeneralRe: WSA Events Pin
csrss19-Jun-11 13:13
csrss19-Jun-11 13:13 
GeneralRe: WSA Events Pin
Mark Salsbery19-Jun-11 14:10
Mark Salsbery19-Jun-11 14:10 
GeneralRe: WSA Events Pin
csrss20-Jun-11 5:46
csrss20-Jun-11 5:46 
GeneralRe: WSA Events Pin
Mark Salsbery20-Jun-11 9:29
Mark Salsbery20-Jun-11 9:29 
GeneralRe: WSA Events Pin
csrss20-Jun-11 10:17
csrss20-Jun-11 10:17 
QuestionHow can I read all files from 'Recent File List' ? Pin
_Flaviu18-Jun-11 8:56
_Flaviu18-Jun-11 8:56 
AnswerRe: How can I read all files from 'Recent File List' ? Pin
Richard MacCutchan18-Jun-11 21:42
mveRichard MacCutchan18-Jun-11 21:42 
GeneralRe: How can I read all files from 'Recent File List' ? [modified] Pin
_Flaviu18-Jun-11 21:45
_Flaviu18-Jun-11 21:45 
GeneralRe: How can I read all files from 'Recent File List' ? Pin
Richard MacCutchan19-Jun-11 21:45
mveRichard MacCutchan19-Jun-11 21:45 
GeneralRe: How can I read all files from 'Recent File List' ? Pin
_Flaviu20-Jun-11 21:28
_Flaviu20-Jun-11 21:28 
GeneralRe: How can I read all files from 'Recent File List' ? Pin
_Flaviu22-Jun-11 20:24
_Flaviu22-Jun-11 20:24 
GeneralRe: How can I read all files from 'Recent File List' ? Pin
Richard MacCutchan22-Jun-11 21:56
mveRichard MacCutchan22-Jun-11 21:56 
QuestionBest Sound API for Game Development? Pin
AutoBot122518-Jun-11 5:04
AutoBot122518-Jun-11 5:04 
QuestionI had this interview question Pin
Software200718-Jun-11 4:26
Software200718-Jun-11 4:26 
AnswerRe: I had this interview question Pin
Philippe Mori18-Jun-11 5:14
Philippe Mori18-Jun-11 5:14 
GeneralRe: I had this interview question Pin
Software200718-Jun-11 15:17
Software200718-Jun-11 15:17 
AnswerRe: I had this interview question Pin
Chuck O'Toole18-Jun-11 15:59
Chuck O'Toole18-Jun-11 15:59 
GeneralRe: I had this interview question Pin
Software200719-Jun-11 13:53
Software200719-Jun-11 13:53 
AnswerRe: I had this interview question Pin
Stefan_Lang19-Jun-11 23:23
Stefan_Lang19-Jun-11 23:23 
GeneralRe: I had this interview question Pin
Software200720-Jun-11 3:17
Software200720-Jun-11 3:17 
Question__debugbreak(); [modified] Pin
Mohibur Rashid17-Jun-11 18:07
professionalMohibur Rashid17-Jun-11 18:07 
I am in learning process:

here I am trying to create a custom control in mfc
file 1:
InserEdit.h
#pragma once
#include <afxwin.h>
#define INSERTWINDOWCLASS L"INSERTWINDOWCLASS"
class CInsertEdit :
	public CWnd
{
DECLARE_DYNAMIC(CInsertEdit)
protected:
	CEdit *cid,*UserName,*PhoneNumber,*DateOfBirth,*Nationalities;
	//int OnCreate(LPCREATESTRUCT lpCreateStruct);
	BOOL PreCreateWindow(CREATESTRUCT& cs);
	void PreSubclassWindow();
public:
	CInsertEdit();
	~CInsertEdit(void);
	BOOL Create(CWnd* pParentWnd, const RECT& rect, UINT nID, DWORD dwStyle);
	
	DECLARE_MESSAGE_MAP()

private:
  //bool	m_bIsDynCreate;
  BOOL RegisterWindowClass();
};

InsertEdit.cpp
#include "InsertEdit.h"
BEGIN_MESSAGE_MAP( CInsertEdit, CWnd)
    
END_MESSAGE_MAP()
IMPLEMENT_DYNAMIC(CInsertEdit, CWnd)
CInsertEdit::CInsertEdit()
{
	RegisterWindowClass();
	return;
}

BOOL CInsertEdit::RegisterWindowClass()
{
	 WNDCLASS wndcls;
    HINSTANCE hInst = AfxGetInstanceHandle();

     if (!(::GetClassInfo(hInst, INSERTWINDOWCLASS, &wndcls)))
    {
		memset(&wndcls, 0, sizeof(WNDCLASS));
        wndcls.style            = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
        wndcls.lpfnWndProc      = ::DefWindowProc;
        wndcls.cbClsExtra       = wndcls.cbWndExtra = 0;
        wndcls.hInstance        = hInst;
        wndcls.hIcon            = NULL;
        wndcls.hCursor          = AfxGetApp()->LoadStandardCursor(IDC_ARROW);
        wndcls.hbrBackground    = (HBRUSH) (COLOR_WINDOW);//(HBRUSH) RGB(255,255,255);
        wndcls.lpszMenuName     = NULL;
        wndcls.lpszClassName    = INSERTWINDOWCLASS;
		wndcls.cbWndExtra		= NULL;

        if (!AfxRegisterClass(&wndcls))
        {
            AfxThrowResourceException();
            return FALSE;
        }
    }

    return TRUE;
}
CInsertEdit::~CInsertEdit(void)
{
}
BOOL CInsertEdit::PreCreateWindow(CREATESTRUCT& cs)
{
	/*cid=new CEdit();
	BOOL what=cid->Create(WS_VISIBLE|WS_CHILD|WS_BORDER,CRect(0,0,100,24),this,1);*/
	
	return CWnd::PreCreateWindow(cs);
}
void CInsertEdit::PreSubclassWindow()
{
	CWnd::PreSubclassWindow();
	cid=new CEdit();
	BOOL what=cid->Create(WS_VISIBLE|WS_CHILD|WS_BORDER,CRect(0,0,100,24),this,1);
	
}
//INSERTWINDOWCLASS
BOOL CInsertEdit::Create(CWnd* pParentWnd, const RECT& rect, UINT nID, DWORD dwStyle)
{
	//m_bIsDynCreate=TRUE;
	
	/*{
	
	}*/
	return CWnd::Create(INSERTWINDOWCLASS,L"",dwStyle,rect,pParentWnd,nID);
}


The problem is when i run the program it triggers to debug break point. it is created in PreSubclassWindow class. on line 3 with cig->Create calling. can anyone point out what I am doing wrong?

modified on Saturday, June 18, 2011 4:57 AM

AnswerRe: __debugbreak(); Pin
Richard MacCutchan17-Jun-11 22:48
mveRichard MacCutchan17-Jun-11 22:48 
AnswerRe: __debugbreak(); Pin
Mohibur Rashid17-Jun-11 23:04
professionalMohibur Rashid17-Jun-11 23:04 

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.