Click here to Skip to main content
15,911,646 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: memory question Pin
Gary R. Wheeler9-Nov-02 3:03
Gary R. Wheeler9-Nov-02 3:03 
GeneralTextOut under WinCE!?! Pin
Daniel Strigl8-Nov-02 23:40
Daniel Strigl8-Nov-02 23:40 
Questionhow do I prevent 'oledlg.dll' linker references? Pin
Jan Van Der Mix8-Nov-02 23:24
sussJan Van Der Mix8-Nov-02 23:24 
AnswerRe: how do I prevent 'oledlg.dll' linker references? Pin
Tim Smith9-Nov-02 13:39
Tim Smith9-Nov-02 13:39 
GeneralFrozen window Pin
S O S8-Nov-02 22:37
S O S8-Nov-02 22:37 
GeneralRe: Frozen window Pin
includeh109-Nov-02 0:27
includeh109-Nov-02 0:27 
GeneralRe: Frozen window Pin
S O S9-Nov-02 0:58
S O S9-Nov-02 0:58 
QuestionHow to use CHtmlView? Pin
Chen Jiadong8-Nov-02 20:44
Chen Jiadong8-Nov-02 20:44 
i wrote a program which borrow some mfc class, when i let my view derive from CWnd, it runs OK, but when i let it derive from CHtmlView, it crashed. anybody knows why, the code is below:

//StdAfx.h
#include <afxwin.h>
#include <afxext.h>
#include <afxcmn.h>
#include <afxhtml.h>

//StdAfx.cpp
#include "StdAfx.h"

//MainFrm.h
#include "SimpleHtmlView.h"
class CMainFrame : public CFrameWnd
{
protected:
DECLARE_DYNCREATE(CMainFrame)
// Constructor & Destructor
public:
CMainFrame();
virtual ~CMainFrame();
// Attributes
protected:
CStatusBar m_wndStatusBar;
CSimpleHtmlView m_wndView;
// Methods
public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);

DECLARE_MESSAGE_MAP()
};

//MainFrm.cpp
#include "StdAfx.h"
#include "SimpleHtml.h"
#include "MainFrm.h"

IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
ON_WM_CREATE()
END_MESSAGE_MAP()

static UINT indicators[] =
{
ID_SEPARATOR,
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
};

CMainFrame::CMainFrame()
{}
CMainFrame::~CMainFrame()
{}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
cs.dwExStyle = 0;
cs.lpszClass = AfxRegisterWndClass(0, 0, 0, ::LoadIcon(AfxGetApp()->m_hInstance, MAKEINTRESOURCE(IDR_MAINFRAME)));
return TRUE;
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
//Register the windows class for its creation
if ( CFrameWnd::OnCreate(lpCreateStruct) == -1 )
return -1;
if ( !m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators) / sizeof(UINT)) )
{
TRACE0("Failed to create status bar\n");
return -1;
}
if ( !m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL) )
{
TRACE0("Failed to create view window\n");
return -1;
}
return TRUE;
}

//SimpleHtml.h
#include "Resource.h"
class CSimpleHtmlApp : public CWinApp
{
// Constructor & Destructor
public:
CSimpleHtmlApp();
virtual ~CSimpleHtmlApp();
// Methods
virtual BOOL InitInstance();
protected:
afx_msg void OnAppAbout();
DECLARE_MESSAGE_MAP();
};

//SimpleHtml.cpp
#include "StdAfx.h"
#include "SimpleHtml.h"
#include "MainFrm.h"

BEGIN_MESSAGE_MAP(CSimpleHtmlApp, CWinApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
END_MESSAGE_MAP()

CSimpleHtmlApp theApp;

CSimpleHtmlApp::CSimpleHtmlApp()
{}
CSimpleHtmlApp::~CSimpleHtmlApp()
{}
BOOL CSimpleHtmlApp::InitInstance()
{
CMainFrame* pMainFrame = new CMainFrame();
if( !pMainFrame->LoadFrame(IDR_MAINFRAME) )
return FALSE;
m_pMainWnd = pMainFrame;
pMainFrame->ShowWindow(m_nCmdShow);
pMainFrame->UpdateWindow();
return TRUE;
}
void CSimpleHtmlApp::OnAppAbout()
{
CDialog aboutDlg(IDD_ABOUTBOX);
aboutDlg.DoModal();
}

//SimpleHtmlView.h
class CSimpleHtmlView : public CHtmlView
{
protected:
DECLARE_DYNCREATE(CSimpleHtmlView)
// Construction & Destructor
public:
CSimpleHtmlView();
virtual ~CSimpleHtmlView();
// Methods
public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
DECLARE_MESSAGE_MAP()
};

//SimpleHtmlView.cpp
#include "StdAfx.h"
#include "SimpleHtml.h"
#include "SimpleHtmlView.h"

IMPLEMENT_DYNCREATE(CSimpleHtmlView, CHtmlView)
BEGIN_MESSAGE_MAP(CSimpleHtmlView, CHtmlView)
//{{AFX_MSG_MAP(CSimpleHtmlView)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

CSimpleHtmlView::CSimpleHtmlView()
{}
CSimpleHtmlView::~CSimpleHtmlView()
{}
BOOL CSimpleHtmlView::PreCreateWindow(CREATESTRUCT& cs)
{
return CHtmlView::PreCreateWindow(cs);
}

thank you very much
AnswerRe: How to use CHtmlView? Pin
Nasty_p24-Nov-02 15:52
Nasty_p24-Nov-02 15:52 
GeneralTo the person helping me with the edit control Pin
Anonymous8-Nov-02 16:29
Anonymous8-Nov-02 16:29 
GeneralRe: To the person helping me with the edit control Pin
includeh109-Nov-02 0:20
includeh109-Nov-02 0:20 
GeneralRe: To the person helping me with the edit control Pin
Anonymous9-Nov-02 1:37
Anonymous9-Nov-02 1:37 
GeneralRe: To the person helping me with the edit control Pin
includeh109-Nov-02 2:29
includeh109-Nov-02 2:29 
GeneralRe: THANK YOU!!!!!!!! Pin
georgiek509-Nov-02 6:05
georgiek509-Nov-02 6:05 
GeneralCCriticalSection & atomic operation Pin
zecodela8-Nov-02 16:25
zecodela8-Nov-02 16:25 
GeneralRe: CCriticalSection & atomic operation Pin
Anatari8-Nov-02 16:32
Anatari8-Nov-02 16:32 
QuestionHow to view function names in Workspace pane Pin
Member 18557708-Nov-02 15:36
Member 18557708-Nov-02 15:36 
AnswerRe: How to view function names in Workspace pane Pin
Stephane Rodriguez.9-Nov-02 2:35
Stephane Rodriguez.9-Nov-02 2:35 
GeneralRe: How to view function names in Workspace pane Pin
ant_antidote10-Nov-02 13:33
sussant_antidote10-Nov-02 13:33 
GeneralDefault Push Button Pin
Jon Sagara8-Nov-02 13:20
Jon Sagara8-Nov-02 13:20 
GeneralRe: Default Push Button Pin
Anatari8-Nov-02 16:17
Anatari8-Nov-02 16:17 
GeneralSerialize Pin
Anonymous8-Nov-02 13:16
Anonymous8-Nov-02 13:16 
GeneralRe: Serialize Pin
Anatari8-Nov-02 16:05
Anatari8-Nov-02 16:05 
GeneralRe: Serialize Pin
Ravi Bhavnani9-Nov-02 4:36
professionalRavi Bhavnani9-Nov-02 4:36 
GeneralMemory watch tool Pin
alex.barylski8-Nov-02 13:08
alex.barylski8-Nov-02 13:08 

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.