界面分成多个DLL小组并行开发

大雄猫 2006-04-11 09:13:41
我试了一下,使用mfc.总是会有错误提示.然后我把全部的文件放在主程序里面,就什么事情都没有了.一分成DLL就有错.我也照着微软的提示做了.

大家谁有过这方面的经验?
...全文
210 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
luckdog01 2006-08-15
  • 打赏
  • 举报
回复
学习
syy64 2006-04-11
  • 打赏
  • 举报
回复
// TestDll.cpp : Defines the initialization routines for the DLL.
//

#include "stdafx.h"
#include "TestDll.h"
#include "DlgDBConnect.h"
#include "DlgRecordset.h"
#include "DlgTableDesign.h"
#include "DlgTest.h"


#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
HWND hMainWnd;
//
// Note!
//
// If this DLL is dynamically linked against the MFC
// DLLs, any functions exported from this DLL which
// call into MFC must have the AFX_MANAGE_STATE macro
// added at the very beginning of the function.
//
// For example:
//
// extern "C" BOOL PASCAL EXPORT ExportedFunction()
// {
// AFX_MANAGE_STATE(AfxGetStaticModuleState());
// // normal function body here
// }
//
// It is very important that this macro appear in each
// function, prior to any calls into MFC. This means that
// it must appear as the first statement within the
// function, even before any object variable declarations
// as their constructors may generate calls into the MFC
// DLL.
//
// Please see MFC Technical Notes 33 and 58 for additional
// details.
//

/////////////////////////////////////////////////////////////////////////////
// CTestDllApp

BEGIN_MESSAGE_MAP(CTestDllApp, CWinApp)
//{{AFX_MSG_MAP(CTestDllApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTestDllApp construction

CTestDllApp::CTestDllApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}

/////////////////////////////////////////////////////////////////////////////
// The one and only CTestDllApp object

CTestDllApp theApp;
BOOL bIsOpenDB(FALSE);

BOOL CTestDllApp::InitInstance()
{
// TODO: Add your specialized code here and/or call the base class
/* if (!AfxOleInit())
{
AfxMessageBox("ole ³õʼ»¯´íÎó");
return FALSE;
}*/

AfxEnableControlContainer();//
return CWinApp::InitInstance();
}

extern "C" __declspec(dllexport) void showDBConndlg(HWND hWndParent)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CDlgDBConnect dlg(CWnd::FromHandle(hWndParent));
hMainWnd = hWndParent;
dlg.DoModal();
bIsOpenDB=TRUE;
}
extern "C" __declspec(dllexport) void showRecorddlg()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CDlgRecordset dlg(CWnd::FromHandle(hMainWnd));
//hMainWnd=hWndParent;
if(bIsOpenDB)
dlg.DoModal();
else
::MessageBox(NULL,"Êý¾Ý¿âδ´ò¿ª£¬ÇëÏÈÁ¬½ÓÊý¾Ý¿â£¡","Ìáʾ",MB_OK);
}
extern "C" __declspec(dllexport) void closeconn()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
// CDlgTest dlg(CWnd::FromHandle(hMainWnd));
//dlg.DoModal();
if(theApp.m_pConnection)
{
theApp.m_pConnection->Close();
theApp.m_pConnection.Release();
bIsOpenDB=FALSE;
}

}
extern "C" __declspec(dllexport) void showTableDesigndlg()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CDlgTableDesign dlg(CWnd::FromHandle(hMainWnd));
//hMainWnd=hWndParent;
if(bIsOpenDB)
dlg.DoModal();
else
::MessageBox(NULL,"Êý¾Ý¿âδ´ò¿ª£¬ÇëÏÈÁ¬½ÓÊý¾Ý¿â£¡","Ìáʾ",MB_OK);

}

extern "C" __declspec(dllexport) void showTestdlg()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());

CDlgTest dlg(AfxGetApp()->GetMainWnd());
//hMainWnd=hWndParent;
if(bIsOpenDB)
dlg.DoModal();
else
::MessageBox(NULL,"Êý¾Ý¿âδ´ò¿ª£¬ÇëÏÈÁ¬½ÓÊý¾Ý¿â£¡","Ìáʾ",MB_OK);

}
大雄猫 2006-04-11
  • 打赏
  • 举报
回复
我在DLL里面做了一个对话框,想把它做为子窗口,放在主程序的父窗口里面.在dll的接口处传入父窗口的窗口句柄,结果子窗口的创建过程出错,好象是判断父窗口的句柄是无效的.然后在退出时也是出错.
noneone 2006-04-11
  • 打赏
  • 举报
回复
你做的dll是扩展dll吗?标准dll不能导出类
noneone 2006-04-11
  • 打赏
  • 举报
回复
估计什么地方搞错了吧!我也是这么做的,好像可以
he_sl 2006-04-11
  • 打赏
  • 举报
回复
怎么分?我们有自己的底层界面库,也没出什么问题啊
大雄猫 2006-04-11
  • 打赏
  • 举报
回复
谢谢,我试试

15,975

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧