在应用程序中集成外壳的上下文菜单

在应用程序中集成外壳的上下文菜单(下) (二)  响应鼠标单击消息,获取IContextMenu接口并弹出菜单;通过C盘的IShellFolder接口的GetUIObjectOf方法我们可以得到该节点的一个或多个指定子节点的IContextMenu接口,该方法原型如下:HRESULT GetUIObjectOf(    HWND hwndOwner,    UINT cidl,     //指定apidl指向的数组中包函的pidl的 阅读详情

关键字:Shell, Namespace, IContextMenu, 外壳, 名字空间, 上下文菜单

文章难度:初级

 

介绍(What is the shell contextmenu)

 

随着越来越多的软件对外壳的扩展,资源管理器变得是越来越强大和易用,以前要压缩一个或多个文件,你得老老实实找到压缩软件的快捷方式并打开他,接着进行一系列的选择操作,这对我这种懒人来说绝对是很烦的一件事,而有了外壳的菜单扩展机制,你只需在资源管理器中选好你要操作的文件然后弹出右键菜单选择相应的项就搞定了,多方便啊。

呃,打住,本文并不是要介绍怎么给资源管理器加入一个菜单扩展项(注1),而是介绍怎么在自己的程序中调用那个有着丰富功能的上下文菜单。例如FlashFXP中左边的本地文件窗口(图1):

 

 

(图1:假设你在打开FTP软件想把一些文件上传时才发现这些文件尚未打包,怎么办?切换到资源管理器把他们打包再回到FlashFXP吗?No no no,别做这么没效率的事,在FlashFXP左窗口中把相应文件选中后按住shift键后弹出右键菜单看看,简直太美妙了,以后在FTP上down到什么好音乐我直接就可以用喜欢的播放器来欣赏了。)

 

(注1:基本上认为写一个上下文菜单扩展项是比较容易实现的,有大量的文章和示例代码可从http://www.codeproject.com/shell得到)

 

 

原理(How to implement)

 

我们知道,在win32中是以外壳名字空间(注2)的形式来组织文件系统的,在外壳名字空间里的每一个文件夹都实现了一个IShellFolder的接口,通过这个接口我们可以直接查询或间接得到其他相关的接口。

跟对象(注3)的上下文菜单相关的接口是IContextMenu,通过对象的父文件夹的IShellFolder::GetUIObjectOf方法可得到该接口。得到该接口后,可以用IContextMenu::QueryContextMenu方法来生成上下文菜单的菜单项,用IContextMenu::InvokeCommand调用相应的命令。看起来很简单不是吗?下面就以一个实例来说明具体的实现,包括怎么得到一个对象的父文件夹IShellFolder接口,怎么得到IContextMenu,及怎么调用IContextMenu的各个方法。

 

(注2:关于外壳名字空间的概念,推荐大家看看姜伟华

37、设计与外壳集成的应用程序 本文深入探讨了如何设计与Windows外壳集成的应用程序,涵盖文档类型的注册、图标与用户界面配置、上下文菜单命令添加、外壳扩展机制、新建文档功能实现,以及应用程序路径和自动启动设置。通过注册表操作实现与资源管理器的深度整合,并结合流程图与实践案例,提供了关于MDI/SDI设计选择、单实例控制、DLL管理等方面的详细指导。最后展望了智能化集成、云服务融合等未来趋势,为开发者构建无缝用户体验的桌面应用提供全面参考。 阅读详情

相关推荐

39、设计与外壳集成的应用程序

本文详细介绍了如何设计一个与操作系统外壳紧密集成的应用程序,涵盖单实例检测、注册文件类型与图标、添加上下文菜单项、支持拖放操作、设置自定义文件夹图标、自动管理最近使用文档列表,以及实现功能丰富的自定义打开对话框。通过注册表配置和Windows API的深入应用,开发者可显著提升应用程序的用户体验和系统融合度。

bush的博客 47

实现Windows右键菜单的简单教程:外壳上下文菜单开发

在数字时代,个性化和效率成为用户体验的关键。外壳扩展技术,尤其是上下文菜单的定制,为用户提供了更加直接和高效的交互方式。上下文菜单,通常是指用户在执行特定操作(如右键点击文件或文件夹)时弹出的菜单,它可以根据程序或用户的设置展示不同的命令选项。通过外壳扩展,开发者能够向这些菜单中添加新的功能,从而提高工作效率和用户体验。本章将探讨外壳扩展与上下文菜单的基础概念,包括它们的组成、用户与系统间的交互机制以及外壳扩展如何在用户界面中发挥作用。

weixin_32661831的博客 886

Delphi实现Windows外壳扩展编程教程

本文还有配套的精品资源,点击获取 简介:Windows外壳扩展编程通过COM技术使开发者能够自定义Windows界面元素如文件夹视图和上下文菜单。Delphi环境简化了这一过程,提供了对COM的直接支持和可视化工具。本教程包含实例和指南,指导如何在Delphi中实现接口,创建右键菜单项和自定义属性页,以及外壳扩展的注册和测试。 1. Windows外壳扩展编程简介...

weixin_29050829的博客 1268

Qt实现Windows的SendTo菜单

本资源在Qt平台下利用Windows API实现Windows发送到(SendTo)菜单,并实现菜单项单击功能。

ShellContextMenu

ShellContextMenu 在自己开发的程序中加入系统菜单。

获取缩略图,利用shell32

此为用vs2005编写的用来获取文件缩略图的C++程序,用到了mfc库。 不保证正确。

CShellContextMenu类

MFC---CShellContextMenu类:基于shobjIdl.h 主要用到这三个接口 GetUIObjectOf、QueryContextMenu、InvokeCommand弹出系统右键菜单。

残差检验_第三十讲 R语言-Cox比例风险模型的假设检验条件

在介绍完 Cox比例风险模型的详细理论和R实现以后(插入链接!!!),我们已经知道Cox比例风险模型可以较好的同时矫正多个混杂因素对结果的影响,同时我们遗留下来了一个问题:Cox比例风险模型的假设检验条件是什么?这一讲,我们将对此进行解答。请注意,如果使用不当,统计模型可能会产生误导性的结论。因此,检查给定的模型是否适合数据类型是非常重要的!1. Cox比例风险模型的假设条件Cox比例风险模型的成...

weixin_35476698的博客 8047

Qt UI界面美化教程1:【“飞扬青云” Qt精美控件】使用教程1

相信很多小伙伴在使用Qt Widget的过程中都会遇到一个问题,开发出来的界面,丑!丑!丑!当然Qt做界面美化可以用到QSS,需要对前端知识有一定了解,后续本套教程将会做讲解。本篇文章,我们直接站在巨人(大佬飞扬青云)的肩膀上,使用他开发好的163款自定义控件,请大家一定支持他,去给他小心心,他的个人主页:本篇文章只讲述如何在 QtDesigner 安装这些控件。

2401_87556704的博客 1420

PTPX功耗分析实战——从脚本配置到报告解读

本文详细介绍了PTPX功耗分析的全流程,从脚本配置到报告解读,帮助工程师快速掌握芯片设计中的功耗估算技术。文章涵盖了环境搭建、波形文件处理、功耗报告解析等关键环节,并提供了实战经验和优化建议,特别适合需要提升PTPX功耗分析效率的开发者。

weixin_29248313的博客 279

aruco_ros实战:从USB摄像头到Marker位姿检测全流程解析

本文详细解析了使用aruco_ros从USB摄像头实现ArUco Marker检测与位姿估计的全流程。内容涵盖环境搭建、核心launch文件配置、可视化调试、位姿数据解析以及深度优化技巧,帮助开发者快速掌握ROS下的视觉定位关键技术,并集成到机器人项目中。

weixin_29230805的博客 265

基于51单片机扫地机器人(全套Proteus仿真+原理图+程序+说明书)

(内含源程序代码,原理图,仿真,讲解视频,元件清单等,【精品】值得推荐!!!扫地机器人是以单片机为主控制器。通过单片机控制小车行驶、除尘、蜂鸣。扫地机器人使用双电机驱动,以提高整车运动的平稳性;在智能车进驶过程中,采用双超声波模块实现避障。

2301_76434107的博客 1895

OpenWRT使用4G/5G无线网卡模块上网

将4G/5G开发板插入设备,终端输入lsusb或lspci,看设备是否识别到4G/5G模块。

1万+

使用R语言整理GEO数据的简易教程

本教程介绍了使用R语言从GEO数据库下载数据并进行数据整理的基本步骤。根据实际研究问题,你可能需要进行更复杂的数据处理和分析。R语言作为一种强大的生物信息学工具,为GEO数据的整理、分析和可视化提供了丰富的功能和工具。希望这个教程能够帮助你入门GEO数据整理和R语言的应用。如果你在使用过程中遇到问题,或需要进一步的指导,请随时向我询问。祝你在GEO数据分析的旅程中取得成功!

Mrrunsen的博客 3742

【WRF-UCM】BEP+BEM 模拟:README

【WRF-UCM】BEP+BEM 模拟:README

WW、forever的博客 223

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

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

SAP B1中文培訓教材_SDK

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

上一篇: MFC动态创建控件的消息处理
下一篇: 张学友 - 蓝雨(粤)
_foo
博客等级 码龄23年 1粉丝 18原创
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值