Erreur link

olfa7183 Messages postés 19 Statut Membre -  
mamiemando Messages postés 34243 Date d'inscription   Statut Modérateur Dernière intervention   -
Bonjour,

j'ai un projet programme sur visual C++ 6
lors de compilation me sors des erreurs de link ca due a quoi
voila mon programma

ccDLL_BillValitador.cpp

#include "stdafx.h"
#include "ccDLL_Test.h"
#include "ccDLL_BillValidator.h"

IMPLEMENT_DYNAMIC(ccDLL_BillValidator, CDialog)

ccDLL_BillValidator::ccDLL_BillValidator(CWnd* pParent /*=NULL*/)
: CDialog(ccDLL_BillValidator::IDD_BILLVALIDATOR, pParent)
, m_Val00(_T(""))
, m_Val01(_T(""))
, m_Val02(_T(""))
, m_Val03(_T(""))
, m_Val04(_T(""))
, m_Val05(_T(""))
, m_Val06(_T(""))
, m_Val07(_T(""))
, m_Val08(_T(""))
, m_Val09(_T(""))
, m_Val10(_T(""))
, m_Val11(_T(""))
, m_Val12(_T(""))
, m_Val14(_T(""))
, m_Val15(_T(""))
, m_Val13(_T(""))
, m_Curr00(_T(""))
, m_Curr01(_T(""))
, m_Curr02(_T(""))
, m_Curr03(_T(""))
, m_Curr04(_T(""))
, m_Curr05(_T(""))
, m_Curr06(_T(""))
, m_Curr07(_T(""))
, m_Curr08(_T(""))
, m_Curr09(_T(""))
, m_Curr10(_T(""))
, m_Curr11(_T(""))
, m_Curr12(_T(""))
, m_Curr13(_T(""))
, m_Curr14(_T(""))
, m_Curr15(_T(""))
, m_Enab00(FALSE)
, m_Enab01(FALSE)
, m_Enab02(FALSE)
, m_Enab03(FALSE)
, m_Enab04(FALSE)
, m_Enab05(FALSE)
, m_Enab06(FALSE)
, m_Enab07(FALSE)
, m_Enab08(FALSE)
, m_Enab09(FALSE)
, m_Enab10(FALSE)
, m_Enab11(FALSE)
, m_Enab12(FALSE)
, m_Enab13(FALSE)
, m_Enab14(FALSE)
, m_Enab15(FALSE)
, m_LastBill(_T(""))
, m_DoPoll(FALSE)
, m_MasterInhibit(FALSE)
, m_EscrowEnable(FALSE)
, m_Result(0)
, m_PIN(_T("123456"))
{
m_values[ 0] = &m_Val00;
m_values[ 1] = &m_Val01;
m_values[ 2] = &m_Val02;
m_values[ 3] = &m_Val03;
m_values[ 4] = &m_Val04;
m_values[ 5] = &m_Val05;
m_values[ 6] = &m_Val06;
m_values[ 7] = &m_Val07;
m_values[ 8] = &m_Val08;
m_values[ 9] = &m_Val09;
m_values[10] = &m_Val10;
m_values[11] = &m_Val11;
m_values[12] = &m_Val12;
m_values[13] = &m_Val13;
m_values[14] = &m_Val14;
m_values[15] = &m_Val15;
m_currencies[ 0] = &m_Curr00;
m_currencies[ 1] = &m_Curr01;
m_currencies[ 2] = &m_Curr02;
m_currencies[ 3] = &m_Curr03;
m_currencies[ 4] = &m_Curr04;
m_currencies[ 5] = &m_Curr05;
m_currencies[ 6] = &m_Curr06;
m_currencies[ 7] = &m_Curr07;
m_currencies[ 8] = &m_Curr08;
m_currencies[ 9] = &m_Curr09;
m_currencies[10] = &m_Curr10;
m_currencies[11] = &m_Curr11;
m_currencies[12] = &m_Curr12;
m_currencies[13] = &m_Curr13;
m_currencies[14] = &m_Curr14;
m_currencies[15] = &m_Curr15;
m_enables[ 0] = &m_Enab00;
m_enables[ 1] = &m_Enab01;
m_enables[ 2] = &m_Enab02;
m_enables[ 3] = &m_Enab03;
m_enables[ 4] = &m_Enab04;
m_enables[ 5] = &m_Enab05;
m_enables[ 6] = &m_Enab06;
m_enables[ 7] = &m_Enab07;
m_enables[ 8] = &m_Enab08;
m_enables[ 9] = &m_Enab09;
m_enables[10] = &m_Enab10;
m_enables[11] = &m_Enab11;
m_enables[12] = &m_Enab12;
m_enables[13] = &m_Enab13;
m_enables[14] = &m_Enab14;
m_enables[15] = &m_Enab15;

m_tmrid = 0;
}

ccDLL_BillValidator::~ccDLL_BillValidator()
{
}

void ccDLL_BillValidator::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Text(pDX, IDC_EDIT1, m_Val00);
DDX_Text(pDX, IDC_EDIT11, m_Val01);
DDX_Text(pDX, IDC_EDIT13, m_Val02);
DDX_Text(pDX, IDC_EDIT15, m_Val03);
DDX_Text(pDX, IDC_EDIT17, m_Val04);
DDX_Text(pDX, IDC_EDIT19, m_Val05);
DDX_Text(pDX, IDC_EDIT21, m_Val06);
DDX_Text(pDX, IDC_EDIT23, m_Val07);
DDX_Text(pDX, IDC_EDIT25, m_Val08);
DDX_Text(pDX, IDC_EDIT27, m_Val09);
DDX_Text(pDX, IDC_EDIT29, m_Val10);
DDX_Text(pDX, IDC_EDIT31, m_Val11);
DDX_Text(pDX, IDC_EDIT33, m_Val12);
DDX_Text(pDX, IDC_EDIT37, m_Val14);
DDX_Text(pDX, IDC_EDIT39, m_Val15);
DDX_Text(pDX, IDC_EDIT35, m_Val13);
DDX_Text(pDX, IDC_EDIT10, m_Curr00);
DDX_Text(pDX, IDC_EDIT14, m_Curr02);
DDX_Text(pDX, IDC_EDIT16, m_Curr03);
DDX_Text(pDX, IDC_EDIT18, m_Curr04);
DDX_Text(pDX, IDC_EDIT20, m_Curr05);
DDX_Text(pDX, IDC_EDIT22, m_Curr06);
DDX_Text(pDX, IDC_EDIT24, m_Curr07);
DDX_Text(pDX, IDC_EDIT26, m_Curr08);
DDX_Text(pDX, IDC_EDIT28, m_Curr09);
DDX_Text(pDX, IDC_EDIT30, m_Curr10);
DDX_Text(pDX, IDC_EDIT32, m_Curr11);
DDX_Text(pDX, IDC_EDIT34, m_Curr12);
DDX_Text(pDX, IDC_EDIT36, m_Curr13);
DDX_Text(pDX, IDC_EDIT38, m_Curr14);
DDX_Text(pDX, IDC_EDIT40, m_Curr15);
DDX_Check(pDX, IDC_CHECK1, m_Enab00);
DDX_Check(pDX, IDC_CHECK2, m_Enab01);
DDX_Check(pDX, IDC_CHECK3, m_Enab02);
DDX_Check(pDX, IDC_CHECK4, m_Enab03);
DDX_Check(pDX, IDC_CHECK5, m_Enab04);
DDX_Check(pDX, IDC_CHECK6, m_Enab05);
DDX_Check(pDX, IDC_CHECK7, m_Enab06);
DDX_Check(pDX, IDC_CHECK8, m_Enab07);
DDX_Check(pDX, IDC_CHECK9, m_Enab08);
DDX_Check(pDX, IDC_CHECK10, m_Enab09);
DDX_Check(pDX, IDC_CHECK11, m_Enab10);
DDX_Check(pDX, IDC_CHECK12, m_Enab11);
DDX_Check(pDX, IDC_CHECK13, m_Enab12);
DDX_Check(pDX, IDC_CHECK14, m_Enab13);
DDX_Check(pDX, IDC_CHECK15, m_Enab14);
DDX_Check(pDX, IDC_CHECK16, m_Enab15);
DDX_Text(pDX, IDC_EDIT41, m_LastBill);
DDX_Check(pDX, IDC_CHECK17, m_DoPoll);
DDX_Check(pDX, IDC_CHKINHIBIT, m_MasterInhibit);
DDX_Control(pDX, IDC_CBXBILLROUTE, m_cbxBillRoute);
DDX_Text(pDX, IDC_EDIT49, m_PIN);
}

BEGIN_MESSAGE_MAP(ccDLL_BillValidator, CDialog)
ON_BN_CLICKED(IDC_BTNREAD, ccDLL_BillValidator::OnBnClickedBtnread)
ON_BN_CLICKED(IDCANCEL, ccDLL_BillValidator::OnBnClickedCancel)
ON_BN_CLICKED(IDC_CHECK17, ccDLL_BillValidator::OnBnClickedCheck17)
ON_WM_CLOSE()
ON_WM_TIMER()
ON_BN_CLICKED(IDC_BTNRESET, ccDLL_BillValidator::OnBnClickedBtnreset)
ON_BN_CLICKED(IDC_BTNSET, ccDLL_BillValidator::OnBnClickedBtnset)
ON_BN_CLICKED(IDC_BTNINHIBIT, ccDLL_BillValidator::OnBnClickedBtninhibit)
ON_BN_CLICKED(IDC_BTNINHIBIT2, ccDLL_BillValidator::OnBnClickedBtninhibit2)
ON_BN_CLICKED(IDC_BTNESCROW2, ccDLL_BillValidator::OnBnClickedBtnescrow2)
ON_WM_SHOWWINDOW()
ON_BN_CLICKED(IDC_BTNROUTEBILL, ccDLL_BillValidator::OnBnClickedBtnroutebill)
ON_BN_CLICKED(IDC_BTNCHANGEPIN, ccDLL_BillValidator::OnBnClickedBtnchangepin)
END_MESSAGE_MAP()

void ccDLL_BillValidator::OnShowWindow(BOOL bShow, UINT nStatus)
{
CDialog::OnShowWindow(bShow, nStatus);

m_cbxBillRoute.AddString("Return");
m_cbxBillRoute.AddString("Stack");
m_cbxBillRoute.AddString("Extend");
m_cbxBillRoute.SetCurSel(0);
}

void ccDLL_BillValidator::OnBnClickedCancel()
{
OnCancel();
}

void ccDLL_BillValidator::OnClose()
{
if (m_tmrid != NULL)
{
int res = KillTimer(m_tmrid);
if (res) m_tmrid = NULL;
}

CDialog::OnClose();
}

void ccDLL_BillValidator::OnBnClickedCheck17()
{
if (m_tmrid != NULL)
{
int res = KillTimer(m_tmrid);
if (res) m_tmrid = NULL;
}
UpdateData(1);
if (m_DoPoll)
{
m_tmrid = SetTimer(1, 200, NULL);
}
}

// Poll the valdator
void ccDLL_BillValidator::OnTimer(UINT_PTR nIDEvent)
{
CCTALK_BILLEVENTS evts;
int evtctr;
CString posstr;

UpdateData(1);
m_Result = m_pCcVal->Poll(&evtctr, evts);

if (evtctr > 0)
{
if (evts[evtctr - 1].Status == CCBPOLL_BILL)
{
switch (evts[evtctr - 1].Position)
{
case CCBILLPOS_ESCROW:
posstr = "Escrow";
break;
case CCBILLPOS_STACKED:
posstr = "Stacked";
break;
default:
posstr = "Unknown";
break;
}
m_LastBill.Format("Bill: %0.2f %s - %s",
m_bills[evts[evtctr - 1].BillIndex].Value,
m_bills[evts[evtctr - 1].BillIndex].Currency,
posstr);
}
else
{
m_LastBill.Format("Status: %d", evts[evtctr - 1].Status);
}
}

CDialog::OnTimer(nIDEvent);
UpdateData(0);
}

void ccDLL_BillValidator::OnBnClickedBtnreset()
{
UpdateData(1);
m_Result = m_pCcVal->Reset();
UpdateData(0);
}

void ccDLL_BillValidator::OnBnClickedBtnread()
{
UpdateData(1);
for (int i = 0; i < MAX_BILLS; i++)
{
*m_values[i] = "";
*m_currencies[i] = "";
*m_enables[i] = false;
}
if ((m_Result = m_pCcVal->GetBillStatus(m_bills)) == CCERR_OK)
{
for (int i = 0; i < MAX_BILLS; i++)
{
m_values[i]->Format("%0.2f", m_bills[i].Value);
*m_currencies[i] = m_bills[i].Currency;
*m_enables[i] = m_bills[i].Enable;
}
}
UpdateData(0);
}

void ccDLL_BillValidator::OnBnClickedBtnset()
{
UpdateData(1);
for (int i = 0; i < MAX_BILLS; i++) m_bills[i].Enable = *m_enables[i];
m_Result = m_pCcVal->SetBillEnable(m_bills);
UpdateData(0);
}

void ccDLL_BillValidator::OnBnClickedBtninhibit()
{
UpdateData(1);
m_Result = m_pCcVal->GetMasterInhibit(&m_MasterInhibit);
UpdateData(0);
}

void ccDLL_BillValidator::OnBnClickedBtninhibit2()
{
UpdateData(1);
m_Result = m_pCcVal->SetMasterInhibit(m_MasterInhibit);
UpdateData(0);
}

void ccDLL_BillValidator::OnBnClickedBtnescrow2()
{
UpdateData(1);
m_Result = m_pCcVal->GetEscrowEnable(&m_EscrowEnable);
UpdateData(0);
}

void ccDLL_BillValidator::OnBnClickedBtnescrow()
{
UpdateData(1);
m_Result = m_pCcVal->SetEscrowEnable(m_EscrowEnable);
UpdateData(0);
}

void ccDLL_BillValidator::OnBnClickedBtnroutebill()
{
UpdateData(1);
switch (m_cbxBillRoute.GetCurSel())
{
case 0:
m_Result = m_pCcVal->RouteBill(CCBROUTE_RETURN);
break;
case 1:
m_Result = m_pCcVal->RouteBill(CCBROUTE_STACK);
break;
case 2:
m_Result = m_pCcVal->RouteBill(CCBROUTE_EXTEND);
break;
}
UpdateData(0);
}

void ccDLL_BillValidator::OnBnClickedBtnchangepin()
{
LPTSTR pinbff = m_PIN.GetBuffer(0);
if (m_PIN.GetLength() == 6)
for (int i = 0; i < 6; i++) m_pin[i] = pinbff[i] - '0';
else
for (int i = 0; i < 6; i++) m_pin[i] = 0;
m_pCcVal->ChangePINCode(m_pin);
}

ccDLL_coinselector.cpp

#include "stdafx.h"
#include "ccDLL_Test.h"
#include "ccDLL_CoinSelector.h"

IMPLEMENT_DYNAMIC(ccDLL_CoinSelector, CDialog)

ccDLL_CoinSelector::ccDLL_CoinSelector(CWnd* pParent /*=NULL*/)
: CDialog(ccDLL_CoinSelector::IDD_COINSELECTOR, pParent)
, m_Val00(_T(""))
, m_Val01(_T(""))
, m_Val02(_T(""))
, m_Val03(_T(""))
, m_Val04(_T(""))
, m_Val05(_T(""))
, m_Val06(_T(""))
, m_Val07(_T(""))
, m_Val08(_T(""))
, m_Val09(_T(""))
, m_Val10(_T(""))
, m_Val11(_T(""))
, m_Val12(_T(""))
, m_Val14(_T(""))
, m_Val15(_T(""))
, m_Curr00(_T(""))
, m_Curr01(_T(""))
, m_Curr02(_T(""))
, m_Curr03(_T(""))
, m_Curr04(_T(""))
, m_Curr05(_T(""))
, m_Curr06(_T(""))
, m_Curr07(_T(""))
, m_Curr08(_T(""))
, m_Curr09(_T(""))
, m_Curr10(_T(""))
, m_Curr11(_T(""))
, m_Curr12(_T(""))
, m_Curr13(_T(""))
, m_Curr14(_T(""))
, m_Curr15(_T(""))
, m_Enab00(FALSE)
, m_Enab01(FALSE)
, m_Enab02(FALSE)
, m_Enab03(FALSE)
, m_Enab04(FALSE)
, m_Enab05(FALSE)
, m_Enab06(FALSE)
, m_Enab07(FALSE)
, m_Enab08(FALSE)
, m_Enab09(FALSE)
, m_Enab10(FALSE)
, m_Enab12(FALSE)
, m_Enab13(FALSE)
, m_Enab14(FALSE)
, m_Enab15(FALSE)
, m_Enab11(FALSE)
, m_DoPoll(FALSE)
, m_LastCoin(_T(""))
{
m_values[ 0] = &m_Val00;
m_values[ 1] = &m_Val01;
m_values[ 2] = &m_Val02;
m_values[ 3] = &m_Val03;
m_values[ 4] = &m_Val04;
m_values[ 5] = &m_Val05;
m_values[ 6] = &m_Val06;
m_values[ 7] = &m_Val07;
m_values[ 8] = &m_Val08;
m_values[ 9] = &m_Val09;
m_values[10] = &m_Val10;
m_values[11] = &m_Val11;
m_values[12] = &m_Val12;
m_values[13] = &m_Val13;
m_values[14] = &m_Val14;
m_values[15] = &m_Val15;
m_currencies[ 0] = &m_Curr00;
m_currencies[ 1] = &m_Curr01;
m_currencies[ 2] = &m_Curr02;
m_currencies[ 3] = &m_Curr03;
m_currencies[ 4] = &m_Curr04;
m_currencies[ 5] = &m_Curr05;
m_currencies[ 6] = &m_Curr06;
m_currencies[ 7] = &m_Curr07;
m_currencies[ 8] = &m_Curr08;
m_currencies[ 9] = &m_Curr09;
m_currencies[10] = &m_Curr10;
m_currencies[11] = &m_Curr11;
m_currencies[12] = &m_Curr12;
m_currencies[13] = &m_Curr13;
m_currencies[14] = &m_Curr14;
m_currencies[15] = &m_Curr15;
m_enables[ 0] = &m_Enab00;
m_enables[ 1] = &m_Enab01;
m_enables[ 2] = &m_Enab02;
m_enables[ 3] = &m_Enab03;
m_enables[ 4] = &m_Enab04;
m_enables[ 5] = &m_Enab05;
m_enables[ 6] = &m_Enab06;
m_enables[ 7] = &m_Enab07;
m_enables[ 8] = &m_Enab08;
m_enables[ 9] = &m_Enab09;
m_enables[10] = &m_Enab10;
m_enables[11] = &m_Enab11;
m_enables[12] = &m_Enab12;
m_enables[13] = &m_Enab13;
m_enables[14] = &m_Enab14;
m_enables[15] = &m_Enab15;

m_tmrid = 0;
}

ccDLL_CoinSelector::~ccDLL_CoinSelector()
{
}

void ccDLL_CoinSelector::OnClose()
{
if (m_tmrid != NULL)
{
int res = KillTimer(m_tmrid);
if (res) m_tmrid = NULL;
}

CDialog::OnClose();
}

void ccDLL_CoinSelector::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Text(pDX, IDC_EDIT1, m_Val00);
DDX_Text(pDX, IDC_EDIT11, m_Val01);
DDX_Text(pDX, IDC_EDIT13, m_Val02);
DDX_Text(pDX, IDC_EDIT15, m_Val03);
DDX_Text(pDX, IDC_EDIT17, m_Val04);
DDX_Text(pDX, IDC_EDIT19, m_Val05);
DDX_Text(pDX, IDC_EDIT21, m_Val06);
DDX_Text(pDX, IDC_EDIT23, m_Val07);
DDX_Text(pDX, IDC_EDIT25, m_Val08);
DDX_Text(pDX, IDC_EDIT27, m_Val09);
DDX_Text(pDX, IDC_EDIT29, m_Val10);
DDX_Text(pDX, IDC_EDIT31, m_Val11);
DDX_Text(pDX, IDC_EDIT33, m_Val12);
DDX_Text(pDX, IDC_EDIT37, m_Val14);
DDX_Text(pDX, IDC_EDIT39, m_Val15);
DDX_Control(pDX, IDC_BTNREAD, m_btnRead);
DDX_Control(pDX, IDC_BTNSET, m_btnSet);
DDX_Text(pDX, IDC_EDIT10, m_Curr00);
DDX_Text(pDX, IDC_EDIT12, m_Curr01);
DDX_Text(pDX, IDC_EDIT14, m_Curr02);
DDX_Text(pDX, IDC_EDIT16, m_Curr03);
DDX_Text(pDX, IDC_EDIT18, m_Curr04);
DDX_Text(pDX, IDC_EDIT20, m_Curr05);
DDX_Text(pDX, IDC_EDIT22, m_Curr06);
DDX_Text(pDX, IDC_EDIT24, m_Curr07);
DDX_Text(pDX, IDC_EDIT26, m_Curr08);
DDX_Text(pDX, IDC_EDIT28, m_Curr09);
DDX_Text(pDX, IDC_EDIT30, m_Curr10);
DDX_Text(pDX, IDC_EDIT32, m_Curr11);
DDX_Text(pDX, IDC_EDIT34, m_Curr12);
DDX_Text(pDX, IDC_EDIT36, m_Curr13);
DDX_Text(pDX, IDC_EDIT38, m_Curr14);
DDX_Text(pDX, IDC_EDIT40, m_Curr15);
DDX_Check(pDX, IDC_CHECK1, m_Enab00);
DDX_Check(pDX, IDC_CHECK2, m_Enab01);
DDX_Check(pDX, IDC_CHECK3, m_Enab02);
DDX_Check(pDX, IDC_CHECK4, m_Enab03);
DDX_Check(pDX, IDC_CHECK5, m_Enab04);
DDX_Check(pDX, IDC_CHECK6, m_Enab05);
DDX_Check(pDX, IDC_CHECK7, m_Enab06);
DDX_Check(pDX, IDC_CHECK8, m_Enab07);
DDX_Check(pDX, IDC_CHECK9, m_Enab08);
DDX_Check(pDX, IDC_CHECK10, m_Enab09);
DDX_Check(pDX, IDC_CHECK11, m_Enab10);
DDX_Check(pDX, IDC_CHECK13, m_Enab12);
DDX_Check(pDX, IDC_CHECK14, m_Enab13);
DDX_Check(pDX, IDC_CHECK15, m_Enab14);
DDX_Check(pDX, IDC_CHECK16, m_Enab15);
DDX_Check(pDX, IDC_CHECK12, m_Enab11);
DDX_Check(pDX, IDC_CHECK17, m_DoPoll);
DDX_Text(pDX, IDC_EDIT41, m_LastCoin);
}

BEGIN_MESSAGE_MAP(ccDLL_CoinSelector, CDialog)
ON_BN_CLICKED(IDCANCEL, ccDLL_CoinSelector::OnBnClickedCancel)
ON_BN_CLICKED(IDC_BTNREAD, ccDLL_CoinSelector::OnBnClickedBtnread)
ON_BN_CLICKED(IDC_BTNSET, ccDLL_CoinSelector::OnBnClickedBtnset)
ON_BN_CLICKED(IDC_CHECK17, ccDLL_CoinSelector::OnBnClickedCheck17)
ON_WM_TIMER()
ON_BN_CLICKED(IDC_BTNRESET, ccDLL_CoinSelector::OnBnClickedBtnreset)
ON_WM_CLOSE()
END_MESSAGE_MAP()

void ccDLL_CoinSelector::OnBnClickedCancel()
{
OnCancel();
}

void ccDLL_CoinSelector::OnBnClickedBtnread()
{
m_pCcSel->GetCoinStatus(m_coins);
for (int i = 0; i < MAX_COINS; i++)
{
m_values[i]->Format("%0.2f", m_coins[i].Value);
*m_currencies[i] = m_coins[i].Currency;
*m_enables[i] = m_coins[i].Enable;
}
UpdateData(0);
}

void ccDLL_CoinSelector::OnBnClickedBtnset()
{
UpdateData(1);
for (int i = 0; i < MAX_COINS; i++)
{
m_coins[i].Enable = *m_enables[i];
}
m_pCcSel->SetCoinEnable(m_coins);
}

void ccDLL_CoinSelector::OnBnClickedBtnreset()
{
m_pCcSel->Reset();
}

void ccDLL_CoinSelector::OnBnClickedCheck17()
{
if (m_tmrid != NULL)
{
int res = KillTimer(m_tmrid);
if (res) m_tmrid = NULL;
}
UpdateData(1);
if (m_DoPoll)
{
m_tmrid = SetTimer(1, 200, NULL);
}
}

void ccDLL_CoinSelector::OnTimer(UINT_PTR nIDEvent)
{
CCTALK_COINEVENTS evts;
int evtctr;

m_pCcSel->Poll(&evtctr, evts);

if (evtctr > 0)
{
if (evts[evtctr - 1].Status == CCCPOLL_COIN)
{
m_LastCoin.Format("Coin: %0.2f %s (%d)",
m_coins[evts[evtctr - 1].CoinIndex].Value,
m_coins[evts[evtctr - 1].CoinIndex].Currency,
evts[evtctr - 1].Path);
}
else
{
m_LastCoin.Format("Status: %d", evts[evtctr - 1].Status);
}
UpdateData(0);
}

CDialog::OnTimer(nIDEvent);
}

les messages d'erreurs sont:
Linking...
ccDLL_BillValidator.obj : error LNK2001: unresolved external symbol "public: int __thiscall CBillValidator::Poll(int *,struct CCTALK_BILLEVENT * const)" (?Poll@CBillValidator@@QAEHPAHQAUCCTALK_BILLEVENT@@@Z)
ccDLL_BillValidator.obj : error LNK2001: unresolved external symbol "public: int __thiscall CcTalkDevice::Reset(void)" (?Reset@CcTalkDevice@@QAEHXZ)
ccDLL_CoinSelector.obj : error LNK2001: unresolved external symbol "public: int __thiscall CcTalkDevice::Reset(void)" (?Reset@CcTalkDevice@@QAEHXZ)
ccDLL_BillValidator.obj : error LNK2001: unresolved external symbol "public: int __thiscall CBillValidator::GetBillStatus(struct CCTALK_BILLENTRY * const)" (?GetBillStatus@CBillValidator@@QAEHQAUCCTALK_BILLENTRY@@@Z)
ccDLL_BillValidator.obj : error LNK2001: unresolved external symbol "public: int __thiscall CBillValidator::SetBillEnable(struct CCTALK_BILLENTRY * const)" (?SetBillEnable@CBillValidator@@QAEHQAUCCTALK_BILLENTRY@@@Z)
ccDLL_BillValidator.obj : error LNK2001: unresolved external symbol "public: int __thiscall CBillValidator::GetMasterInhibit(int *)" (?GetMasterInhibit@CBillValidator@@QAEHPAH@Z)
ccDLL_BillValidator.obj : error LNK2001: unresolved external symbol "public: int __thiscall CBillValidator::SetMasterInhibit(int)" (?SetMasterInhibit@CBillValidator@@QAEHH@Z)
ccDLL_BillValidator.obj : error LNK2001: unresolved external symbol "public: int __thiscall CBillValidator::GetEscrowEnable(int *)" (?GetEscrowEnable@CBillValidator@@QAEHPAH@Z)
ccDLL_BillValidator.obj : error LNK2001: unresolved external symbol "public: int __thiscall CBillValidator::SetEscrowEnable(int)" (?SetEscrowEnable@CBillValidator@@QAEHH@Z)
ccDLL_BillValidator.obj : error LNK2001: unresolved external symbol "public: int __thiscall CBillValidator::RouteBill(int)" (?RouteBill@CBillValidator@@QAEHH@Z)
ccDLL_BillValidator.obj : error LNK2001: unresolved external symbol "public: int __thiscall CcTalkDevice::ChangePINCode(unsigned char *)" (?ChangePINCode@CcTalkDevice@@QAEHPAE@Z)
ccDLL_CoinSelector.obj : error LNK2001: unresolved external symbol "public: int __thiscall CCoinSelector::GetCoinStatus(struct CCTALK_COINENTRY * const)" (?GetCoinStatus@CCoinSelector@@QAEHQAUCCTALK_COINENTRY@@@Z)
ccDLL_CoinSelector.obj : error LNK2001: unresolved external symbol "public: int __thiscall CCoinSelector::SetCoinEnable(struct CCTALK_COINENTRY * const)" (?SetCoinEnable@CCoinSelector@@QAEHQAUCCTALK_COINENTRY@@@Z)
ccDLL_CoinSelector.obj : error LNK2001: unresolved external symbol "public: int __thiscall CCoinSelector::Poll(int *,struct CCTALK_COINEVENT * const)" (?Poll@CCoinSelector@@QAEHPAHQAUCCTALK_COINEVENT@@@Z)
Debug/Monnayeur.exe : fatal error LNK1120: 13 unresolved externals
Error executing link.exe.

comment je les corrige
merci

17 réponses

olfa7183
 
bonjour;
merci pour ta reponse mais je ne puisse pas a resoudre ce probleme
vous pouvez me dire qu'est ce que je vais faire exactement
merci d'avance
0
olfa7183
 
je n'ai pas programmee dlgcore.cpp , il est sous visual
je vais t'expliquer qu'est ce que je veux faire exactement
je veux creer une bouton qui ouvre une boite de dialogue pour cela j'ai ecrit mon xxxxVieu.cpp le code suivant:
void CxxxxView::OnButton()
CDialog Dlg ;
Dlg.DoModal();
et quand je fais l'execution j'obtient le probleme d'assertion qui je te l'ai explique precedament
merci d'avance
0
olfa7183
 
voila mon code dlgcore.cpp
// This is a part of the Microsoft Foundation Classes C++ library.
// Copyright (C) 1992-1998 Microsoft Corporation
// All rights reserved.
//
// This source code is only intended as a supplement to the
// Microsoft Foundation Classes Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Microsoft Foundation Classes product.

#include "stdafx.h"
#include "occimpl.h"

#ifdef AFX_CORE1_SEG
#pragma code_seg(AFX_CORE1_SEG)
#endif

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

#define new DEBUG_NEW

/////////////////////////////////////////////////////////////////////////////
// AfxDlgProc - does nothing since all messages are handled via AfxWndProc

BOOL CALLBACK AfxDlgProc(HWND hWnd, UINT message, WPARAM, LPARAM)
{
if (message == WM_INITDIALOG)
{
// special case for WM_INITDIALOG
CDialog* pDlg = DYNAMIC_DOWNCAST(CDialog, CWnd::FromHandlePermanent(hWnd));
if (pDlg != NULL)
return pDlg->OnInitDialog();
else
return 1;
}
return 0;
}

/////////////////////////////////////////////////////////////////////////////
// CDialog - Modeless and Modal

BEGIN_MESSAGE_MAP(CDialog, CWnd)
#ifndef _AFX_NO_GRAYDLG_SUPPORT
ON_WM_CTLCOLOR()
#endif
//{{AFX_MSG_MAP(CDialog)
////ON_COMMAND(IDOK, OnOK)
//ON_COMMAND(IDCANCEL, OnCancel)
//ON_MESSAGE(WM_COMMANDHELP, OnCommandHelp)
//ON_MESSAGE(WM_HELPHITTEST, OnHelpHitTest)
ON_MESSAGE(WM_INITDIALOG, HandleInitDialog)
ON_MESSAGE(WM_SETFONT, HandleSetFont)
//}}AFX_MSG_MAP
#ifndef _AFX_NO_CTL3D_SUPPORT
// ON_MESSAGE(WM_QUERY3DCONTROLS, OnQuery3dControls)
#endif
END_MESSAGE_MAP()

BOOL CDialog::PreTranslateMessage(MSG* pMsg)
{
// for modeless processing (or modal)
ASSERT(m_hWnd != NULL);

// allow tooltip messages to be filtered
if (CWnd::PreTranslateMessage(pMsg))
return TRUE;

// don't translate dialog messages when in Shift+F1 help mode
CFrameWnd* pFrameWnd = GetTopLevelFrame();
if (pFrameWnd != NULL && pFrameWnd->m_bHelpMode)
return FALSE;

// fix around for VK_ESCAPE in a multiline Edit that is on a Dialog
// that doesn't have a cancel or the cancel is disabled.
if (pMsg->message == WM_KEYDOWN &&
(pMsg->wParam == VK_ESCAPE || pMsg->wParam == VK_CANCEL) &&
(::GetWindowLong(pMsg->hwnd, GWL_STYLE) & ES_MULTILINE) &&
_AfxCompareClassName(pMsg->hwnd, _T("Edit")))
{
HWND hItem = ::GetDlgItem(m_hWnd, IDCANCEL);
if (hItem == NULL || ::IsWindowEnabled(hItem))
{
SendMessage(WM_COMMAND, IDCANCEL, 0);
return TRUE;
}
}
// filter both messages to dialog and from children
return PreTranslateInput(pMsg);
}

BOOL CDialog::OnCmdMsg(UINT nID, int nCode, void* pExtra,
AFX_CMDHANDLERINFO* pHandlerInfo)
{
if (CWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
return TRUE;

if ((nCode != CN_COMMAND && nCode != CN_UPDATE_COMMAND_UI) ||
!IS_COMMAND_ID(nID) || nID >= 0xf000)
{
// control notification or non-command button or system command
return FALSE; // not routed any further
}

// if we have an owner window, give it second crack
CWnd* pOwner = GetParent();
if (pOwner != NULL)
{
#ifdef _DEBUG
if (afxTraceFlags & traceCmdRouting)
TRACE1("Routing command id 0x%04X to owner window.\n", nID);
#endif
ASSERT(pOwner != this);
if (pOwner->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
return TRUE;
}

// last crack goes to the current CWinThread object
CWinThread* pThread = AfxGetThread();
if (pThread != NULL)
{
#ifdef _DEBUG
if (afxTraceFlags & traceCmdRouting)
TRACE1("Routing command id 0x%04X to app.\n", nID);
#endif
if (pThread->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
return TRUE;
}

#ifdef _DEBUG
if (afxTraceFlags & traceCmdRouting)
{
TRACE2("IGNORING command id 0x%04X sent to %hs dialog.\n", nID,
GetRuntimeClass()->m_lpszClassName);
}
#endif
return FALSE;
}

/////////////////////////////////////////////////////////////////////////////
// Modeless Dialogs have 2-phase construction

CDialog::CDialog()
{
ASSERT(m_hWnd == NULL);
AFX_ZERO_INIT_OBJECT(CWnd);
}

CDialog::~CDialog()
{
if (m_hWnd != NULL)
{
TRACE0("Warning: calling DestroyWindow in CDialog::~CDialog --\n");
TRACE0("\tOnDestroy or PostNcDestroy in derived class will not be called.\n");
DestroyWindow();
}
}

BOOL CDialog::Create(LPCTSTR lpszTemplateName, CWnd* pParentWnd)
{
ASSERT(HIWORD(lpszTemplateName) == 0 ||
AfxIsValidString(lpszTemplateName));

m_lpszTemplateName = lpszTemplateName; // used for help
if (HIWORD(m_lpszTemplateName) == 0 && m_nIDHelp == 0)
m_nIDHelp = LOWORD((DWORD)m_lpszTemplateName);

#ifdef _DEBUG
if (!_AfxCheckDialogTemplate(lpszTemplateName, FALSE))
{
ASSERT(FALSE); // invalid dialog template name
PostNcDestroy(); // cleanup if Create fails too soon
return FALSE;
}
#endif //_DEBUG

HINSTANCE hInst = AfxFindResourceHandle(lpszTemplateName, RT_DIALOG);
HRSRC hResource = ::FindResource(hInst, lpszTemplateName, RT_DIALOG);
HGLOBAL hTemplate = LoadResource(hInst, hResource);
BOOL bResult = CreateIndirect(hTemplate, pParentWnd, hInst);
FreeResource(hTemplate);

return bResult;
}

// for backward compatibility
BOOL CDialog::CreateIndirect(HGLOBAL hDialogTemplate, CWnd* pParentWnd)
{
return CreateIndirect(hDialogTemplate, pParentWnd, NULL);
}

BOOL CDialog::CreateIndirect(HGLOBAL hDialogTemplate, CWnd* pParentWnd,
HINSTANCE hInst)
{
ASSERT(hDialogTemplate != NULL);

LPCDLGTEMPLATE lpDialogTemplate = (LPCDLGTEMPLATE)LockResource(hDialogTemplate);
BOOL bResult = CreateIndirect(lpDialogTemplate, pParentWnd, NULL, hInst);
UnlockResource(hDialogTemplate);

return bResult;
}

// for backward compatibility
BOOL CDialog::CreateIndirect(LPCDLGTEMPLATE lpDialogTemplate, CWnd* pParentWnd,
void* lpDialogInit)
{
return CreateIndirect(lpDialogTemplate, pParentWnd, lpDialogInit, NULL);
}

BOOL CDialog::CreateIndirect(LPCDLGTEMPLATE lpDialogTemplate, CWnd* pParentWnd,
void* lpDialogInit, HINSTANCE hInst)
{
ASSERT(lpDialogTemplate != NULL);

if (pParentWnd == NULL)
pParentWnd = AfxGetMainWnd();
m_lpDialogInit = lpDialogInit;

return CreateDlgIndirect(lpDialogTemplate, pParentWnd, hInst);
}

BOOL CWnd::CreateDlg(LPCTSTR lpszTemplateName, CWnd* pParentWnd)
{
// load resource
LPCDLGTEMPLATE lpDialogTemplate = NULL;
HGLOBAL hDialogTemplate = NULL;
HINSTANCE hInst = AfxFindResourceHandle(lpszTemplateName, RT_DIALOG);
HRSRC hResource = ::FindResource(hInst, lpszTemplateName, RT_DIALOG);
hDialogTemplate = LoadResource(hInst, hResource);
if (hDialogTemplate != NULL)
lpDialogTemplate = (LPCDLGTEMPLATE)LockResource(hDialogTemplate);
ASSERT(lpDialogTemplate != NULL);

// create a modeless dialog
BOOL bSuccess = CreateDlgIndirect(lpDialogTemplate, pParentWnd, hInst);

// free resource
UnlockResource(hDialogTemplate);
FreeResource(hDialogTemplate);

return bSuccess;
}

// for backward compatibility
BOOL CWnd::CreateDlgIndirect(LPCDLGTEMPLATE lpDialogTemplate, CWnd* pParentWnd)
{
return CreateDlgIndirect(lpDialogTemplate, pParentWnd, NULL);
}

BOOL CWnd::CreateDlgIndirect(LPCDLGTEMPLATE lpDialogTemplate,
CWnd* pParentWnd, HINSTANCE hInst)
{
ASSERT(lpDialogTemplate != NULL);
if (pParentWnd != NULL)
ASSERT_VALID(pParentWnd);

if (hInst == NULL)
hInst = AfxGetInstanceHandle();

#ifndef _AFX_NO_OCC_SUPPORT
_AFX_OCC_DIALOG_INFO occDialogInfo;
COccManager* pOccManager = afxOccManager;
#endif

HGLOBAL hTemplate = NULL;

HWND hWnd = NULL;
#ifdef _DEBUG
DWORD dwError = 0;
#endif

TRY
{
VERIFY(AfxDeferRegisterClass(AFX_WNDCOMMCTLS_REG));
AfxDeferRegisterClass(AFX_WNDCOMMCTLSNEW_REG);

#ifndef _AFX_NO_OCC_SUPPORT
// separately create OLE controls in the dialog template
if (pOccManager != NULL)
{
if (!SetOccDialogInfo(&occDialogInfo))
return FALSE;

lpDialogTemplate = pOccManager->PreCreateDialog(&occDialogInfo,
lpDialogTemplate);
}

if (lpDialogTemplate == NULL)
return FALSE;
#endif //!_AFX_NO_OCC_SUPPORT

// If no font specified, set the system font.
CString strFace;
WORD wSize = 0;
BOOL bSetSysFont = !CDialogTemplate::GetFont(lpDialogTemplate, strFace,
wSize);

// On DBCS systems, also change "MS Sans Serif" or "Helv" to system font.
if ((!bSetSysFont) && GetSystemMetrics(SM_DBCSENABLED))
{
bSetSysFont = (strFace == _T("MS Shell Dlg") ||
strFace == _T("MS Sans Serif") || strFace == _T("Helv"));
if (bSetSysFont && (wSize == 8))
wSize = 0;
}

if (bSetSysFont)
{
CDialogTemplate dlgTemp(lpDialogTemplate);
dlgTemp.SetSystemFont(wSize);
hTemplate = dlgTemp.Detach();
}

if (hTemplate != NULL)
lpDialogTemplate = (DLGTEMPLATE*)GlobalLock(hTemplate);

// setup for modal loop and creation
m_nModalResult = -1;
m_nFlags |= WF_CONTINUEMODAL;

// create modeless dialog
AfxHookWindowCreate(this);
hWnd = ::CreateDialogIndirect(hInst, lpDialogTemplate,
pParentWnd->GetSafeHwnd(), AfxDlgProc);
#ifdef _DEBUG
dwError = ::GetLastError();
#endif
}
CATCH_ALL(e)
{
DELETE_EXCEPTION(e);
m_nModalResult = -1;
}
END_CATCH_ALL

#ifndef _AFX_NO_OCC_SUPPORT
if (pOccManager != NULL)
{
pOccManager->PostCreateDialog(&occDialogInfo);
if (hWnd != NULL)
SetOccDialogInfo(NULL);
}
#endif //!_AFX_NO_OCC_SUPPORT

if (!AfxUnhookWindowCreate())
PostNcDestroy(); // cleanup if Create fails too soon

// handle EndDialog calls during OnInitDialog
if (hWnd != NULL && !(m_nFlags & WF_CONTINUEMODAL))
{
::DestroyWindow(hWnd);
hWnd = NULL;
}

if (hTemplate != NULL)
{
GlobalUnlock(hTemplate);
GlobalFree(hTemplate);
}

// help with error diagnosis (only if WM_INITDIALOG didn't EndDialog())
if (hWnd == NULL && (m_nFlags & WF_CONTINUEMODAL))
{
#ifdef _DEBUG
#ifndef _AFX_NO_OCC_SUPPORT
if (afxOccManager == NULL)
{
TRACE0(">>> If this dialog has OLE controls:\n");
TRACE0(">>> AfxEnableControlContainer has not been called yet.\n");
TRACE0(">>> You should call it in your app's InitInstance function.\n");
}
else if (dwError != 0)
{
TRACE1("Warning: Dialog creation failed! GetLastError returns 0x%8.8X\n", dwError);
}
#endif //!_AFX_NO_OCC_SUPPORT
#endif //_DEBUG
return FALSE;
}

ASSERT(hWnd == m_hWnd);
return TRUE;
}

#ifndef _AFX_NO_OCC_SUPPORT

BOOL CDialog::SetOccDialogInfo(_AFX_OCC_DIALOG_INFO* pOccDialogInfo)
{
m_pOccDialogInfo = pOccDialogInfo;
return TRUE;
}

#endif

/////////////////////////////////////////////////////////////////////////////
// Modal Dialogs

// Modal Constructors just save parameters
CDialog::CDialog(LPCTSTR lpszTemplateName, CWnd* pParentWnd)
{
ASSERT(HIWORD(lpszTemplateName) == 0 ||
AfxIsValidString(lpszTemplateName));

AFX_ZERO_INIT_OBJECT(CWnd);

m_pParentWnd = pParentWnd;
m_lpszTemplateName = lpszTemplateName;
if (HIWORD(m_lpszTemplateName) == 0)
m_nIDHelp = LOWORD((DWORD)m_lpszTemplateName);
}

CDialog::CDialog(UINT nIDTemplate, CWnd* pParentWnd)
{
AFX_ZERO_INIT_OBJECT(CWnd);

m_pParentWnd = pParentWnd;
m_lpszTemplateName = MAKEINTRESOURCE(nIDTemplate);
m_nIDHelp = nIDTemplate;
}

BOOL CDialog::InitModalIndirect(HGLOBAL hDialogTemplate, CWnd* pParentWnd)
{
// must be called on an empty constructed CDialog
ASSERT(m_lpszTemplateName == NULL);
ASSERT(m_hDialogTemplate == NULL);
ASSERT(hDialogTemplate != NULL);

if (m_pParentWnd == NULL)
m_pParentWnd = pParentWnd;

m_hDialogTemplate = hDialogTemplate;

return TRUE; // always ok (DoModal actually brings up dialog)
}

BOOL CDialog::InitModalIndirect(LPCDLGTEMPLATE lpDialogTemplate, CWnd* pParentWnd,
void* lpDialogInit)
{
// must be called on an empty constructed CDialog
ASSERT(m_lpszTemplateName == NULL);
ASSERT(m_lpDialogTemplate == NULL);
ASSERT(lpDialogTemplate != NULL);

if (m_pParentWnd == NULL)
m_pParentWnd = pParentWnd;

m_lpDialogTemplate = lpDialogTemplate;
m_lpDialogInit = lpDialogInit;

return TRUE; // always ok (DoModal actually brings up dialog)
}

HWND CDialog::PreModal()
{
// cannot call DoModal on a dialog already constructed as modeless
ASSERT(m_hWnd == NULL);

// allow OLE servers to disable themselves
CWinApp* pApp = AfxGetApp();
if (pApp != NULL)
pApp->EnableModeless(FALSE);

// find parent HWND
HWND hWnd = CWnd::GetSafeOwner_(m_pParentWnd->GetSafeHwnd(), &m_hWndTop);

// hook for creation of dialog
AfxHookWindowCreate(this);

// return window to use as parent for dialog
return hWnd;
}

void CDialog::PostModal()
{
AfxUnhookWindowCreate(); // just in case
Detach(); // just in case

// re-enable windows
if (::IsWindow(m_hWndTop))
::EnableWindow(m_hWndTop, TRUE);
m_hWndTop = NULL;
CWinApp* pApp = AfxGetApp();
if (pApp != NULL)
pApp->EnableModeless(TRUE);
}

int CDialog::DoModal()
{
// can be constructed with a resource template or InitModalIndirect
ASSERT(m_lpszTemplateName != NULL || m_hDialogTemplate != NULL ||
m_lpDialogTemplate != NULL);

// load resource as necessary
LPCDLGTEMPLATE lpDialogTemplate = m_lpDialogTemplate;
HGLOBAL hDialogTemplate = m_hDialogTemplate;
HINSTANCE hInst = AfxGetResourceHandle();
if (m_lpszTemplateName != NULL)
{
hInst = AfxFindResourceHandle(m_lpszTemplateName, RT_DIALOG);
HRSRC hResource = ::FindResource(hInst, m_lpszTemplateName, RT_DIALOG);
hDialogTemplate = LoadResource(hInst, hResource);
}
if (hDialogTemplate != NULL)
lpDialogTemplate = (LPCDLGTEMPLATE)LockResource(hDialogTemplate);

// return -1 in case of failure to load the dialog template resource
if (lpDialogTemplate == NULL)
return -1;

// disable parent (before creating dialog)
HWND hWndParent = PreModal();
AfxUnhookWindowCreate();
BOOL bEnableParent = FALSE;
if (hWndParent != NULL && ::IsWindowEnabled(hWndParent))
{
::EnableWindow(hWndParent, FALSE);
bEnableParent = TRUE;
}

TRY
{
// create modeless dialog
AfxHookWindowCreate(this);
if (CreateDlgIndirect(lpDialogTemplate,
CWnd::FromHandle(hWndParent), hInst))
{
if (m_nFlags & WF_CONTINUEMODAL)
{
// enter modal loop
DWORD dwFlags = MLF_SHOWONIDLE;
if (GetStyle() & DS_NOIDLEMSG)
dwFlags |= MLF_NOIDLEMSG;
VERIFY(RunModalLoop(dwFlags) == m_nModalResult);
}

// hide the window before enabling the parent, etc.
if (m_hWnd != NULL)
SetWindowPos(NULL, 0, 0, 0, 0, SWP_HIDEWINDOW|
SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOZORDER);
}
}
CATCH_ALL(e)
{
DELETE_EXCEPTION(e);
m_nModalResult = -1;
}
END_CATCH_ALL

if (bEnableParent)
::EnableWindow(hWndParent, TRUE);
if (hWndParent != NULL && ::GetActiveWindow() == m_hWnd)
::SetActiveWindow(hWndParent);

// destroy modal window
DestroyWindow();
PostModal();

// unlock/free resources as necessary
if (m_lpszTemplateName != NULL || m_hDialogTemplate != NULL)
UnlockResource(hDialogTemplate);
if (m_lpszTemplateName != NULL)
FreeResource(hDialogTemplate);

return m_nModalResult;
}

void CDialog::EndDialog(int nResult)
{
ASSERT(::IsWindow(m_hWnd));

if (m_nFlags & (WF_MODALLOOP|WF_CONTINUEMODAL))
EndModalLoop(nResult);

::EndDialog(m_hWnd, nResult);
}

/////////////////////////////////////////////////////////////////////////////
// Standard CDialog implementation

LRESULT CDialog::HandleSetFont(WPARAM wParam, LPARAM)
{
OnSetFont(CFont::FromHandle((HFONT)wParam));
return Default();
}

void CDialog::PreInitDialog()
{
// ignore it
}

LRESULT CDialog::HandleInitDialog(WPARAM, LPARAM)
{
PreInitDialog();

#ifndef _AFX_NO_OCC_SUPPORT
// create OLE controls
COccManager* pOccManager = afxOccManager;
if ((pOccManager != NULL) && (m_pOccDialogInfo != NULL))
{
BOOL bDlgInit;
if (m_lpDialogInit != NULL)
bDlgInit = pOccManager->CreateDlgControls(this, m_lpDialogInit,
m_pOccDialogInfo);
else
bDlgInit = pOccManager->CreateDlgControls(this, m_lpszTemplateName,
m_pOccDialogInfo);

if (!bDlgInit)
{
TRACE0("Warning: CreateDlgControls failed during dialog init.\n");
EndDialog(-1);
return FALSE;
}
}
#endif

// Default will call the dialog proc, and thus OnInitDialog
BOOL bResult = Default();

#ifndef _AFX_NO_OCC_SUPPORT
if (bResult && (m_nFlags & WF_OLECTLCONTAINER))
{
CWnd* pWndNext = GetNextDlgTabItem(NULL);
if (pWndNext != NULL)
{
pWndNext->SetFocus(); // UI Activate OLE control
bResult = FALSE;
}
}
#endif

return bResult;
}

BOOL AFXAPI AfxHelpEnabled()
{
if (AfxGetApp() == NULL)
return FALSE;

// help is enabled if the app has a handler for ID_HELP
AFX_CMDHANDLERINFO info;

// check main window first
CWnd* pWnd = AfxGetMainWnd();
if (pWnd != NULL && pWnd->OnCmdMsg(ID_HELP, CN_COMMAND, NULL, &info))
return TRUE;

// check app last
return AfxGetApp()->OnCmdMsg(ID_HELP, CN_COMMAND, NULL, &info);
}

void CDialog::OnSetFont(CFont*)
{
// ignore it
}

BOOL CDialog::OnInitDialog()
{
// execute dialog RT_DLGINIT resource
BOOL bDlgInit;
if (m_lpDialogInit != NULL)
bDlgInit = ExecuteDlgInit(m_lpDialogInit);
else
bDlgInit = ExecuteDlgInit(m_lpszTemplateName);

if (!bDlgInit)
{
TRACE0("Warning: ExecuteDlgInit failed during dialog init.\n");
EndDialog(-1);
return FALSE;
}

// transfer data into the dialog from member variables
if (!UpdateData(FALSE))
{
TRACE0("Warning: UpdateData failed during dialog init.\n");
EndDialog(-1);
return FALSE;
}

// enable/disable help button automatically
CWnd* pHelpButton = GetDlgItem(ID_HELP);
if (pHelpButton != NULL)
pHelpButton->ShowWindow(AfxHelpEnabled() ? SW_SHOW : SW_HIDE);

return TRUE; // set focus to first one
}

void CDialog::OnOK()
{
if (!UpdateData(TRUE))
{
TRACE0("UpdateData failed during dialog termination.\n");
// the UpdateData routine will set focus to correct item
return;
}
EndDialog(IDOK);
}

void CDialog::OnCancel()
{
EndDialog(IDCANCEL);
}

BOOL CDialog::CheckAutoCenter()
{
// load resource as necessary
LPCDLGTEMPLATE lpDialogTemplate = m_lpDialogTemplate;
HGLOBAL hDialogTemplate = m_hDialogTemplate;
if (m_lpszTemplateName != NULL)
{
HINSTANCE hInst = AfxFindResourceHandle(m_lpszTemplateName, RT_DIALOG);
HRSRC hResource = ::FindResource(hInst, m_lpszTemplateName, RT_DIALOG);
hDialogTemplate = LoadResource(hInst, hResource);
}
if (hDialogTemplate != NULL)
lpDialogTemplate = (LPCDLGTEMPLATE)LockResource(hDialogTemplate);

// determine if dialog should be centered
BOOL bResult = TRUE;

if (lpDialogTemplate != NULL)
{
DWORD dwStyle = lpDialogTemplate->style;
short x;
short y;

if (((DLGTEMPLATEEX*)lpDialogTemplate)->signature == 0xFFFF)
{
// it's a DIALOGEX resource
dwStyle = ((DLGTEMPLATEEX*)lpDialogTemplate)->style;
x = ((DLGTEMPLATEEX*)lpDialogTemplate)->x;
y = ((DLGTEMPLATEEX*)lpDialogTemplate)->y;
}
else
{
// it's a DIALOG resource
x = lpDialogTemplate->x;
y = lpDialogTemplate->y;
}

bResult = !(dwStyle & (DS_CENTER|DS_CENTERMOUSE|DS_ABSALIGN)) &&
x == 0 && y == 0;
}

// unlock/free resources as necessary
if (m_lpszTemplateName != NULL || m_hDialogTemplate != NULL)
UnlockResource(hDialogTemplate);
if (m_lpszTemplateName != NULL)
FreeResource(hDialogTemplate);

return bResult; // TRUE if auto-center is ok
}

/////////////////////////////////////////////////////////////////////////////
// Gray background support

#ifndef _AFX_NO_GRAYDLG_SUPPORT
HBRUSH CDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
// use helper in CWnd
return OnGrayCtlColor(pDC, pWnd, nCtlColor);
}
#endif //!_AFX_NO_GRAYDLG_SUPPORT

/////////////////////////////////////////////////////////////////////////////
// CDialog support for context sensitive help.

LRESULT CDialog::OnCommandHelp(WPARAM, LPARAM lParam)
{
if (lParam == 0 && m_nIDHelp != 0)
lParam = HID_BASE_RESOURCE + m_nIDHelp;
if (lParam != 0)
{
CWinApp* pApp = AfxGetApp();
if (pApp != NULL)
pApp->WinHelp(lParam);
return TRUE;
}
return FALSE;
}

LRESULT CDialog::OnHelpHitTest(WPARAM, LPARAM)
{
if (m_nIDHelp != 0)
return HID_BASE_RESOURCE + m_nIDHelp;
return 0;
}

/////////////////////////////////////////////////////////////////////////////
// CDialog Diagnostics

#ifdef _DEBUG
void CDialog::AssertValid() const
{
CWnd::AssertValid();
}

void CDialog::Dump(CDumpContext& dc) const
{
CWnd::Dump(dc);

dc << "m_lpszTemplateName = ";
if (HIWORD(m_lpszTemplateName) == 0)
dc << (int)LOWORD((DWORD)m_lpszTemplateName);
else
dc << m_lpszTemplateName;

dc << "\nm_hDialogTemplate = " << (UINT)m_hDialogTemplate;
dc << "\nm_lpDialogTemplate = " << (UINT)m_lpDialogTemplate;
dc << "\nm_pParentWnd = " << (void*)m_pParentWnd;
dc << "\nm_nIDHelp = " << m_nIDHelp;

dc << "\n";
}

// diagnostic routine to check for and decode dialog templates
// return FALSE if a program error occurs (i.e. bad resource ID or
// bad dialog styles).
BOOL AFXAPI _AfxCheckDialogTemplate(LPCTSTR lpszResource, BOOL bInvisibleChild)
{
ASSERT(lpszResource != NULL);
HINSTANCE hInst = AfxFindResourceHandle(lpszResource, RT_DIALOG);
HRSRC hResource = ::FindResource(hInst, lpszResource, RT_DIALOG);
if (hResource == NULL)
{
if (HIWORD(lpszResource) != 0)
TRACE1("ERROR: Cannot find dialog template named '%s'.\n",
lpszResource);
else
TRACE1("ERROR: Cannot find dialog template with IDD 0x%04X.\n",
LOWORD((DWORD)lpszResource));
return FALSE;
}

if (!bInvisibleChild)
return TRUE; // that's all we need to check

// we must check that the dialog template is for an invisible child
// window that can be used for a form-view or dialog-bar
HGLOBAL hTemplate = LoadResource(hInst, hResource);
if (hTemplate == NULL)
{
TRACE0("Warning: LoadResource failed for dialog template.\n");
// this is only a warning, the real call to CreateDialog will fail
return TRUE; // not a program error - just out of memory
}
DLGTEMPLATEEX* pTemplate = (DLGTEMPLATEEX*)LockResource(hTemplate);
DWORD dwStyle;
if (pTemplate->signature == 0xFFFF)
dwStyle = pTemplate->style;
else
dwStyle = ((DLGTEMPLATE*)pTemplate)->style;
UnlockResource(hTemplate);
FreeResource(hTemplate);

if (dwStyle & WS_VISIBLE)
{
if (HIWORD(lpszResource) != 0)
TRACE1("ERROR: Dialog named '%s' must be invisible.\n",
lpszResource);
else
TRACE1("ERROR: Dialog with IDD 0x%04X must be invisible.\n",
LOWORD((DWORD)lpszResource));
return FALSE;
}
if (!(dwStyle & WS_CHILD))
{
if (HIWORD(lpszResource) != 0)
TRACE1("ERROR: Dialog named '%s' must have the child style.\n",
lpszResource);
else
TRACE1("ERROR: Dialog with IDD 0x%04X must have the child style.\n",
LOWORD((DWORD)lpszResource));
return FALSE;
}

return TRUE;
}

#endif //_DEBUG

#ifdef AFX_INIT_SEG
#pragma code_seg(AFX_INIT_SEG)
#endif

IMPLEMENT_DYNAMIC(CDialog, CWnd)

/////////////////////////////////////////////////////////////////////////////
0
olfa7183 Messages postés 19 Statut Membre
 
comment ajouter une bibliotheque du microsoft visual studio au programme
merci
-1

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
mamiemando Messages postés 34243 Date d'inscription   Statut Modérateur Dernière intervention   7 898
 
Aucune idée je n'utilise pas cet IDE. J'imagine qu'il y a un endroit ou tu passes des options au compilateur (si c'est le cas c'est à cet endroit). Essaye avec code::blocks ou dev-cpp (ou passe sous linux), ou cherche dans la doc de visual studio.

Bonne chance
-1
olfa7183 Messages postés 19 Statut Membre
 
je fais une interface avec visual C++
lors de l'execution j'obtient ce message

Debug Assertion Failed
File: appcore.cpp
Line:85

qu'est ce que signifie ca je veux votre aide svp pour resoudre ce probleme
-1
mamiemando Messages postés 34243 Date d'inscription   Statut Modérateur Dernière intervention   7 898
 
Ca signifie que ligne 85 de appcore.cpp, une assertion (un test) n'est pas satisfait. Ceci laisse sous-entendre que le programmeur à estimé que si ce test était invalidé, le comportement de l'application serait imprévisible (ou celle-ci planterait).

À présent, il te faut regarder ce qui se site à cette endroit du code et réfléchir pourquoi dans ton cas le test est invalide.

Bonne chance
-1
mamiemando Messages postés 34243 Date d'inscription   Statut Modérateur Dernière intervention   7 898
 
Ben sans le code je ne peux pas te répondre. L'idéal serait que tu lances ton programme avec un debugger en pas à pas et que tu regardes pourquoi l'assertion se déclenche.

Bonne chance
-1
olfa7183
 
merci
j'ai 2 type de erreur de ce type
la premiere est dans appcore.cpp line 85 et voila son code
#include "stdafx.h"
#include <malloc.h>

#ifdef AFX_CORE1_SEG
#pragma code_seg(AFX_CORE1_SEG)
#endif

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

AFX_STATIC_DATA const TCHAR _afxFileSection[] = _T("Recent File List");
AFX_STATIC_DATA const TCHAR _afxFileEntry[] = _T("File%d");
AFX_STATIC_DATA const TCHAR _afxPreviewSection[] = _T("Settings");
AFX_STATIC_DATA const TCHAR _afxPreviewEntry[] = _T("PreviewPages");

/////////////////////////////////////////////////////////////////////////////
// globals (internal library use)

// CDocManager statics are in this file for granularity reasons
BOOL CDocManager::bStaticInit = TRUE;
CDocManager* CDocManager::pStaticDocManager = NULL;
CPtrList* CDocManager::pStaticList = NULL;

BEGIN_MESSAGE_MAP(CWinApp, CCmdTarget)
//{{AFX_MSG_MAP(CWinApp)
// Global File commands
ON_COMMAND(ID_APP_EXIT, OnAppExit)
// MRU - most recently used file menu
ON_UPDATE_COMMAND_UI(ID_FILE_MRU_FILE1, OnUpdateRecentFileMenu)
ON_COMMAND_EX_RANGE(ID_FILE_MRU_FILE1, ID_FILE_MRU_FILE16, OnOpenRecentFile)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// _AFX_WIN_STATE implementation

#ifndef _AFX_NO_GRAYDLG_SUPPORT

#ifdef AFX_INIT_SEG
#pragma code_seg(AFX_INIT_SEG)
#endif

_AFX_WIN_STATE::_AFX_WIN_STATE()
{
// Note: it is only necessary to intialize non-zero data.
}

#ifdef AFX_TERM_SEG
#pragma code_seg(AFX_TERM_SEG)
#endif

_AFX_WIN_STATE::~_AFX_WIN_STATE()
{
AfxDeleteObject((HGDIOBJ*)&m_hDlgBkBrush);
}

#endif //!_AFX_NO_GRAYDLG_SUPPORT

#ifdef AFX_INIT_SEG
#pragma code_seg(AFX_INIT_SEG)
#endif

CWinApp::CWinApp(LPCTSTR lpszAppName)
{
if (lpszAppName != NULL)
m_pszAppName = _tcsdup(lpszAppName);
else
m_pszAppName = NULL;

// initialize CWinThread state
AFX_MODULE_STATE* pModuleState = _AFX_CMDTARGET_GETSTATE();
AFX_MODULE_THREAD_STATE* pThreadState = pModuleState->m_thread;
ASSERT(AfxGetThread() == NULL);
pThreadState->m_pCurrentWinThread = this;
ASSERT(AfxGetThread() == this);
m_hThread = ::GetCurrentThread();
m_nThreadID = ::GetCurrentThreadId();

// initialize CWinApp state
ASSERT(afxCurrentWinApp == NULL); // only one CWinApp object please
pModuleState->m_pCurrentWinApp = this;
ASSERT(AfxGetApp() == this);

// in non-running state until WinMain
m_hInstance = NULL;
m_pszHelpFilePath = NULL;
m_pszProfileName = NULL;
m_pszRegistryKey = NULL;
m_pszExeName = NULL;
m_pRecentFileList = NULL;
m_pDocManager = NULL;
m_atomApp = m_atomSystemTopic = NULL;
m_lpCmdLine = NULL;
m_pCmdInfo = NULL;

// initialize wait cursor state
m_nWaitCursorCount = 0;
m_hcurWaitCursorRestore = NULL;

// initialize current printer state
m_hDevMode = NULL;
m_hDevNames = NULL;
m_nNumPreviewPages = 0; // not specified (defaults to 1)

// initialize DAO state
m_lpfnDaoTerm = NULL; // will be set if AfxDaoInit called

// other initialization
m_bHelpMode = FALSE;
m_nSafetyPoolSize = 512; // default size
}

BOOL CWinApp::InitApplication()
{
if (CDocManager::pStaticDocManager != NULL)
{
if (m_pDocManager == NULL)
m_pDocManager = CDocManager::pStaticDocManager;
CDocManager::pStaticDocManager = NULL;
}

if (m_pDocManager != NULL)
m_pDocManager->AddDocTemplate(NULL);
else
CDocManager::bStaticInit = FALSE;

return TRUE;
}

BOOL CWinApp::InitInstance()
{
return TRUE;
}

void CWinApp::LoadStdProfileSettings(UINT nMaxMRU)
{
ASSERT_VALID(this);
ASSERT(m_pRecentFileList == NULL);

if (nMaxMRU != 0)
{
// create file MRU since nMaxMRU not zero
m_pRecentFileList = new CRecentFileList(0, _afxFileSection, _afxFileEntry,
nMaxMRU);
m_pRecentFileList->ReadList();
}
// 0 by default means not set
m_nNumPreviewPages = GetProfileInt(_afxPreviewSection, _afxPreviewEntry, 0);
}

void CWinApp::ParseCommandLine(CCommandLineInfo& rCmdInfo)
{
for (int i = 1; i < __argc; i++)
{
LPCTSTR pszParam = __targv[i];
BOOL bFlag = FALSE;
BOOL bLast = ((i + 1) == __argc);
if (pszParam[0] == '-' || pszParam[0] == '/')
{
// remove flag specifier
bFlag = TRUE;
++pszParam;
}
rCmdInfo.ParseParam(pszParam, bFlag, bLast);
}
}

/////////////////////////////////////////////////////////////////////////////
// CCommandLineInfo implementation

CCommandLineInfo::CCommandLineInfo()
{
m_bShowSplash = TRUE;
m_bRunEmbedded = FALSE;
m_bRunAutomated = FALSE;
m_nShellCommand = FileNew;
}

CCommandLineInfo::~CCommandLineInfo()
{
}

void CCommandLineInfo::ParseParam(const TCHAR* pszParam,BOOL bFlag,BOOL bLast)
{
if (bFlag)
{
USES_CONVERSION;
ParseParamFlag(T2CA(pszParam));
}
else
ParseParamNotFlag(pszParam);

ParseLast(bLast);
}

#ifdef UNICODE
void CCommandLineInfo::ParseParam(const char* pszParam, BOOL bFlag, BOOL bLast)
{
if (bFlag)
ParseParamFlag(pszParam);
else
ParseParamNotFlag(pszParam);

ParseLast(bLast);
}
#endif // UNICODE

void CCommandLineInfo::ParseParamFlag(const char* pszParam)
{
// OLE command switches are case insensitive, while
// shell command switches are case sensitive

if (lstrcmpA(pszParam, "pt") == 0)
m_nShellCommand = FilePrintTo;
else if (lstrcmpA(pszParam, "p") == 0)
m_nShellCommand = FilePrint;
else if (lstrcmpiA(pszParam, "Unregister") == 0 ||
lstrcmpiA(pszParam, "Unregserver") == 0)
m_nShellCommand = AppUnregister;
else if (lstrcmpA(pszParam, "dde") == 0)
{
AfxOleSetUserCtrl(FALSE);
m_nShellCommand = FileDDE;
}
else if (lstrcmpiA(pszParam, "Embedding") == 0)
{
AfxOleSetUserCtrl(FALSE);
m_bRunEmbedded = TRUE;
m_bShowSplash = FALSE;
}
else if (lstrcmpiA(pszParam, "Automation") == 0)
{
AfxOleSetUserCtrl(FALSE);
m_bRunAutomated = TRUE;
m_bShowSplash = FALSE;
}
}

void CCommandLineInfo::ParseParamNotFlag(const TCHAR* pszParam)
{
if (m_strFileName.IsEmpty())
m_strFileName = pszParam;
else if (m_nShellCommand == FilePrintTo && m_strPrinterName.IsEmpty())
m_strPrinterName = pszParam;
else if (m_nShellCommand == FilePrintTo && m_strDriverName.IsEmpty())
m_strDriverName = pszParam;
else if (m_nShellCommand == FilePrintTo && m_strPortName.IsEmpty())
m_strPortName = pszParam;
}

#ifdef UNICODE
void CCommandLineInfo::ParseParamNotFlag(const char* pszParam)
{
if (m_strFileName.IsEmpty())
m_strFileName = pszParam;
else if (m_nShellCommand == FilePrintTo && m_strPrinterName.IsEmpty())
m_strPrinterName = pszParam;
else if (m_nShellCommand == FilePrintTo && m_strDriverName.IsEmpty())
m_strDriverName = pszParam;
else if (m_nShellCommand == FilePrintTo && m_strPortName.IsEmpty())
m_strPortName = pszParam;
}
#endif

void CCommandLineInfo::ParseLast(BOOL bLast)
{
if (bLast)
{
if (m_nShellCommand == FileNew && !m_strFileName.IsEmpty())
m_nShellCommand = FileOpen;
m_bShowSplash = !m_bRunEmbedded && !m_bRunAutomated;
}
}

/////////////////////////////////////////////////////////////////////////////
// App termination

CWinApp::~CWinApp()
{
// free doc manager
if (m_pDocManager != NULL)
delete m_pDocManager;

// free recent file list
if (m_pRecentFileList != NULL)
delete m_pRecentFileList;

// free static list of document templates
if (!afxContextIsDLL)
{
if (CDocManager::pStaticList != NULL)
{
delete CDocManager::pStaticList;
CDocManager::pStaticList = NULL;
}
if (CDocManager::pStaticDocManager != NULL)
{
delete CDocManager::pStaticDocManager;
CDocManager::pStaticDocManager = NULL;
}
}

// free printer info
if (m_hDevMode != NULL)
AfxGlobalFree(m_hDevMode);
if (m_hDevNames != NULL)
AfxGlobalFree(m_hDevNames);

// free atoms if used
if (m_atomApp != NULL)
::GlobalDeleteAtom(m_atomApp);
if (m_atomSystemTopic != NULL)
::GlobalDeleteAtom(m_atomSystemTopic);

// free cached commandline
if (m_pCmdInfo != NULL)
delete m_pCmdInfo;

// cleanup module state
AFX_MODULE_STATE* pModuleState = _AFX_CMDTARGET_GETSTATE();
if (pModuleState->m_lpszCurrentAppName == m_pszAppName)
pModuleState->m_lpszCurrentAppName = NULL;
if (pModuleState->m_pCurrentWinApp == this)
pModuleState->m_pCurrentWinApp = NULL;

// free various strings allocated with _tcsdup
free((void*)m_pszAppName);
free((void*)m_pszRegistryKey);
free((void*)m_pszExeName);
free((void*)m_pszHelpFilePath);
free((void*)m_pszProfileName);

// avoid calling CloseHandle() on our own thread handle
// during the CWinThread destructor
m_hThread = NULL;
}

void CWinApp::SaveStdProfileSettings()
{
ASSERT_VALID(this);

if (m_pRecentFileList != NULL)
m_pRecentFileList->WriteList();

if (m_nNumPreviewPages != 0)
WriteProfileInt(_afxPreviewSection, _afxPreviewEntry, m_nNumPreviewPages);
}

int CWinApp::ExitInstance()
{
// if we remember that we're unregistering,
// don't save our profile settings

if (m_pCmdInfo == NULL ||
m_pCmdInfo->m_nShellCommand != CCommandLineInfo::AppUnregister)
{
if (!afxContextIsDLL)
SaveStdProfileSettings();
}

// Cleanup DAO if necessary
if (m_lpfnDaoTerm != NULL)
{
// If a DLL, YOU must call AfxDaoTerm prior to ExitInstance
ASSERT(!afxContextIsDLL);
(*m_lpfnDaoTerm)();
}

return m_msgCur.wParam; // returns the value from PostQuitMessage
}

/////////////////////////////////////////////////////////////////////////////

#ifdef AFX_CORE1_SEG
#pragma code_seg(AFX_CORE1_SEG)
#endif

// Main running routine until application exits
int CWinApp::Run()
{
if (m_pMainWnd == NULL && AfxOleGetUserCtrl())
{
// Not launched /Embedding or /Automation, but has no main window!
TRACE0("Warning: m_pMainWnd is NULL in CWinApp::Run - quitting application.\n");
AfxPostQuitMessage(0);
}
return CWinThread::Run();
}

#ifdef AFX_TERM_SEG
#pragma code_seg(AFX_TERM_SEG)
#endif

void AFXAPI AfxPostQuitMessage(int nExitCode)
{
// cleanup OLE libraries
CWinThread* pThread = AfxGetThread();
if (pThread != NULL && pThread->m_lpfnOleTermOrFreeLib != NULL)
(*pThread->m_lpfnOleTermOrFreeLib)(TRUE, TRUE);

::PostQuitMessage(nExitCode);
}

/////////////////////////////////////////////////////////////////////////////
// WinHelp Helper

#ifdef AFX_CORE1_SEG
#pragma code_seg(AFX_CORE1_SEG)
#endif

void CWinApp::WinHelp(DWORD dwData, UINT nCmd)
{
CWnd* pMainWnd = AfxGetMainWnd();
ASSERT_VALID(pMainWnd);

// return global app help mode state to FALSE (backward compatibility)
m_bHelpMode = FALSE;
pMainWnd->PostMessage(WM_KICKIDLE); // trigger idle update

pMainWnd->WinHelp(dwData, nCmd);
}

/////////////////////////////////////////////////////////////////////////////
// Special exception handling

LRESULT CWinApp::ProcessWndProcException(CException* e, const MSG* pMsg)
{
// handle certain messages in CWinThread
switch (pMsg->message)
{
case WM_CREATE:
case WM_PAINT:
return CWinThread::ProcessWndProcException(e, pMsg);
}

// handle all the rest
UINT nIDP = AFX_IDP_INTERNAL_FAILURE; // generic message string
LRESULT lResult = 0; // sensible default
if (pMsg->message == WM_COMMAND)
{
if ((HWND)pMsg->lParam == NULL)
nIDP = AFX_IDP_COMMAND_FAILURE; // command (not from a control)
lResult = (LRESULT)TRUE; // pretend the command was handled
}
if (e->IsKindOf(RUNTIME_CLASS(CMemoryException)))
{
e->ReportError(MB_ICONEXCLAMATION|MB_SYSTEMMODAL, nIDP);
}
else if (!e->IsKindOf(RUNTIME_CLASS(CUserException)))
{
// user has not been alerted yet of this catastrophic problem
e->ReportError(MB_ICONSTOP, nIDP);
}
return lResult; // sensible default return from most WndProc functions
}

/////////////////////////////////////////////////////////////////////////////
// CWinApp idle processing

BOOL CWinApp::OnIdle(LONG lCount)
{
if (lCount <= 0)
{
CWinThread::OnIdle(lCount);

// call doc-template idle hook
POSITION pos = NULL;
if (m_pDocManager != NULL)
pos = m_pDocManager->GetFirstDocTemplatePosition();

while (pos != NULL)
{
CDocTemplate* pTemplate = m_pDocManager->GetNextDocTemplate(pos);
ASSERT_KINDOF(CDocTemplate, pTemplate);
pTemplate->OnIdle();
}
}
else if (lCount == 1)
{
VERIFY(!CWinThread::OnIdle(lCount));
}
return lCount < 1; // more to do if lCount < 1
}

/////////////////////////////////////////////////////////////////////////////
// CWinApp idle processing

void CWinApp::DevModeChange(LPTSTR lpDeviceName)
{
if (m_hDevNames == NULL)
return;

LPDEVNAMES lpDevNames = (LPDEVNAMES)::GlobalLock(m_hDevNames);
ASSERT(lpDevNames != NULL);
if (lstrcmp((LPCTSTR)lpDevNames + lpDevNames->wDeviceOffset,
lpDeviceName) == 0)
{
HANDLE hPrinter;
if (!OpenPrinter(lpDeviceName, &hPrinter, NULL))
return;

// DEVMODE changed for the current printer
if (m_hDevMode != NULL)
AfxGlobalFree(m_hDevMode);

// A zero for last param returns the size of buffer needed.
int nSize = DocumentProperties(NULL, hPrinter, lpDeviceName,
NULL, NULL, 0);
ASSERT(nSize >= 0);
m_hDevMode = GlobalAlloc(GHND, nSize);
LPDEVMODE lpDevMode = (LPDEVMODE)GlobalLock(m_hDevMode);

// Fill in the rest of the structure.
if (DocumentProperties(NULL, hPrinter, lpDeviceName, lpDevMode,
NULL, DM_OUT_BUFFER) != IDOK)
{
AfxGlobalFree(m_hDevMode);
m_hDevMode = NULL;
}
ClosePrinter(hPrinter);
}
}

///////////////////////////////////////////////////////////////////////////
// CWinApp diagnostics

#ifdef _DEBUG
void CWinApp::AssertValid() const
{
CWinThread::AssertValid();

ASSERT(afxCurrentWinApp == this);
ASSERT(afxCurrentInstanceHandle == m_hInstance);

if (AfxGetThread() != (CWinThread*)this)
return; // only do subset if called from different thread

if (m_pDocManager != NULL)
ASSERT_VALID(m_pDocManager);
}

void CWinApp::Dump(CDumpContext& dc) const
{
CWinThread::Dump(dc);

dc << "m_hInstance = " << (UINT)m_hInstance;
dc << "\nm_hPrevInstance = " << (UINT)m_hPrevInstance;
dc << "\nm_lpCmdLine = " << m_lpCmdLine;
dc << "\nm_nCmdShow = " << m_nCmdShow;
dc << "\nm_pszAppName = " << m_pszAppName;
dc << "\nm_bHelpMode = " << m_bHelpMode;
dc << "\nm_pszExeName = " << m_pszExeName;
dc << "\nm_pszHelpFilePath = " << m_pszHelpFilePath;
dc << "\nm_pszProfileName = " << m_pszProfileName;
dc << "\nm_hDevMode = " << (UINT)m_hDevMode;
dc << "\nm_hDevNames = " << (UINT)m_hDevNames;
dc << "\nm_dwPromptContext = " << m_dwPromptContext;

if (m_pRecentFileList != NULL)
{
dc << "\nm_strRecentFiles[] = ";
int nSize = m_pRecentFileList->GetSize();
for (int i = 0; i < nSize; i++)
{
if ((*m_pRecentFileList)[i].GetLength() != 0)
dc << "\n\tFile: " << (*m_pRecentFileList)[i];
}
}

if (m_pDocManager != NULL)
m_pDocManager->Dump(dc);

dc << "\nm_nWaitCursorCount = " << m_nWaitCursorCount;
dc << "\nm_hcurWaitCursorRestore = " << (UINT)m_hcurWaitCursorRestore;
dc << "\nm_nNumPreviewPages = " << m_nNumPreviewPages;

dc << "\nm_msgCur = {";
dc << "\n\thwnd = " << (UINT)m_msgCur.hwnd;
dc << "\n\tmessage = " << (UINT)m_msgCur.message;
dc << "\n\twParam = " << (UINT)m_msgCur.wParam;
dc << "\n\tlParam = " << (void*)m_msgCur.lParam;
dc << "\n\ttime = " << m_msgCur.time;
dc << "\n\tpt = " << CPoint(m_msgCur.pt);
dc << "\n}";

dc << "\n";
}
#endif

#ifdef AFX_INIT_SEG
#pragma code_seg(AFX_INIT_SEG)
#endif

IMPLEMENT_DYNAMIC(CWinApp, CWinThread)

#pragma warning(disable: 4074)
#pragma init_seg(lib)

PROCESS_LOCAL(_AFX_WIN_STATE, _afxWinState)

/////////////////////////////////////////////////////////////////////////////



la deuxieme est dans dlgcore.cpp ligne 494 voici son code
#include "stdafx.h"
#include "occimpl.h"

#ifdef AFX_CORE1_SEG
#pragma code_seg(AFX_CORE1_SEG)
#endif

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

#define new DEBUG_NEW

/////////////////////////////////////////////////////////////////////////////
// AfxDlgProc - does nothing since all messages are handled via AfxWndProc

BOOL CALLBACK AfxDlgProc(HWND hWnd, UINT message, WPARAM, LPARAM)
{
if (message == WM_INITDIALOG)
{
// special case for WM_INITDIALOG
CDialog* pDlg = DYNAMIC_DOWNCAST(CDialog, CWnd::FromHandlePermanent(hWnd));
if (pDlg != NULL)
return pDlg->OnInitDialog();
else
return 1;
}
return 0;
}

/////////////////////////////////////////////////////////////////////////////
// CDialog - Modeless and Modal

BEGIN_MESSAGE_MAP(CDialog, CWnd)
#ifndef _AFX_NO_GRAYDLG_SUPPORT
ON_WM_CTLCOLOR()
#endif
//{{AFX_MSG_MAP(CDialog)
////ON_COMMAND(IDOK, OnOK)
//ON_COMMAND(IDCANCEL, OnCancel)
//ON_MESSAGE(WM_COMMANDHELP, OnCommandHelp)
//ON_MESSAGE(WM_HELPHITTEST, OnHelpHitTest)
ON_MESSAGE(WM_INITDIALOG, HandleInitDialog)
ON_MESSAGE(WM_SETFONT, HandleSetFont)
//}}AFX_MSG_MAP
#ifndef _AFX_NO_CTL3D_SUPPORT
// ON_MESSAGE(WM_QUERY3DCONTROLS, OnQuery3dControls)
#endif
END_MESSAGE_MAP()

BOOL CDialog::PreTranslateMessage(MSG* pMsg)
{
// for modeless processing (or modal)
ASSERT(m_hWnd != NULL);

// allow tooltip messages to be filtered
if (CWnd::PreTranslateMessage(pMsg))
return TRUE;

// don't translate dialog messages when in Shift+F1 help mode
CFrameWnd* pFrameWnd = GetTopLevelFrame();
if (pFrameWnd != NULL && pFrameWnd->m_bHelpMode)
return FALSE;

// fix around for VK_ESCAPE in a multiline Edit that is on a Dialog
// that doesn't have a cancel or the cancel is disabled.
if (pMsg->message == WM_KEYDOWN &&
(pMsg->wParam == VK_ESCAPE || pMsg->wParam == VK_CANCEL) &&
(::GetWindowLong(pMsg->hwnd, GWL_STYLE) & ES_MULTILINE) &&
_AfxCompareClassName(pMsg->hwnd, _T("Edit")))
{
HWND hItem = ::GetDlgItem(m_hWnd, IDCANCEL);
if (hItem == NULL || ::IsWindowEnabled(hItem))
{
SendMessage(WM_COMMAND, IDCANCEL, 0);
return TRUE;
}
}
// filter both messages to dialog and from children
return PreTranslateInput(pMsg);
}

BOOL CDialog::OnCmdMsg(UINT nID, int nCode, void* pExtra,
AFX_CMDHANDLERINFO* pHandlerInfo)
{
if (CWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
return TRUE;

if ((nCode != CN_COMMAND && nCode != CN_UPDATE_COMMAND_UI) ||
!IS_COMMAND_ID(nID) || nID >= 0xf000)
{
// control notification or non-command button or system command
return FALSE; // not routed any further
}

// if we have an owner window, give it second crack
CWnd* pOwner = GetParent();
if (pOwner != NULL)
{
#ifdef _DEBUG
if (afxTraceFlags & traceCmdRouting)
TRACE1("Routing command id 0x%04X to owner window.\n", nID);
#endif
ASSERT(pOwner != this);
if (pOwner->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
return TRUE;
}

// last crack goes to the current CWinThread object
CWinThread* pThread = AfxGetThread();
if (pThread != NULL)
{
#ifdef _DEBUG
if (afxTraceFlags & traceCmdRouting)
TRACE1("Routing command id 0x%04X to app.\n", nID);
#endif
if (pThread->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
return TRUE;
}

#ifdef _DEBUG
if (afxTraceFlags & traceCmdRouting)
{
TRACE2("IGNORING command id 0x%04X sent to %hs dialog.\n", nID,
GetRuntimeClass()->m_lpszClassName);
}
#endif
return FALSE;
}

/////////////////////////////////////////////////////////////////////////////
// Modeless Dialogs have 2-phase construction

CDialog::CDialog()
{
ASSERT(m_hWnd == NULL);
AFX_ZERO_INIT_OBJECT(CWnd);
}

CDialog::~CDialog()
{
if (m_hWnd != NULL)
{
TRACE0("Warning: calling DestroyWindow in CDialog::~CDialog --\n");
TRACE0("\tOnDestroy or PostNcDestroy in derived class will not be called.\n");
DestroyWindow();
}
}

BOOL CDialog::Create(LPCTSTR lpszTemplateName, CWnd* pParentWnd)
{
ASSERT(HIWORD(lpszTemplateName) == 0 ||
AfxIsValidString(lpszTemplateName));

m_lpszTemplateName = lpszTemplateName; // used for help
if (HIWORD(m_lpszTemplateName) == 0 && m_nIDHelp == 0)
m_nIDHelp = LOWORD((DWORD)m_lpszTemplateName);

#ifdef _DEBUG
if (!_AfxCheckDialogTemplate(lpszTemplateName, FALSE))
{
ASSERT(FALSE); // invalid dialog template name
PostNcDestroy(); // cleanup if Create fails too soon
return FALSE;
}
#endif //_DEBUG

HINSTANCE hInst = AfxFindResourceHandle(lpszTemplateName, RT_DIALOG);
HRSRC hResource = ::FindResource(hInst, lpszTemplateName, RT_DIALOG);
HGLOBAL hTemplate = LoadResource(hInst, hResource);
BOOL bResult = CreateIndirect(hTemplate, pParentWnd, hInst);
FreeResource(hTemplate);

return bResult;
}

// for backward compatibility
BOOL CDialog::CreateIndirect(HGLOBAL hDialogTemplate, CWnd* pParentWnd)
{
return CreateIndirect(hDialogTemplate, pParentWnd, NULL);
}

BOOL CDialog::CreateIndirect(HGLOBAL hDialogTemplate, CWnd* pParentWnd,
HINSTANCE hInst)
{
ASSERT(hDialogTemplate != NULL);

LPCDLGTEMPLATE lpDialogTemplate = (LPCDLGTEMPLATE)LockResource(hDialogTemplate);
BOOL bResult = CreateIndirect(lpDialogTemplate, pParentWnd, NULL, hInst);
UnlockResource(hDialogTemplate);

return bResult;
}

// for backward compatibility
BOOL CDialog::CreateIndirect(LPCDLGTEMPLATE lpDialogTemplate, CWnd* pParentWnd,
void* lpDialogInit)
{
return CreateIndirect(lpDialogTemplate, pParentWnd, lpDialogInit, NULL);
}

BOOL CDialog::CreateIndirect(LPCDLGTEMPLATE lpDialogTemplate, CWnd* pParentWnd,
void* lpDialogInit, HINSTANCE hInst)
{
ASSERT(lpDialogTemplate != NULL);

if (pParentWnd == NULL)
pParentWnd = AfxGetMainWnd();
m_lpDialogInit = lpDialogInit;

return CreateDlgIndirect(lpDialogTemplate, pParentWnd, hInst);
}

BOOL CWnd::CreateDlg(LPCTSTR lpszTemplateName, CWnd* pParentWnd)
{
// load resource
LPCDLGTEMPLATE lpDialogTemplate = NULL;
HGLOBAL hDialogTemplate = NULL;
HINSTANCE hInst = AfxFindResourceHandle(lpszTemplateName, RT_DIALOG);
HRSRC hResource = ::FindResource(hInst, lpszTemplateName, RT_DIALOG);
hDialogTemplate = LoadResource(hInst, hResource);
if (hDialogTemplate != NULL)
lpDialogTemplate = (LPCDLGTEMPLATE)LockResource(hDialogTemplate);
ASSERT(lpDialogTemplate != NULL);

// create a modeless dialog
BOOL bSuccess = CreateDlgIndirect(lpDialogTemplate, pParentWnd, hInst);

// free resource
UnlockResource(hDialogTemplate);
FreeResource(hDialogTemplate);

return bSuccess;
}

// for backward compatibility
BOOL CWnd::CreateDlgIndirect(LPCDLGTEMPLATE lpDialogTemplate, CWnd* pParentWnd)
{
return CreateDlgIndirect(lpDialogTemplate, pParentWnd, NULL);
}

BOOL CWnd::CreateDlgIndirect(LPCDLGTEMPLATE lpDialogTemplate,
CWnd* pParentWnd, HINSTANCE hInst)
{
ASSERT(lpDialogTemplate != NULL);
if (pParentWnd != NULL)
ASSERT_VALID(pParentWnd);

if (hInst == NULL)
hInst = AfxGetInstanceHandle();

#ifndef _AFX_NO_OCC_SUPPORT
_AFX_OCC_DIALOG_INFO occDialogInfo;
COccManager* pOccManager = afxOccManager;
#endif

HGLOBAL hTemplate = NULL;

HWND hWnd = NULL;
#ifdef _DEBUG
DWORD dwError = 0;
#endif

TRY
{
VERIFY(AfxDeferRegisterClass(AFX_WNDCOMMCTLS_REG));
AfxDeferRegisterClass(AFX_WNDCOMMCTLSNEW_REG);

#ifndef _AFX_NO_OCC_SUPPORT
// separately create OLE controls in the dialog template
if (pOccManager != NULL)
{
if (!SetOccDialogInfo(&occDialogInfo))
return FALSE;

lpDialogTemplate = pOccManager->PreCreateDialog(&occDialogInfo,
lpDialogTemplate);
}

if (lpDialogTemplate == NULL)
return FALSE;
#endif //!_AFX_NO_OCC_SUPPORT

// If no font specified, set the system font.
CString strFace;
WORD wSize = 0;
BOOL bSetSysFont = !CDialogTemplate::GetFont(lpDialogTemplate, strFace,
wSize);

// On DBCS systems, also change "MS Sans Serif" or "Helv" to system font.
if ((!bSetSysFont) && GetSystemMetrics(SM_DBCSENABLED))
{
bSetSysFont = (strFace == _T("MS Shell Dlg") ||
strFace == _T("MS Sans Serif") || strFace == _T("Helv"));
if (bSetSysFont && (wSize == 8))
wSize = 0;
}

if (bSetSysFont)
{
CDialogTemplate dlgTemp(lpDialogTemplate);
dlgTemp.SetSystemFont(wSize);
hTemplate = dlgTemp.Detach();
}

if (hTemplate != NULL)
lpDialogTemplate = (DLGTEMPLATE*)GlobalLock(hTemplate);

// setup for modal loop and creation
m_nModalResult = -1;
m_nFlags |= WF_CONTINUEMODAL;

// create modeless dialog
AfxHookWindowCreate(this);
hWnd = ::CreateDialogIndirect(hInst, lpDialogTemplate,
pParentWnd->GetSafeHwnd(), AfxDlgProc);
#ifdef _DEBUG
dwError = ::GetLastError();
#endif
}
CATCH_ALL(e)
{
DELETE_EXCEPTION(e);
m_nModalResult = -1;
}
END_CATCH_ALL

#ifndef _AFX_NO_OCC_SUPPORT
if (pOccManager != NULL)
{
pOccManager->PostCreateDialog(&occDialogInfo);
if (hWnd != NULL)
SetOccDialogInfo(NULL);
}
#endif //!_AFX_NO_OCC_SUPPORT

if (!AfxUnhookWindowCreate())
PostNcDestroy(); // cleanup if Create fails too soon

// handle EndDialog calls during OnInitDialog
if (hWnd != NULL && !(m_nFlags & WF_CONTINUEMODAL))
{
::DestroyWindow(hWnd);
hWnd = NULL;
}

if (hTemplate != NULL)
{
GlobalUnlock(hTemplate);
GlobalFree(hTemplate);
}

// help with error diagnosis (only if WM_INITDIALOG didn't EndDialog())
if (hWnd == NULL && (m_nFlags & WF_CONTINUEMODAL))
{
#ifdef _DEBUG
#ifndef _AFX_NO_OCC_SUPPORT
if (afxOccManager == NULL)
{
TRACE0(">>> If this dialog has OLE controls:\n");
TRACE0(">>> AfxEnableControlContainer has not been called yet.\n");
TRACE0(">>> You should call it in your app's InitInstance function.\n");
}
else if (dwError != 0)
{
TRACE1("Warning: Dialog creation failed! GetLastError returns 0x%8.8X\n", dwError);
}
#endif //!_AFX_NO_OCC_SUPPORT
#endif //_DEBUG
return FALSE;
}

ASSERT(hWnd == m_hWnd);
return TRUE;
}

#ifndef _AFX_NO_OCC_SUPPORT

BOOL CDialog::SetOccDialogInfo(_AFX_OCC_DIALOG_INFO* pOccDialogInfo)
{
m_pOccDialogInfo = pOccDialogInfo;
return TRUE;
}

#endif

/////////////////////////////////////////////////////////////////////////////
// Modal Dialogs

// Modal Constructors just save parameters
CDialog::CDialog(LPCTSTR lpszTemplateName, CWnd* pParentWnd)
{
ASSERT(HIWORD(lpszTemplateName) == 0 ||
AfxIsValidString(lpszTemplateName));

AFX_ZERO_INIT_OBJECT(CWnd);

m_pParentWnd = pParentWnd;
m_lpszTemplateName = lpszTemplateName;
if (HIWORD(m_lpszTemplateName) == 0)
m_nIDHelp = LOWORD((DWORD)m_lpszTemplateName);
}

CDialog::CDialog(UINT nIDTemplate, CWnd* pParentWnd)
{
AFX_ZERO_INIT_OBJECT(CWnd);

m_pParentWnd = pParentWnd;
m_lpszTemplateName = MAKEINTRESOURCE(nIDTemplate);
m_nIDHelp = nIDTemplate;
}

BOOL CDialog::InitModalIndirect(HGLOBAL hDialogTemplate, CWnd* pParentWnd)
{
// must be called on an empty constructed CDialog
ASSERT(m_lpszTemplateName == NULL);
ASSERT(m_hDialogTemplate == NULL);
ASSERT(hDialogTemplate != NULL);

if (m_pParentWnd == NULL)
m_pParentWnd = pParentWnd;

m_hDialogTemplate = hDialogTemplate;

return TRUE; // always ok (DoModal actually brings up dialog)
}

BOOL CDialog::InitModalIndirect(LPCDLGTEMPLATE lpDialogTemplate, CWnd* pParentWnd,
void* lpDialogInit)
{
// must be called on an empty constructed CDialog
ASSERT(m_lpszTemplateName == NULL);
ASSERT(m_lpDialogTemplate == NULL);
ASSERT(lpDialogTemplate != NULL);

if (m_pParentWnd == NULL)
m_pParentWnd = pParentWnd;

m_lpDialogTemplate = lpDialogTemplate;
m_lpDialogInit = lpDialogInit;

return TRUE; // always ok (DoModal actually brings up dialog)
}

HWND CDialog::PreModal()
{
// cannot call DoModal on a dialog already constructed as modeless
ASSERT(m_hWnd == NULL);

// allow OLE servers to disable themselves
CWinApp* pApp = AfxGetApp();
if (pApp != NULL)
pApp->EnableModeless(FALSE);

// find parent HWND
HWND hWnd = CWnd::GetSafeOwner_(m_pParentWnd->GetSafeHwnd(), &m_hWndTop);

// hook for creation of dialog
AfxHookWindowCreate(this);

// return window to use as parent for dialog
return hWnd;
}

void CDialog::PostModal()
{
AfxUnhookWindowCreate(); // just in case
Detach(); // just in case

// re-enable windows
if (::IsWindow(m_hWndTop))
::EnableWindow(m_hWndTop, TRUE);
m_hWndTop = NULL;
CWinApp* pApp = AfxGetApp();
if (pApp != NULL)
pApp->EnableModeless(TRUE);
}

int CDialog::DoModal()
{
// can be constructed with a resource template or InitModalIndirect
ASSERT(m_lpszTemplateName != NULL || m_hDialogTemplate != NULL ||
m_lpDialogTemplate != NULL);

// load resource as necessary
LPCDLGTEMPLATE lpDialogTemplate = m_lpDialogTemplate;
HGLOBAL hDialogTemplate = m_hDialogTemplate;
HINSTANCE hInst = AfxGetResourceHandle();
if (m_lpszTemplateName != NULL)
{
hInst = AfxFindResourceHandle(m_lpszTemplateName, RT_DIALOG);
HRSRC hResource = ::FindResource(hInst, m_lpszTemplateName, RT_DIALOG);
hDialogTemplate = LoadResource(hInst, hResource);
}
if (hDialogTemplate != NULL)
lpDialogTemplate = (LPCDLGTEMPLATE)LockResource(hDialogTemplate);

// return -1 in case of failure to load the dialog template resource
if (lpDialogTemplate == NULL)
return -1;

// disable parent (before creating dialog)
HWND hWndParent = PreModal();
AfxUnhookWindowCreate();
BOOL bEnableParent = FALSE;
if (hWndParent != NULL && ::IsWindowEnabled(hWndParent))
{
::EnableWindow(hWndParent, FALSE);
bEnableParent = TRUE;
}

TRY
{
// create modeless dialog
AfxHookWindowCreate(this);
if (CreateDlgIndirect(lpDialogTemplate,
CWnd::FromHandle(hWndParent), hInst))
{
if (m_nFlags & WF_CONTINUEMODAL)
{
// enter modal loop
DWORD dwFlags = MLF_SHOWONIDLE;
if (GetStyle() & DS_NOIDLEMSG)
dwFlags |= MLF_NOIDLEMSG;
VERIFY(RunModalLoop(dwFlags) == m_nModalResult);
}

// hide the window before enabling the parent, etc.
if (m_hWnd != NULL)
SetWindowPos(NULL, 0, 0, 0, 0, SWP_HIDEWINDOW|
SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOZORDER);
}
}
CATCH_ALL(e)
{
DELETE_EXCEPTION(e);
m_nModalResult = -1;
}
END_CATCH_ALL

if (bEnableParent)
::EnableWindow(hWndParent, TRUE);
if (hWndParent != NULL && ::GetActiveWindow() == m_hWnd)
::SetActiveWindow(hWndParent);

// destroy modal window
DestroyWindow();
PostModal();

// unlock/free resources as necessary
if (m_lpszTemplateName != NULL || m_hDialogTemplate != NULL)
UnlockResource(hDialogTemplate);
if (m_lpszTemplateName != NULL)
FreeResource(hDialogTemplate);

return m_nModalResult;
}

void CDialog::EndDialog(int nResult)
{
ASSERT(::IsWindow(m_hWnd));

if (m_nFlags & (WF_MODALLOOP|WF_CONTINUEMODAL))
EndModalLoop(nResult);

::EndDialog(m_hWnd, nResult);
}

/////////////////////////////////////////////////////////////////////////////
// Standard CDialog implementation

LRESULT CDialog::HandleSetFont(WPARAM wParam, LPARAM)
{
OnSetFont(CFont::FromHandle((HFONT)wParam));
return Default();
}

void CDialog::PreInitDialog()
{
// ignore it
}

LRESULT CDialog::HandleInitDialog(WPARAM, LPARAM)
{
PreInitDialog();

#ifndef _AFX_NO_OCC_SUPPORT
// create OLE controls
COccManager* pOccManager = afxOccManager;
if ((pOccManager != NULL) && (m_pOccDialogInfo != NULL))
{
BOOL bDlgInit;
if (m_lpDialogInit != NULL)
bDlgInit = pOccManager->CreateDlgControls(this, m_lpDialogInit,
m_pOccDialogInfo);
else
bDlgInit = pOccManager->CreateDlgControls(this, m_lpszTemplateName,
m_pOccDialogInfo);

if (!bDlgInit)
{
TRACE0("Warning: CreateDlgControls failed during dialog init.\n");
EndDialog(-1);
return FALSE;
}
}
#endif

// Default will call the dialog proc, and thus OnInitDialog
BOOL bResult = Default();

#ifndef _AFX_NO_OCC_SUPPORT
if (bResult && (m_nFlags & WF_OLECTLCONTAINER))
{
CWnd* pWndNext = GetNextDlgTabItem(NULL);
if (pWndNext != NULL)
{
pWndNext->SetFocus(); // UI Activate OLE control
bResult = FALSE;
}
}
#endif

return bResult;
}

BOOL AFXAPI AfxHelpEnabled()
{
if (AfxGetApp() == NULL)
return FALSE;

// help is enabled if the app has a handler for ID_HELP
AFX_CMDHANDLERINFO info;

// check main window first
CWnd* pWnd = AfxGetMainWnd();
if (pWnd != NULL && pWnd->OnCmdMsg(ID_HELP, CN_COMMAND, NULL, &info))
return TRUE;

// check app last
return AfxGetApp()->OnCmdMsg(ID_HELP, CN_COMMAND, NULL, &info);
}

void CDialog::OnSetFont(CFont*)
{
// ignore it
}

BOOL CDialog::OnInitDialog()
{
// execute dialog RT_DLGINIT resource
BOOL bDlgInit;
if (m_lpDialogInit != NULL)
bDlgInit = ExecuteDlgInit(m_lpDialogInit);
else
bDlgInit = ExecuteDlgInit(m_lpszTemplateName);

if (!bDlgInit)
{
TRACE0("Warning: ExecuteDlgInit failed during dialog init.\n");
EndDialog(-1);
return FALSE;
}

// transfer data into the dialog from member variables
if (!UpdateData(FALSE))
{
TRACE0("Warning: UpdateData failed during dialog init.\n");
EndDialog(-1);
return FALSE;
}

// enable/disable help button automatically
CWnd* pHelpButton = GetDlgItem(ID_HELP);
if (pHelpButton != NULL)
pHelpButton->ShowWindow(AfxHelpEnabled() ? SW_SHOW : SW_HIDE);

return TRUE; // set focus to first one
}

void CDialog::OnOK()
{
if (!UpdateData(TRUE))
{
TRACE0("UpdateData failed during dialog termination.\n");
// the UpdateData routine will set focus to correct item
return;
}
EndDialog(IDOK);
}

void CDialog::OnCancel()
{
EndDialog(IDCANCEL);
}

BOOL CDialog::CheckAutoCenter()
{
// load resource as necessary
LPCDLGTEMPLATE lpDialogTemplate = m_lpDialogTemplate;
HGLOBAL hDialogTemplate = m_hDialogTemplate;
if (m_lpszTemplateName != NULL)
{
HINSTANCE hInst = AfxFindResourceHandle(m_lpszTemplateName, RT_DIALOG);
HRSRC hResource = ::FindResource(hInst, m_lpszTemplateName, RT_DIALOG);
hDialogTemplate = LoadResource(hInst, hResource);
}
if (hDialogTemplate != NULL)
lpDialogTemplate = (LPCDLGTEMPLATE)LockResource(hDialogTemplate);

// determine if dialog should be centered
BOOL bResult = TRUE;

if (lpDialogTemplate != NULL)
{
DWORD dwStyle = lpDialogTemplate->style;
short x;
short y;

if (((DLGTEMPLATEEX*)lpDialogTemplate)->signature == 0xFFFF)
{
// it's a DIALOGEX resource
dwStyle = ((DLGTEMPLATEEX*)lpDialogTemplate)->style;
x = ((DLGTEMPLATEEX*)lpDialogTemplate)->x;
y = ((DLGTEMPLATEEX*)lpDialogTemplate)->y;
}
else
{
// it's a DIALOG resource
x = lpDialogTemplate->x;
y = lpDialogTemplate->y;
}

bResult = !(dwStyle & (DS_CENTER|DS_CENTERMOUSE|DS_ABSALIGN)) &&
x == 0 && y == 0;
}

// unlock/free resources as necessary
if (m_lpszTemplateName != NULL || m_hDialogTemplate != NULL)
UnlockResource(hDialogTemplate);
if (m_lpszTemplateName != NULL)
FreeResource(hDialogTemplate);

return bResult; // TRUE if auto-center is ok
}

/////////////////////////////////////////////////////////////////////////////
// Gray background support

#ifndef _AFX_NO_GRAYDLG_SUPPORT
HBRUSH CDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
// use helper in CWnd
return OnGrayCtlColor(pDC, pWnd, nCtlColor);
}
#endif //!_AFX_NO_GRAYDLG_SUPPORT

/////////////////////////////////////////////////////////////////////////////
// CDialog support for context sensitive help.

LRESULT CDialog::OnCommandHelp(WPARAM, LPARAM lParam)
{
if (lParam == 0 && m_nIDHelp != 0)
lParam = HID_BASE_RESOURCE + m_nIDHelp;
if (lParam != 0)
{
CWinApp* pApp = AfxGetApp();
if (pApp != NULL)
pApp->WinHelp(lParam);
return TRUE;
}
return FALSE;
}

LRESULT CDialog::OnHelpHitTest(WPARAM, LPARAM)
{
if (m_nIDHelp != 0)
return HID_BASE_RESOURCE + m_nIDHelp;
return 0;
}

/////////////////////////////////////////////////////////////////////////////
// CDialog Diagnostics

#ifdef _DEBUG
void CDialog::AssertValid() const
{
CWnd::AssertValid();
}

void CDialog::Dump(CDumpContext& dc) const
{
CWnd::Dump(dc);

dc << "m_lpszTemplateName = ";
if (HIWORD(m_lpszTemplateName) == 0)
dc << (int)LOWORD((DWORD)m_lpszTemplateName);
else
dc << m_lpszTemplateName;

dc << "\nm_hDialogTemplate = " << (UINT)m_hDialogTemplate;
dc << "\nm_lpDialogTemplate = " << (UINT)m_lpDialogTemplate;
dc << "\nm_pParentWnd = " << (void*)m_pParentWnd;
dc << "\nm_nIDHelp = " << m_nIDHelp;

dc << "\n";
}

// diagnostic routine to check for and decode dialog templates
// return FALSE if a program error occurs (i.e. bad resource ID or
// bad dialog styles).
BOOL AFXAPI _AfxCheckDialogTemplate(LPCTSTR lpszResource, BOOL bInvisibleChild)
{
ASSERT(lpszResource != NULL);
HINSTANCE hInst = AfxFindResourceHandle(lpszResource, RT_DIALOG);
HRSRC hResource = ::FindResource(hInst, lpszResource, RT_DIALOG);
if (hResource == NULL)
{
if (HIWORD(lpszResource) != 0)
TRACE1("ERROR: Cannot find dialog template named '%s'.\n",
lpszResource);
else
TRACE1("ERROR: Cannot find dialog template with IDD 0x%04X.\n",
LOWORD((DWORD)lpszResource));
return FALSE;
}

if (!bInvisibleChild)
return TRUE; // that's all we need to check

// we must check that the dialog template is for an invisible child
// window that can be used for a form-view or dialog-bar
HGLOBAL hTemplate = LoadResource(hInst, hResource);
if (hTemplate == NULL)
{
TRACE0("Warning: LoadResource failed for dialog template.\n");
// this is only a warning, the real call to CreateDialog will fail
return TRUE; // not a program error - just out of memory
}
DLGTEMPLATEEX* pTemplate = (DLGTEMPLATEEX*)LockResource(hTemplate);
DWORD dwStyle;
if (pTemplate->signature == 0xFFFF)
dwStyle = pTemplate->style;
else
dwStyle = ((DLGTEMPLATE*)pTemplate)->style;
UnlockResource(hTemplate);
FreeResource(hTemplate);

if (dwStyle & WS_VISIBLE)
{
if (HIWORD(lpszResource) != 0)
TRACE1("ERROR: Dialog named '%s' must be invisible.\n",
lpszResource);
else
TRACE1("ERROR: Dialog with IDD 0x%04X must be invisible.\n",
LOWORD((DWORD)lpszResource));
return FALSE;
}
if (!(dwStyle & WS_CHILD))
{
if (HIWORD(lpszResource) != 0)
TRACE1("ERROR: Dialog named '%s' must have the child style.\n",
lpszResource);
else
TRACE1("ERROR: Dialog with IDD 0x%04X must have the child style.\n",
LOWORD((DWORD)lpszResource));
return FALSE;
}

return TRUE;
}

#endif //_DEBUG

#ifdef AFX_INIT_SEG
#pragma code_seg(AFX_INIT_SEG)
#endif

IMPLEMENT_DYNAMIC(CDialog, CWnd)

/////////////////////////////////////////////////////////////////////////////


merci d'avance
0
mamiemando Messages postés 34243 Date d'inscription   Statut Modérateur Dernière intervention   7 898
 
Ton erreur est ici :
ASSERT(AfxGetApp() == this);

Cela signifie que ton objet CWinApp (this dans ce contexte) auquel tu appliques AfxGetApp() ne retourne pas this. C'est probablement parce que tu as mal initialisé cet objet.

Bonne chance
-1
olfa7183
 
bonjour,
je suis debutante en c++ vous pouvez me dire exactement comment je corrige cet erreur.
je ne sais pas quoi faire exactement?
merci d'avance
0
mamiemando Messages postés 34243 Date d'inscription   Statut Modérateur Dernière intervention   7 898
 
Aucune idée sincèrement. Il faudrait voir le code de la classe CWinApp et comment tu l'as créée. Vu le nom c'est une classe MFC (microsoft fundation class) et moi je suis sous linux, donc je n'ai pas ce genre de headers.

https://www.codeproject.com/script/Forums/View.aspx?fid=1647&msg=1611813

Re: How does AfxGetApp() work? member PJ Arends 17:39 4 Aug '06

AfxWin1.inl:

_AFXWIN_INLINE CWinApp* AFXAPI AfxGetApp()
	{ return afxCurrentWinApp; }


AfxWin.h:

#define afxCurrentWinApp    AfxGetModuleState()->m_pCurrentWinApp


AfxGetModuleState() returns a pointer to a MFC internal state structure.

AppCore.cpp:

CWinApp::CWinApp(LPCTSTR lpszAppName)
{
...
	// initialize CWinApp state
	ASSERT(afxCurrentWinApp == NULL); // only one CWinApp object please
	pModuleState->m_pCurrentWinApp = this;
	ASSERT(AfxGetApp() == this);

...
}

So basicly the AfxGetApp() pointer is setup in the CWinApp constructor. If you really want to know the internals of MFC then thge best place to look is in the MFC source files. Using the visual studio debugger to step through the sources is the best way.

Comme je te disais tu as dû te planter quelque part au moment d'appeler le constructeur de CWinApp.

Bonne chance
-1
olfa7183 Messages postés 19 Statut Membre
 
bonjour,
j'ai un probleme d'assertion
lors de l'excution j'obtient ça:
debug assertion failed
file: dlgcore.cpp
line: 494

quand je clic sue recommancer le curseur jaune a la ligne d'ou vient l'erreur
ASSERT(m_lpszTemplateName != NULL || m_hDialogTemplate != NULL ||
m_lpDialogTemplate != NULL);line 494
je n'est pas pu le corriger
svp vous pouvez m'aider je suis débutante en c++
merci d'avance
-1
mamiemando Messages postés 34243 Date d'inscription   Statut Modérateur Dernière intervention   7 898
 
Peu importe l'assertion c'est toujours la même démarche. Il faut que tu regardes le test à la ligne correspondante et pourquoi il est vrai.
-1
olfa7183
 
merci pour la reponse mais tu peux m'expliquer comme je te dis je suis debutante en c++
0
mamiemando Messages postés 34243 Date d'inscription   Statut Modérateur Dernière intervention   7 898
 
Ben là ton test c'est :
m_lpszTemplateName != NULL || m_hDialogTemplate != NULL || m_lpDialogTemplate != NULL

Ce test est actuellement faux, ce qui déclenche l'assertion.

Ca signifie qu'au moins un de ces trois pointeurs est nul, alors qu'ils devraient tous être initialisés. À présent il faut voir dans ton code à quoi correspondent c'est variable, mais c'est probablement un objet que tu as mal initialisé au moment de le construire.

Bonne chance
-1
olfa7183 Messages postés 19 Statut Membre
 
salut,
j'ai met mon programme en mode release j'obtient le message erreur suivant:
Configuration: Monnayeur - Win32 Release--------------------
Linking...
LINK : fatal error LNK1181: cannot open input file "32.lib"
Error executing link.exe.

Monnayeur.exe - 1 error(s), 0 warning(s)
The following environment variables were not found
$(QTDIR)

qu'est ce que je dois faire exactement
merci d'avance
-1
mamiemando Messages postés 34243 Date d'inscription   Statut Modérateur Dernière intervention   7 898
 
Aucune idée. Tu serais sous linux (oui désolée je n'ai pas windows) je pourrais t'aider mais là c'est un code 100% windowsien et partiel, comment veux-tu que je puisse le compiler ou t'aider ?

Là seule chose que je peux faire c'est te dire ce que signifie l'erreur et ce que le compilateur attend, mais là je ne peux pas te détailler la manière dont le résoudre plus précisément.

LINK : fatal error LNK1181: cannot open input file "32.lib"
Error executing link.exe.


=> ça signifie que ton programme utilise une librairie (32.lib, bizarre comme nom) et qu'il ne la trouve pas. Vérifie où se situe ce fichier sur ton PC.

Monnayeur.exe - 1 error(s), 0 warning(s)
The following environment variables were not found
$(QTDIR)


Ceci signifie que la variable d'environnement QTDIR (qui dit probablement ou est installé QT) n'est pas initialisé, ce qui va lui poser quelques difficultés pour trouver ses petits. Si ça se trouve ton erreur provient du fait que cette variable n'est pas configurée. Une piste :
https://www.developpez.net/forums/d229146/c-cpp/outils-c-cpp/code-blocks/creation-d-projet-qt/

Bonne chance
-1
olfa7183 Messages postés 19 Statut Membre
 
bonjour;
maintenant tout est bien mais il me reste un petit problème c'est que je ne sais pas comment faire la liaison ente l'interface que j'ai fait et ma machine( cable USB)
vous pouvez me donner un code qui permet de faire la liaison et svp spécifie ou je dois le met
merci d'avance
-1
mamiemando Messages postés 34243 Date d'inscription   Statut Modérateur Dernière intervention   7 898
 
Ouvre un nouveau sujet dans le forum programmation en expliquant plus clairement à quelle autre application ton programme doit se connecter. A priori ça consiste juste à ouvrir une socket et écrire dedans pour faire communiquer les deux programmes. A noter que des outils comme corba existent pour faire communiquer "simplement" deux applications distantes.

Bonne chance
-1
mamiemando Messages postés 34243 Date d'inscription   Statut Modérateur Dernière intervention   7 898
 
En gros il trouve la déclaration des méthodes de BillValidator (notamment Poll, Reset, GetBillStatus...) mais pas leur implémentation. Ceci signifie que si cet objet est implémenté dans un .o tu oublies de le passer en paramètre à ton compilateur, et s'il est dans une librairie, tu oublies de linker l'exécutable final avec ladite librairie.

Je penche pour la seconde explication.

Bonne chance
-2
olfa7183 Messages postés 19 Statut Membre
 
merci pour la réponse mais s'il vous plait vous pouvez m'exliquer encore
merci
-1