调用dll显示对话框

如何调用MFC dll 来显示其中的对话框 一、dll部分       同过VS向导建立一个MFC dll工程,在工程中创建自己的MFC类,来实现将要展示的界面。新建一个cpp工程,添加头文件#include "StdAfx.h"和界面类的头文件,然后使用下面语句来导出      extern "C" __declspec(dllexport) void ShowDlg(void)      {           AFX_MA 阅读详情

加载dll,显示对话框之后不要立刻调用FreeLibrary;特别是非模态显示对话框时

先创建一个DLL工程,新增一个函数如下,然后生成DLL文件

 

extern "C" __declspec(dllexport) void Show() {

//这里显示一个窗口

}

 

新建一个WIN32工程,将DLL文件拷贝至程序运行目录。

定义一个全局的HINSTANCE hwnd;

程序初始化时调用hwnd = LoadLibrary(_T("MFCDLL.DLL"));

程序结束时调用FreeLibrary(hwnd);

 

 

新增一个按钮,点击执行以下内容。

typedef void (WINAPI *TESTDLL)();

 

if (hwnd == NULL) {

    AfxMessageBox(_T("dll is not exist"));

    return ;

}

 

TESTDLL lpproc = (TESTDLL) GetProcAddress(hwnd, "Show");

if (lpproc == (TESTDLL)NULL) {

    AfxMessageBox(_T("function is not exit"));

    return;

}

(*lpproc)();   //这样就调用了DLL中的Show函数


创建并调用MFC规则DLL的实例 本例通过新建一个MFC规则DLL并新建一个MFC对话框程序调用它,演示MFC规则DLL的创建及调用。(VS2010环境下实例代码亲测可编译通过) 一、MFC规则DLL项目 1.创建MFC规则DLL 2.新建global.cpp(新建此文件没有特殊意义,仅用于单独添加创建并显示对话框的代码)并添加以下代码: # include "stdafx.h" # include "dlldia 阅读详情

相关推荐

DLL弹出对话框源代码以及调用dll的测试源程序

在Dll动态库调用CDialog实例的源代码,供您熟悉,可以方便您在DLL中进行界面UI的开发,同时还附有调用此DLL的源代码测试程序。

在动态链接库dll中弹出对话框

在动态链接库dll中弹出对话框步骤: 1、添加Dialog资源,然后在资源视图的对话框界面右击添加类,输入类名MyDlg,使得其继承与CDialogEx。(继承CDialog应该也可以)2、在新生成的类头文件MyDlg.h中引入“resource.h”3、在工程属性“链接器”->“输入”中的“附加依赖项”和“忽略特定默认库”都加上:nafxcwd.lib;LIBCMTD.lib;。(本次测...

weixin_34388207的博客 1801

DLL输出对话框类的例子

extern "C" __declspec( dllexport ) void mydlldlg() 通过这条到处函数的语句,注意:此例子实现的是非模态对话框的到处dll

DLL中添加对话框, 并被外部程序调用显示

1.VS 解决方案的创建 完成创建。 2.动态链接库(DLL)项目创建 完成dll项目,此时解决方案下有两个工程项目DLL_Dlg_Test 和 DLL_Dlg_Test_dll 3.在动态链接库项目中添加对话框及其对应的类 此时在DLL_Dlg_Test_dll项目下,增加了LibDllDlgTest.h 和 LibDllDlgTest.cpp两个对话框对应的类文件. 4.在dll项目中其它类文件(如CShowDlg.cpp)中,创建对话框显示函数 首先新建CShowDlg类,生

bbtang5568的博客 2751

【讯飞星火大模型AI】SpringBoot整合星火API:从零构建智能数据分析助手

本文详细介绍了如何使用SpringBoot框架整合讯飞星火大模型API,从零构建一个智能数据分析助手。通过清晰的步骤,指导开发者完成API密钥申请、项目搭建、SDK集成与核心代码编写,实现用户通过自然语言指令和CSV数据,即可自动获得ECharts图表代码与专业数据分析结论,极大降低数据分析与可视化的门槛。

neovim7hacker的博客 275

手把手教你用VS Code + Codex在WSL中高效编程(避坑指南)

本文提供了一份详细的避坑指南,教你如何在WSL环境中高效配置和使用VS Code与OpenAI Codex。文章核心在于解决WSL内Codex扩展的OAuth登录失败问题,推荐将扩展安装在Windows本地,并通过UNC路径直接访问WSL文件系统,从而实现AI辅助编程与Linux开发环境的无缝结合,提升编码效率。

weixin_28677451的博客 1063

MFC动态链接库弹窗

VS2019使用MFC动态链接库进行弹窗

weixin_44297917的博客 1383

VS Code配置MASM32汇编环境:从安装到调试的完整指南

本文提供了一份详尽的指南,教你如何在VS Code中配置MASM32汇编开发环境,实现从安装、环境变量设置到编写、编译和调试32位Windows汇编窗口程序的完整工作流。通过集成现代编辑器的便利性与经典汇编工具链,旨在降低学习门槛,提升底层开发效率。

nn3456的博客 483

控制台主程序通过调用DLL显示对话框

为了实现【控制台主程序通过调用DLL显示对话框】这个效果,已经折腾两天了,今天终于有了一点眉目,特此记录。 首先描述一下,我为什么这么做。我在写一个基于C语言运用DLL来实现的程序,其他的部分都封装在了不同的DLL里,主程序就是一个win32控制台程序。现在希望做一个界面来显示,因此就希望在写一个DLL,调用win32的接口,来做一个显示窗体。 一、主程序: #include #incl

sywcxx的成长空间 1509

一套适合 ABAP 初级和中级开发人员,从入门到提高的 ABAP 学习教程

曾几何时,ABAP 就是 SAP 的代名词。ABAP 这门编程语言造就了 SAP 名噪一时的 R/3 产品,同时也是如今 SAP 旗舰级产品,SAP S/4HANA 底层的实现语言。 ABAP 不仅代表着 SAP 这家公司在企业级管理软件市场辉煌的过去,ABAP 自身也在不断地进化着。SAP 不仅在本地部署(On-Premise)领域继续保持着自己绝对的统治地位,而且在云应用领域(Software-as-a-Service, 简称 SaaS), 也推出了自己的解决方案,比如 SAP S/4HANA Clo

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 5919

第28节:cesium 加载高程数据(含源码+视频)

cesium 加载高程(地形)数据

qq_29384639的博客 1740

C#调用MFC的dll,未显示MFC的对话框

解决:在MFC会显示对话框的函数开头添加此代码:AFX_MANAGE_STATE(AfxGetStaticModuleState());

wydd50的博客 690

高温环境下(100℃以上)相机的几种保障方案

高温环境下相机保障措施摘要:针对120℃以上高温环境,相机需采取多重防护:1.散热设计采用金属机身、散热鳍片或风扇;2.关键部件选用耐高温材料(铝合金、特种玻璃);3.电子元件需军规级芯片并做三防处理;4.建议外接电源或耐高温电池。工业相机(如FLIR A655sc、Basler ace)及特种机型(Ximea xiQ)具备高温适应性,普通相机可加装隔热套件配合冷却系统。选择时需关注传感器信噪比和全局快门性能,并设置温度监控保护机制。注意高温会加速设备老化,需定期检测维护。(149字)

start_up_go的博客 1585

MFC之对话框

1、新建对话框        对话框可以分为模式对话框和非模式对话框两种。模式对话框是指用户只能在当前的窗体中进行操作,在该窗体没有关闭之前不能切换到其他的窗体。非模式对话框是指当前的所操作的窗体可以切换。   一般情况下,用于确认信息的操作和一般的操作的对话框属于模式对话框。如打开文件对话框就是典型的模式对话框,而常见的查找和替换便是非模式对话框。     a)、模式对话框

lebao82的专栏 1102

XSS漏洞之PDF生成:从XSS到服务端任意文件读取

XSS是最为常见的Web漏洞之一,多年来连续入选OWASP TOP10,相信大家都耳熟能详。 它是一种代码注入类的攻击,是一种客户端侧的攻击,攻击者通过在Web应用中注入恶意JavaScript代码,通过点击URL,最终在受害者浏览器端执行的一种漏洞。主要有反射型XSS、存储型XSS、基于DOM的XSS三类。XSS一些比较常规的危害大概有:重定向浏览器、窃取Cookie、浏览器劫持等。本文章侧重于发现XSS后的进一步利用。 主要介绍在某次实际测试过程中,发现XSS漏洞之后,如何进一步的利用,最终通过XSS达

计算机毕业论文源码,学生个人网页制作html源码。贴近用户做网络推广和互联网优化。 3778

如何完全卸载axure软件以及解决安装axure后打不开的问题【2023年】

如何完全卸载axure软件以及解决安装axure后打不开的问题【2023年】

念兮为美 5139

在Dll中创建对话框并调用

第一步创建一“MFC AppWizard (dll)”工程,接下来选择“Regular Dll using shared MFC DLL”,点击“Finish”。 添加一对话框资源到工程中,从菜单中选择Insert->Resource,添加一“Dialog”,选择“New”,至此对话框已添加到DLL工程中。 为对话框添加一新类,如:CTest,基类为CDialog。在MFCDLL.cpp...

weixin_34381687的博客 1689

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

MFC DLL中封装模态对话框

最近一个项目中需要在DLL中封装一个对话框,exe在特定情况下可以显示该DLL的对话框! 在DLL单纯的用图1中的代码是没法成功显示该对话框的,在DoModal之前需要进行一个资源转换(如图2),让程序调用DLL模块中的资源,这样才能显示DLL的对话框资源;               图 1              图 2

landeli2的专栏 1423

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

dll文件与模态和费模态对话框的建立

dll文件的创建我用到的窗口有模态和非模态的        其中模态窗口的建立 DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_DLG_ERROR), hParent, (DLGPROC)DlgProc); 回调函数Dlgproc中都是消息响应函数,调用的时候需要在工程中配置dll文件的路径,将编译好的lib和dll文件放到路径中,设备中运行只需要放置dl

ahjxly的专栏 1292

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

MFC程序调用Dll中的对话框资源

MFC程序调用Dll中的对话框资源 以非模态显示 调用DLL文件中的对话框_一个DLL的能成功_一个DLL不能成功DllDialogTest VS2010写的 一个基于对话框的MFC程序 然后创建两个常规动态DLL文件 在DLL文件中分别添加对话框 一个DLL的对话框能正常调用 另一个不行 均为非模态调用....

... 2641

dll中添加对话框资源,在dll外面调用

1、第一步创建一“MFC AppWizard (dll)”工程,接下来选择“Regular Dll using shared MFC DLL”,点击“Finish”。 2、添加一对话框资源到工程中,从菜单中选择Insert->Resource,添加一“Dialog”选择“New”,至此对话框已添加到DLL工程中。 3、为对话框添加一新类,如:CTest,基类为CDialog。 4

wumingzcj的专栏 849
上一篇: 映泰TH67+的主板前置AC 97音频解决方案
下一篇: mac系统建立wifi网络
pClass
博客等级 码龄16年 4粉丝 23原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值