c语言编一个dll 用message box 弹出一个对话框,Qt学习之路(17): Qt标准对话框之QMessageBox...

这是一个关于使用VC6创建DLL程序的示例,包含`TestDll2QT.cpp`、`TestDll2QT.h`和`SetUp.h`等文件。程序定义了一个初始化DLL的入口点`CatchPhoto_SetUp`,并展示了`CSetUp`对话框的使用,包括`OnInitDialog`、`OnDestroy`、`OnClose`和`OnSize`等消息处理函数。
摘要由CSDN通过智能技术生成

2015-06-25 16:41

下面的是vc6中创建的dll程序|@||@|// TestDll2QT.cpp : Defines the initialization routines for the DLL.|@|//|@||@|#include "stdafx.h"|@|#include "TestDll2QT.h"|@|#include "SetUp.h"|@||@||@|#ifdef _DEBUG|@|#define new DEBUG_NEW|@|#undef THIS_FILE|@|static char THIS_FILE[] = __FILE__;|@|#endif|@||@||@|int __stdcall CatchPhoto_SetUp()|@|//int CatchPhoto_SetUp()|@|{|@|      CSetUp dlg;|@||@|      BEGIN_DLL_RESOURCE|@||@|      dlg.DoModal();|@||@|      END_DLL_RESOURCE|@||@|      return 1;|@|}|@||@||@|/|@||@|// TestDll2QT.h : main header file for the TESTDLL2QT DLL|@|//|@||@|#if !defined(AFX_TESTDLL2QT_H__BA38A950_47AE_4460_A330_98A0067A5E97__INCLUDED_)|@|#define AFX_TESTDLL2QT_H__BA38A950_47AE_4460_A330_98A0067A5E97__INCLUDED_|@||@|#if _MSC_VER > 1000|@|#pragma once|@|#endif // _MSC_VER > 1000|@||@|#ifndef __AFXWIN_H__|@|      #error include 'stdafx.h' before including this file for PCH|@|#endif|@||@||@|#ifdef _AFIS_CATCH_PHOTO_DLL_|@|#define AFIS_CATCH_PHOTO_EXPORT __declspec(dllexport)|@|#else|@|#define AFIS_CATCH_PHOTO_EXPORT __declspec(dllimport)|@|#endif|@||@|//extern "C" _declspec(dllexport) CatchPhoto_SetUp();|@||@|int AFIS_CATCH_PHOTO_EXPORT __stdcall CatchPhoto_SetUp();|@||@|//`AFX_INSERT_LOCATION`|@|// Microsoft Visual C++ will insert additional declarations immediately before the previous line.|@||@|#endif // !defined(AFX_TESTDLL2QT_H__BA38A950_47AE_4460_A330_98A0067A5E97__INCLUDED_)|@||@||@|///|@||@|// SetUp.cpp : implementation file|@|//|@||@|#include "stdafx.h"|@|#include "TestDll2QT.h"|@|#include "SetUp.h"|@||@|#ifdef _DEBUG|@|#define new DEBUG_NEW|@|#undef THIS_FILE|@|static char THIS_FILE[] = __FILE__;|@|#endif|@||@|/|@|// CSetUp dialog|@||@||@|CSetUp::CSetUp(CWnd* pParent /*=NULL*/)|@|      : CDialog(CSetUp::IDD, pParent)|@|{|@|      //{{AFX_DATA_INIT(CSetUp)|@|            // NOTE: the ClassWizard will add member initialization here|@|      //}}AFX_DATA_INIT|@|}|@||@||@|void CSetUp::DoDataExchange(CDataExchange* pDX)|@|{|@|      CDialog::DoDataExchange(pDX);|@|      //{{AFX_DATA_MAP(CSetUp)|@|            // NOTE: the ClassWizard will add DDX and DDV calls here|@|      //}}AFX_DATA_MAP|@|}|@||@||@|BEGIN_MESSAGE_MAP(CSetUp, CDialog)|@|      //{{AFX_MSG_MAP(CSetUp)|@|      ON_WM_DESTROY()|@|      ON_WM_CLOSE()|@|      ON_WM_SIZE()|@|      //}}AFX_MSG_MAP|@|END_MESSAGE_MAP()|@||@|/|@|// CSetUp message handlers|@||@|void CSetUp::OnDestroy() |@|{|@|      AfxMessageBox("OnDestroy 1");|@||@|      CDialog::OnDestroy();|@|      |@|      AfxMessageBox("OnDestroy 2");|@|      |@|}|@||@|BOOL CSetUp::OnInitDialog() |@|{|@|      CDialog::OnInitDialog();|@|      |@|      AfxMessageBox("OnInitDialog");|@|      |@|      return TRUE; // return TRUE unless you set the focus to a control|@|               // EXCEPTION: OCX Property Pages should return FALSE|@|}|@||@|void CSetUp::OnClose() |@|{|@|      AfxMessageBox("OnClose 1");|@|      |@|      CDialog::OnClose();|@||@|      AfxMessageBox("OnClose 2");|@|}|@||@|void CSetUp::OnSize(UINT nType, int cx, int cy) |@|{|@|      static s_count = 0;|@|      s_count++;|@|      |@|      char buff[32];|@|      sprintf(buff, "OnSize1: %d", s_count);|@|      AfxMessageBox(buff);|@||@|      CDialog::OnSize(nType, cx, cy);|@|      |@|      sprintf(buff, "OnSize2: %d", s_count);|@|      AfxMessageBox(buff);|@|}|@||@||@||@||@|#if !defined(AFX_SETUP_H__B0E66929_5B48_4C53_B505_755051E48FA2__INCLUDED_)|@|#define AFX_SETUP_H__B0E66929_5B48_4C53_B505_755051E48FA2__INCLUDED_|@||@|#if _MSC_VER > 1000|@|#pragma once|@|#endif // _MSC_VER > 1000|@|// SetUp.h : header file|@|//|@||@|/|@|// CSetUp dialog|@|#include "resource.h"|@||@|class CSetUp : public CDialog|@|{|@|// Construction|@|public:|@|      CSetUp(CWnd* pParent = NULL);   // standard constructor|@||@|// Dialog Data|@|      //{{AFX_DATA(CSetUp)|@|      enum { IDD = IDD_DIALOG1 };|@|            // NOTE: the ClassWizard will add data members here|@|      //}}AFX_DATA|@||@||@|// Overrides|@|      // ClassWizard generated virtual function overrides|@|      //{{AFX_VIRTUAL(CSetUp)|@|      protected:|@|      virtual void DoDataExchange(CDataExchange* pDX);   // DDX/DDV support|@|      //}}AFX_VIRTUAL|@||@|// Implementation|@|protected:|@||@|      // Generated message map functions|@|      //{{AFX_MSG(CSetUp)|@|      afx_msg void OnDestroy();|@|      virtual BOOL OnInitDialog();|@|      afx_msg void OnClose();|@|      afx_msg void OnSize(UINT nType, int cx, int cy);|@|      //}}AFX_MSG|@|      DECLARE_MESSAGE_MAP()|@|};|@||@|//`AFX_INSERT_LOCATION`|@|// Microsoft Visual C++ will insert additional declarations immediately before the previous line.|@||@|#endif // !defined(AFX_SETUP_H__B0E66929_5B48_4C53_B505_755051E48FA2__INCLUDED_)|@|

回复

点赞

删除

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值