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

C / C++ / MFC

 
GeneralRe: Source code Prunning Pin
Steve S12-Mar-04 0:25
Steve S12-Mar-04 0:25 
Generaldo you use new()?please instruct me! Pin
vividtang11-Mar-04 21:31
vividtang11-Mar-04 21:31 
GeneralRe: do you use new()?please instruct me! Pin
toxcct11-Mar-04 21:48
toxcct11-Mar-04 21:48 
GeneralRe: do you use new()?please instruct me! Pin
jhwurmbach11-Mar-04 22:15
jhwurmbach11-Mar-04 22:15 
GeneralRe: do you use new()?please instruct me! Pin
vividtang12-Mar-04 0:22
vividtang12-Mar-04 0:22 
GeneralRe: do you use new()?please instruct me! Pin
jhwurmbach12-Mar-04 0:24
jhwurmbach12-Mar-04 0:24 
GeneralRe: do you use new()?please instruct me! Pin
vividtang12-Mar-04 16:21
vividtang12-Mar-04 16:21 
GeneralRe: do you use new()?please instruct me! Pin
vividtang12-Mar-04 16:33
vividtang12-Mar-04 16:33 
jhwurmbach ,thank you again.please help me,only write m_pAdd=new TheChildFrame(),1 error o warning,

below it is my "MainFrm.h" in short
#include "TheChildFrame.h"



class CMainFrame : public CMDIFrameWnd
{
DECLARE_DYNAMIC(CMainFrame)
public:
CMainFrame();

// Attributes
public:

CTheChildFrame *m_pAdd,*m_pChange; // BOOL m_bLogin;
BOOL m_bItemAdd,m_bItemChange;


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
below it is my "MainFrm.cpp"
#include "stdafx.h"
#include "Personnel3.h"
#include "LoginDlg.h"
#include "AddView.h"
#include "ChangeView.h"
#include "MainFrm.h"
//include "TheChildFrame.h"
extern CDatabase db;
BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
ON_WM_CREATE()
ON_UPDATE_COMMAND_UI(ID_SYSTEM_CONNECT, OnUpdateSystemConnect)
ON_UPDATE_COMMAND_UI(ID_SYSTEM_DISCONNECT, OnUpdateSystemDisconnect)
ON_UPDATE_COMMAND_UI(ID_MANAGE_ADD, OnUpdateManageAdd)
ON_COMMAND(ID_SYSTEM_CONNECT, OnSystemConnect)
ON_COMMAND(ID_SYSTEM_DISCONNECT, OnSystemDisconnect)
ON_WM_DESTROY()
ON_COMMAND(ID_MANAGE_ADD, OnManageAdd)
ON_UPDATE_COMMAND_UI(ID_MANAGER_CHANGE, OnUpdateManagerChange)
ON_COMMAND(ID_MANAGER_CHANGE, OnManagerChange)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction

CMainFrame::CMainFrame()
{
m_bLogin=FALSE; m_bItemAdd=FALSE; m_bItemChange=FALSE; m_bItemSearch=FALSE; m_pAdd=m_pChange=NULL;
}

CMainFrame::~CMainFrame()
{
}



void CMainFrame::OnUpdateSystemConnect(CCmdUI* pCmdUI)
{ pCmdUI->Enable(!m_bLogin);

}

void CMainFrame::OnUpdateSystemDisconnect(CCmdUI* pCmdUI)
{ pCmdUI->Enable(m_bLogin);

}

void CMainFrame::OnUpdateManageAdd(CCmdUI* pCmdUI)
{ pCmdUI->Enable(m_bItemAdd);

}

void CMainFrame::OnUpdateManagerChange(CCmdUI* pCmdUI)
{
pCmdUI->Enable(m_bItemChange);

}


void CMainFrame::OnSystemConnect()
{
CLoginDlg dlg;

if(dlg.DoModal()==IDOK)
{
m_bLogin=TRUE; m_bItemAdd=TRUE; m_bItemChange=TRUE; m_bItemSearch=TRUE;
}
}

void CMainFrame::OnSystemDisconnect()
{
db.Close(); if(m_pAdd) m_pAdd->DestroyWindow();
if(m_pChange) m_pChange->DestroyWindow();
//if(m_pSearch) m_pSearch->DestroyWindow();

m_bLogin=FALSE; m_bItemAdd=FALSE; m_bItemChange=FALSE; m_bItemSearch=FALSE;
}




void CMainFrame::OnDestroy()
{
CMDIFrameWnd::OnDestroy();

if(db.IsOpen()) db.Close();
}
void CMainFrame::OnManageAdd()
{
// 创建新子框架和视
m_pAdd=new CTheChildFrame(); /*
CCreateContext context;
context.m_pNewViewClass=RUNTIME_CLASS(CAddView);
if(!m_pAdd->LoadFrame(IDR_MAINFRAME,WS_OVERLAPPEDWINDOW | FWS_PREFIXTITLE ,this, &context )) return;
m_pAdd->InitialUpdateFrame(NULL,TRUE);

m_bItemAdd=FALSE; // 禁止"增加新员工"功能*/
}
GeneralTAPI Pin
chen_chen121211-Mar-04 20:51
chen_chen121211-Mar-04 20:51 
GeneralRe: TAPI Pin
Michael P Butler11-Mar-04 21:29
Michael P Butler11-Mar-04 21:29 
GeneralLanguage bar like app (IME) help pls Pin
Bagoj11-Mar-04 20:38
Bagoj11-Mar-04 20:38 
GeneralA question about asycfilt.dll Pin
Atif Mushtaq11-Mar-04 20:11
Atif Mushtaq11-Mar-04 20:11 
GeneralAccess Violation during Excel Automation Pin
Ajay Mudgal11-Mar-04 19:52
Ajay Mudgal11-Mar-04 19:52 
GeneralPlugin Frameworks Pin
Tarundeep Singh Kalra11-Mar-04 19:46
Tarundeep Singh Kalra11-Mar-04 19:46 
GeneralRe: Plugin Frameworks Pin
Florin Ochiana11-Mar-04 23:27
Florin Ochiana11-Mar-04 23:27 
GeneralRe: Plugin Frameworks Pin
Roger Allen12-Mar-04 1:05
Roger Allen12-Mar-04 1:05 
GeneralCCriticalSection Object frezee Pin
Do Manh Hung11-Mar-04 19:40
Do Manh Hung11-Mar-04 19:40 
GeneralRe: CCriticalSection Object frezee Pin
Neville Franks11-Mar-04 22:19
Neville Franks11-Mar-04 22:19 
GeneralRe: CCriticalSection Object frezee Pin
Do Manh Hung11-Mar-04 22:30
Do Manh Hung11-Mar-04 22:30 
GeneralRe: CCriticalSection Object frezee Pin
Neville Franks12-Mar-04 11:48
Neville Franks12-Mar-04 11:48 
Questionhow to hide a shortcut from desktop window? Pin
shoma11-Mar-04 18:24
shoma11-Mar-04 18:24 
AnswerRe: how to hide a shortcut from desktop window? Pin
Alexander M.,12-Mar-04 5:28
Alexander M.,12-Mar-04 5:28 
GeneralRe: how to hide a shortcut from desktop window? Pin
shoma14-Mar-04 15:57
shoma14-Mar-04 15:57 
Generalabout TAPI Pin
denly11-Mar-04 17:23
denly11-Mar-04 17:23 
GeneralRe: about TAPI Pin
Tarundeep Singh Kalra11-Mar-04 19:49
Tarundeep Singh Kalra11-Mar-04 19:49 

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.