Click here to Skip to main content
15,917,702 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionMaking text go to Ms Word file? Pin
DanYELL20-Oct-03 14:51
DanYELL20-Oct-03 14:51 
AnswerRe: Making text go to Ms Word file? Pin
Michael Dunn20-Oct-03 19:46
sitebuilderMichael Dunn20-Oct-03 19:46 
AnswerRe: Making text go to Ms Word file? Pin
Anonymous20-Oct-03 22:16
Anonymous20-Oct-03 22:16 
GeneralMemory allocations slow when launched from the debugger Pin
Wasteland720-Oct-03 14:50
Wasteland720-Oct-03 14:50 
GeneralHelp with Dialog in Doc/View Application Pin
jasonmgeorge20-Oct-03 12:54
jasonmgeorge20-Oct-03 12:54 
GeneralRe: Help with Dialog in Doc/View Application Pin
Anthony_Yio20-Oct-03 15:27
Anthony_Yio20-Oct-03 15:27 
GeneralRe: Help with Dialog in Doc/View Application Pin
Atif Mushtaq21-Oct-03 23:54
Atif Mushtaq21-Oct-03 23:54 
GeneralRegular Dll with dialog box Pin
ahmadnoori20-Oct-03 11:05
ahmadnoori20-Oct-03 11:05 
Hello,

I created a Regular Dll that should display a Dialog Box so that the user can enter some information. But when i call my dll using a regular c application nothing gets display to the user. I am kinda lost. I started by creating a regular dll with the option of using MFC libs using vc++ 6.0. I exported a function which calls my Dialog box class:

extern "C" __declspec(dllexport) long CallDlg()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CmcDlg dlg;
dlg.DoModal();

DWORD dw = GetLastError();
printf("failed: GetLastError returned %u\n", dw);
return 0;
}

The dlg.DoModal() function does not start anything. Here is how my dialog class:
// mcDlg.cpp : implementation file
//

#include "stdafx.h"
#include "MFCdll.h"
#include "mcDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CmcDlg dialog


CmcDlg::CmcDlg(CWnd* pParent /*=NULL*/)
: CDialog(CmcDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CmcDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}


void CmcDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CmcDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CmcDlg, CDialog)
//{{AFX_MSG_MAP(CmcDlg)
ON_BN_CLICKED(IDC_Add, OnAdd)
ON_BN_CLICKED(IDC_Multiply, OnMultiply)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CmcDlg message handlers

void CmcDlg::OnAdd()
{
// TODO: Add your control notification handler code here
int iVar1 = GetDlgItemInt( IDC_EDIT1 );
int iVar2 = GetDlgItemInt( IDC_EDIT2 );
int iRes = iVar1 + iVar2 ;
SetDlgItemInt( IDC_EDIT3, iRes, TRUE );
UpdateData(FALSE);

}

void CmcDlg::OnMultiply()
{
// TODO: Add your control notification handler code here
int iVar1 = GetDlgItemInt( IDC_EDIT1 );
int iVar2 = GetDlgItemInt( IDC_EDIT2 );
int iRes = iVar1 * iVar2 ;
SetDlgItemInt( IDC_EDIT3, iRes, TRUE );
UpdateData(FALSE);
}

void CmcDlg::OnOK()
{
// TODO: Add extra validation here

CDialog::OnOK();
}

void CmcDlg::OnCancel()
{
// TODO: Add extra cleanup here

CDialog::OnCancel();
}

Anybody knows why? Thanks in advance for you help.


GeneralRe: Regular Dll with dialog box Pin
igor196020-Oct-03 11:38
igor196020-Oct-03 11:38 
GeneralRe: Regular Dll with dialog box Pin
ahmadnoori20-Oct-03 13:15
ahmadnoori20-Oct-03 13:15 
QuestionCreateFile and LockFile in atomic operation? Pin
Joe Woodbury20-Oct-03 10:44
professionalJoe Woodbury20-Oct-03 10:44 
AnswerRe: CreateFile and LockFile in atomic operation? Pin
John M. Drescher20-Oct-03 11:05
John M. Drescher20-Oct-03 11:05 
AnswerRe: CreateFile and LockFile in atomic operation? Pin
Neville Franks21-Oct-03 10:12
Neville Franks21-Oct-03 10:12 
GeneralRe: CreateFile and LockFile in atomic operation? Pin
Joe Woodbury21-Oct-03 10:57
professionalJoe Woodbury21-Oct-03 10:57 
GeneralRe: CreateFile and LockFile in atomic operation? Pin
Neville Franks21-Oct-03 11:08
Neville Franks21-Oct-03 11:08 
GeneralRe: CreateFile and LockFile in atomic operation? Pin
Joe Woodbury21-Oct-03 13:18
professionalJoe Woodbury21-Oct-03 13:18 
GeneralGet Pin
Anonymous20-Oct-03 9:16
Anonymous20-Oct-03 9:16 
GeneralRe: Get Pin
Joe Woodbury20-Oct-03 9:42
professionalJoe Woodbury20-Oct-03 9:42 
GeneralRe: Get Pin
David Crow20-Oct-03 10:09
David Crow20-Oct-03 10:09 
GeneralAbout burning libraries... Pin
Rafael Fernández López20-Oct-03 8:23
Rafael Fernández López20-Oct-03 8:23 
GeneralRe: About burning libraries... Pin
Joe Woodbury20-Oct-03 9:45
professionalJoe Woodbury20-Oct-03 9:45 
GeneralRe: About burning libraries... Pin
Rafael Fernández López20-Oct-03 11:02
Rafael Fernández López20-Oct-03 11:02 
GeneralRe: About burning libraries... Pin
jhwurmbach20-Oct-03 22:07
jhwurmbach20-Oct-03 22:07 
GeneralRe: About burning libraries... Pin
Rickard Andersson2020-Oct-03 10:35
Rickard Andersson2020-Oct-03 10:35 
GeneralRe: About burning libraries... Pin
Rafael Fernández López20-Oct-03 10:58
Rafael Fernández López20-Oct-03 10:58 

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.