CodeProject上有个非常好的讲shell扩展的系列文章:The Complete Idiot’s Guide to Writing Shell Extensions,作者在文章中提到了一下关于如何处理注册表的问题,主要是在哪添加context menu handler的问题。
以下是原话:
We can’t reliably use an RGS script since “txtfile” may not be the correct key name.
Some other text editor may be installed that associates itself with .TXT files. If it changes the default value of the HKEY_CLASSES_ROOT\.txt key, all existing shell extensions will stop working.
实际应用时我发现,如果ext针对的是一些比较常用的格式,如PNG,那么出现上述作者预料到的问题的可能性极高,原始情况下的PNG是这样:.png->pngfile,安装PhotoShop或ACDSee等软件并关联png后,就会改变.png想对应的名字项.png->ACDSee.png .png->PhotoShop.PNG.8,类似这样的东西,所以在实际应用中依赖.rgs注册表脚本文件是一种很不可取的方式,正确的做法应该是在dll注册服务器的时候,手动处理添加关联,当然,一些com的其它注册问题写在.rgs里还是没问题的,最后也别忘了在反注册的时候,手动删除自己添加的关联。(有ATL的话直接用CRegKey非常简单)
C, C++, Obj-C
open c的RGA程序在真机上运行所需的依赖库
模拟器上运行测试了随open c插件包发布的一些RGA例子后想看看真机效果,本以为只要安装RGA.sis内的dll就可以了,后来发现mmp里还引用了一些基础的东西,如libc等,于是补上了pips_nokia_1_3_SS.sis内的dll,运行正常!
[ZT]DLL导出函数中有namespace时的用法
DLL中可以导出很多用户自定义的函数、类型、全局变量等。但是,我们有必要注意到这样的一种情形:我们写的DLL中有一些函数,能满足我们的需要,同时,我们也需要用到其他人写的DLL,但是不幸的是,这两个DLL中有同名的函数。尽管你可能还没碰到这样的情形,但是你可能要开始留意这个问题了,那么有什么好的办法来避免吗?
vcl线程内Synchronize更新主线程ui的问题
问题是这样的:我的Form会触发一个相当耗时的work,而同时我又不希望这个Form在做这个work的时候UI停止响应,所以,我把这个work放到了线程里执行(起了个继承自TThread的TWorker类),现在的问题时我想让这个工作的当前完成度在Form上以进度条的形式反馈给用户,也就是在线程中更新vcl组件的问题,
[ExpressBars]How to Force a Main Menu to Always Be on Top of a Form
This can be accomplished if the main menu is placed onto a dock control, whose AllowDocking is set to False. Here are the step-by-step instructions of how to implement this feature in your application:
1. Drop the TdxBarDockControl component onto a form. The dock control is aligned to the top by default. Set the BarManager property to the BarManager of the form;
2. Dock the main menu to the dock control;
3. Set the AllowDocking to False of the dock control;
4. Set the NotDocking property of the main menu to [dsNone, dsLeft, dsTop, dsRight, dsBottom] (i.e. activate all options of the NotDocking).
The attached samples demonstrate the results of these steps.
用图片给VCL Form做背景的方法…
开始我在Form的Paint里直接Canvas画图,发现只要一repaint就会闪烁,很明显是先画了背景再画图片造成的,但我发现就算我截下WM_ERASEBKGND直接返回true也不能阻止其重画背景颜色,后来搜到csdn上也有人问到,最后给出的可用解决方法让我觉得很奇怪:首先截下WM_ERASEBKGND返回false,然后子类化整个form的window,处理窗口消息处理函数中的WM_ERASEBKGND和WM_HSCROLL,WM_VSCROLL…
Get flicker free animation in MFC/GDI+
Why still flicker in my animation(GDI+,MFC)?
Many articles talk about using double buffer to eliminate filker, but I found their methodes don’t work.Then I found even I draw one single line in CView::OnDraw method, the window flickers on mouse moving which causes CView::Invalidate(true).
关于TListBox自绘状态下的repaint闪烁问题
又是一个flicker prob.但这个控件的闪烁问题和以往遇到的有些不同,一般情况下只要禁止控件重绘背景(WM_ERASEBKGND这个消息)就可以解决。我先用了简单的设置方式(那个直接设置vcl控件属性禁止重绘背景),但发现没有效果,后来又用了窗口子类化,重写了窗口过程拦下了重绘背景的消息,但是实际运行发现也没有效果,最后我用SPY++查看这个控件时发现,一个TListBox实际上是由2部分组成,一个TScrollBox负责控制2边滚动条的显示,还有一个InnerListBox是实际显示item的控件,以前的几种尝试方式都是针对错了对象的,如果将子类化的hwnd用inner的就没问题了,基本解决了重绘整个控件时的闪烁问题,但是还是有一点小bug:由于TListBox自绘时并不会卡准最后一个Item的下边一定和控件的下边位置一致,所以有可能在控件内空出一部分空间,如果禁用了背景重画,则空出的这部分空间的颜色无法控制,而另一种方式通过打开inner的双缓冲也可以解决闪烁的问题,但是还是这部分空出的空间的颜色会有时正常(拖动滚动条移动时)有时不正常(用滚轮移动时),这个问题还有待解决。
如何使MFC的MDI默认不创建空child窗口
[color=#008000]// Parse command line for standard shell commands, DDE, file open[/color]
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
[color=#008000]// 防止开启后自动创建child[/color]
[color=#0000D0]if[/color] (cmdInfo.m_nShellCommand==CCommandLineInfo::FileNew)
{
[color=#0000D0]if[/color] (cmdInfo.m_strFileName==[color=#808080]””[/color])
{
cmdInfo.m_nShellCommand=CCommandLineInfo::FileNothing;
}
}
[color=#008000]// Dispatch commands specified on the command line[/color]
[color=#0000D0]if[/color] (!ProcessShellCommand(cmdInfo))
[color=#0000D0]return[/color] [color=#0000D0]FALSE[/color];
本代码由xTiNt自动着色 http://kbadboy.yeah.net