C++ GUI编程---使用SmartWin++

SmartWin基于WinAPI的GUI框架 smartwin 基于WinAPI的GUI框架,而不是基于MFC/WTL 立即下载

SmartWin++ 是 100% 标准 C++ 编写的轻量级 GUI 库 (http://smartwin.sourceforge.net) ,现在最新版是 beta 2.0 ,它的最初的目标是替代 MFC 和 WTL 。现在它可以通过 WinLib 在 linux 下使用,据作者介绍,在以后的版本里会支持 linux 下的开发。

 

它是使用 STL 和 Boost 编写,不过使用者不必自己安装 Boost 库,只要下载 SmartWin++ ,编译一下就可以使用了。

 

SmartWin++ 没有 MFC 那样的宏,你完全可以以 C++ 的思维开编写 GUI ,对我们 C++ 开发人员来说,很容易上手。更可贵的是它有一个可视化的 GUI 设计工具 Sally(http://sallyide.sourceforge.net) ,用它与 VC 配合,感觉很不错。

 

SmartWin++ 编译出来的程序很小,这是吸引我的地方之一。它支持 OpenGL 以及 OpenCV ,对做图形图像的人可不错哦。

 

下面是一些截图
 


最简单的程序

// Main.cpp

#include 
" SmartWin.h "
using   namespace  SmartWin;

class  HelloWinClass
            : 
public  WidgetFactory <  WidgetWindow, HelloWinClass  >
{
private :
    WidgetButtonPtr itsButton;

public :

    
void  buttonClicked( WidgetButtonPtr button )
    
{
            createMessageBox().show( _T( 
" Hello World! "  ), button -> getText() );
    }


    
void  initAndCreate()
    
{
        createWindow();
        setText( _T( 
" Hello SmartWin "  ) );     //  Title

        itsButton 
=  createButton();
        itsButton
-> setText( _T(  " Hello "  ) );
        itsButton
-> onClicked(  & HelloWinClass::buttonClicked );
        itsButton
-> setBounds( sw::Rectangle(Point(  90 ,  60  ), Point(  50 ,  30  ) ) );
    }

}
;

int  SmartWinMain( Application  &  app )
{
    HelloWinClass 
*  testHello  =   new  HelloWinClass;
    testHello
-> initAndCreate();
    
return  app.run();
}


我使用 visual c++ 2003 来编译该程序:

首先编译 SmartWin++ 源码,大约几分钟,我们就可以得到 SmartWin.lib 和 SmartWinD.lib 两个库文件,它们分别对应 Release 版和 Debug 版;

然后建一个 ” Win32 Project ” 的空项目,把上面的 Main.cpp 加到工程中;

再在工程的属性里把 SmartWin++ 的头文件以及 Lib 库文件的路径设置一下,把 C/C++ | Language | Enable Run-Time Type Info 设成 Yes (/GR);

再编译执行就 Ok 了。



 

可视化设计工具

作为一个GUI库,如何没有可视化的开发工具是一件很痛苦的事。如何像java的swing一样有布局器还好一点;如果是像素定位的,没可视化工具真的要疯了。

还好有人已经开发了一个开源的SmartWin++的可视化开发工具Sally(
http://sallyide.sourceforge.net ) 。用它来做界面,自动生成界面代码,再配合VC2003写其他代码,用起来真的不错。


基于framebuff的轻量级的ui显示组件 嵌入设备,基于framebuff的轻量级ui显示组件,可以静态动态显示文字,结合字库,可以显示多国语言,可以显示图片。 立即下载

相关推荐

Win11 24H2共享访问被禁?深入聊聊SMB签名和‘不安全的来宾登录’那点事

本文深入解析Win11 24H2共享访问故障,探讨SMB签名的安全机制与‘不安全的来宾登录’问题。提供从注册表修改到组策略配置的多层次解决方案,特别针对家庭网络和打印机共享场景给出实用建议,帮助用户在安全与便利之间找到平衡。

weixin_42556197的博客 566

SmartWin++介绍

    SmartWin++是一个100%免费的c++ GUI与soap开发库.    可以用来开发基于个人电脑,掌上电脑,windows mobie 或者windows CE系统上的界面应用程序.使用SmartWin++即可以开发开源应用程序,也可以用于开发商业应用程序,得益于SmartWin++基于BSD 许可权.    SmartWin++的初衷是用于替代windows的MFC与WT

jonaszhang的专栏 1535

Qt跨平台CAN通信实战:Vector、PCAN与周立功设备统一接口设计

本文针对Qt开发中常见的多品牌CAN设备兼容难题,提出了一套统一的跨平台CAN通信接口设计方案。通过抽象层封装,实现了对Vector、PCAN和周立功设备的统一操作,上层业务代码无需修改即可在不同硬件间切换,有效解决了驱动API差异、环境配置复杂和维护成本高等痛点,显著提升了代码复用率和开发效率。

weixin_29161785的博客 332

SmartWin++笔记

2007-03-15 12:44 最近在用SmartWin++,感觉还不错,有空会写点东西放上来。其实我这是二进宫了。很久前不知发了哪根神经,也曾经研究了一下,对她的基于策略的设计理念很是赞叹了一番,加之里面大量运用了STL、Boost等比较现代的库,可学性还是挺高的。但我最终没有

benny5609的专栏 5008

Android AudioFlinger(一)——初识AndroidAudio Flinger

AudioFlinger 是 Android 系统中的音频中间层(audio HAL, Audio Hardware Abstraction Layer)的一部分,负责管理音频的混音、播放和音量控制等功能。它充当 Android 应用程序和音频硬件之间的桥梁。

hirezy 1669

共有49款Windows GUI开发框架开源软件 【转】

源文 : http://www.oschina.net/project/tag/178/gui?lang=36&amp;os=0&amp;sort=view&amp;p=1 桌面应用开发引擎 AlloyDesktop AlloyDesktop 是 HTML5 本地 App 开发引擎,是一个能将网页像软件一样运行在桌面上的app开发引擎。该引擎实现了对网页的透明渲染,使网页不再局限于浏览器的框框...

weixin_34336292的博客 972

AI奶牛TMR智能饲喂机器人 Qt信创完整项目( 统信/麒麟国产系统直接编译)

内置**犊牛、育成牛、围产牛、泌乳牛、干奶牛**5套标准化饲喂配方;+" 饲喂批次完成|牛群:"+grpText+"|投喂饲料:"+QString::number(ft)+"吨|剩料:"+QString::number(st)+"吨|异常牛:"+QString::number(abCow);cv::putText(frame,"霉变变质饲料禁止饲喂",cv::Point(20,40),cv::FONT_HERSHEY_SIMPLEX,0.7,cv::Scalar(0,0,255),2);

寒寒豆豆软件公司的博客 183

smartwin++之旅_1

= 概览 = Smartwin++是一个体现了现代的C++设计思想的开源GUI库,授权方式是BSD. 它专注于Windows平台的GUI设计,并且可以支持WinCE平台。借助于WineLib,还可以在更多操作系统,比如Linux上运行. 官方网站: http://smartwin.sourceforge.net 我用的编译环境是VS2005,Smartwin版本为2.0.下载安装包,一路n...

张沈鹏,在路上 ... 364

YOLO26涨点改进 | 损失函数改进篇 | 引入SlideLoss,适配尺度变化+遮挡+难易样本不平衡,手把手配置+实战案例

COCO-Hard是COCO数据集的复杂场景子集,包含80个类别,重点筛选多尺度、遮挡密集样本,其中小尺度目标(<32×32像素)占比42%,大尺度目标(>128×128像素)占比28%,遮挡目标占比57%,场景涵盖人群密集、车流拥堵、复杂工业环境,完美模拟真实复杂检测场景,适合验证SlideLoss的适配性。

qq_36130719的博客 157

Python - 多页pdf 合称为一页

尝试使用 ReportLab 来重画 pdf,但探索起来有点麻烦。重要的是解决手头这个问题,所以就算方法蠢,但简单完事。以下生成结果,最有一页 pdf 可能会显示在第一页,手动编辑下 pdf 即可;或者你也可以修改代码逻辑来完善。打印ppt,一页占用A4纸比较浪费,想多页合成一个 A4大小;安装 fitz,单独安装 fitz 使用可能会报错。将 PDF 拆分为 图片来保存。

AI工程化、开源分享、文档翻译、代码笔记 1425

SmartWin++

    其实,我找SmartWin++好长一阵子了(或者说我想找一个MFC的代替品很长一段时间了)。今天试了一下还是比较爽的,,不过就是调用onSelectionChanged  或者 onClicked  之类的onXxxx函数时总会出错,正在想办法呢。如果只是Creat或是Display的话那是没有问题的。

zhouhu1001的专栏 1087

华为od 面试八股文_Python语言_01_含答案

华为od 面试八股文_Python语言_01_含答案

MISAYAONE的博客 9109

smartwin++

yong002的专栏 677

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

深度学习工具包 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")

界面库设计的新思维:SmartWin++

《C++设计新思维》(即《Moden C++ Design》)曾让我感到不可思议,而SmartWin++更让我眼前一亮,该库受《C++设计新思维》的启发,使用STL,Boost,Loki库,运用《C++设计新思维》介绍的各种技术,使得编写界面变得异常容易,代码量非常小并且清晰易懂,编译出的程序尺寸小速度快,还有一个可视化的 GUI 设计工具Sally。另外该库的源代码颇具美

讨厌什么,变成什么. 3685

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

UPP映象(A C++ GUI lib)

记得刚毕业(七年前)自学VC/MFC,可能由于自己笨的原因,花了很长时间也没弄懂是怎么回事,暂时搁置未学。02年的时候因为工作原因 想编一个小工具帮忙简化配置数据,于是边看书边写,总算写出了第一个实用的VC程序。此后又写了几个小程序。从去年开始想写一个管理传输电路的工具,从去年到今年断断续续的写,边写边录数据,做到90%的时候怎么也不想往下做了。实在是厌烦了手工边写代码控制控件的位置。曾经在《程序

OPath的专栏 3552

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

放弃SmartWin++ 我投入了QT的怀抱

      还记得,刚刚调通SimartWin++时的高兴劲。每写学习用的测试工程心情都很爽,以为再不用MFC这个东东,不过,用了几天才发现也有很多不顺手的地方。于是又找呀找,哈哈,最后还是看中了QT。 

zhouhu1001的专栏 795

抛弃了上一个 GUI 消息机制,重写了一个更灵活高效的

转帖请注明出处 http://www.cppblog.com/cexer/archive/2008/08/18/59285.html  抛弃了上一个消息机制,因为它的实现不得不多用了几个模板函数,在使用的时候有代码膨胀的现象。虽然其程度不如 win32gui,SmartWin,不过因为本人有点极端,所以相当地不满意。于是又开始写一个新的消息机制,它的外表看起来像是 SmartWin++ 和 A

klg1980的专栏 1020

几款开源的图形界面库(GUI Libraries)

SmartWin++  遵循BSD许可协议的C++ GUI库,建立在Windows API之上,但仍可以通过使用WineLib在Linux/xNix上使用。也支持Pocket PC和基于Windows CE的应用程序...   XCLASS  XCLASS库是X Windows环境中的一个C++ GUI工具包的。它是基于Xlib的,由一套组件,包括从简单部件到复杂的,其中也

记事本 9259
上一篇: malware analysis 实战
下一篇: 给csdn-blog开发组的建议
iiprogram
博客等级 码龄25年 1068粉丝 1515原创
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值