Dll with dialog box

A

Ahmad Noori

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 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;
}

and here is the code for my CmcDlg 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.
 
M

Mike Wahler

Ahmad Noori said:
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 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:

Answers available at newsgroup:
microsoft.public.vc.mfc

Purpose of comp.lang.c++ :
http://www.slack.net/~shiva/welcome.txt

HTH,
-Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,059
Latest member
cryptoseoagencies

Latest Threads

Top