Posts in Win32
Extend a webbrowser control using ICustomQueryInterface
- 20 March 2023
This article is written with the help of ChatGPT. I want to see how far ChatGPT can go solve this and if any correction needs to be made. ChatGPT went pretty far but still made some mistakes.
To extend a WebBrowser control using ICustomQueryInterface, you can create a new class that implements the ICustomQueryInterface interface and then use the SetSite method of the WebBrowser control to set the new class as the site for the control. Here are the steps you can follow:
Better Late Than Never
- 16 June 2021
This post originally appeared on Joycode on Sept 17 2004.
在文件选择对话框和浏览器中都可以显示文件夹视图,但是有时需要对显示的方式进行控制,例如在文件选择对话框初始化时设置显示方式为详细资料视图或者缩略图视图,有的时候需要用程序来选择一些项目,例如在文件选择对话框中添加全选按钮,或者打开文件所在文件夹并且选中指定文件。
How To Determine When a Page Is Done Printing in WebBrowser Control
- 24 March 2021
Note this post is originally written in 2012. It was lost when moving my web site from Windows Live Spaces to WordPress. I found a dead link to my web site on Stackoverflow and found an archive from archive.org. So here it is the old article, with dead link updated of course.
The printing from a WebBrowser control can be customized by using custom headers and footers (https://www.betaarchive.com/wiki/index.php/Microsoft_KB_Archive/267240, archived from http://support.microsoft.com/kb/267240) or replacing the default print template. However, using such techniques conflicts with the PRINT_WAITFORCOMPLETION flag, which is used for synchronous printing.
Can we run 32 bit and 64 bit code in the same process?
- 18 June 2018
User redstone001 wants to know if it is possible to run 32 bit and 64 bit code in the same process – maybe in a different thread?
As Betteridge’s law of headlines say, any news ending with a question mark can be answered with the word no. But this isn’t news, so … the answer is … yeah? Kind of.
Farewell, dsoframer
- 11 March 2018
I know, it is long overdue. Microsoft discontinued it a decade ago. And Office is not meant to be embedded. I even advised people to not use it in new development almost a decade ago. Then why I keep using it for so long?
Because customers don’t want changes. I work in the medical field, where some of the clients still use telnet to interface with their medical software that are probably older than I am. Once you get people hooked to a UI it is hard to change that. The fact that Microsoft discontinues dsoframer means nothing to them – once I use it, I own it. It is like Microsoft having to release an Office update for the old equation editor made by MathType 16 years ago. So I have been doing patchwork as much as I can to keep dsoframer alive.
Flash Player: Loading from memory
- 26 November 2015
user cucao wants to know how to play a flash file from application resource. The user wants to use a dongle to protect unauthorized viewing of the flash file so can’t just put the swf file in plain sight.
Adobe’s Flash Player, being an ActiveX with supports for many OLE containers such as Internet Explorer and Microsoft Word, implements many standard OLE interfaces (for details open the ActiveX in oleview). One of them is IPersistStreamInit, a standard interface for ActiveX controls who want to distinguish new page load vs refresh, but can be used for the user to load the swf file from memory.
What’s new in Visual Studio Tools for Windows 10 Preview
- 24 March 2015
Looks like Windows 10 SDK gets renamed.
This post focuses on the Win32 wide of changes. Changes in the [STRIKEOUT:WinRT] Universal App Platform (UAP) side can be found at https://dev.windows.com/en-us/whats-new-windows-10-dev-preview. Some UAP APIs are available to all desktop apps, for exam DirectX 12 and notification center (should not come as surprise, older version of these APIs are already callable from Win32 apps ). Project Centennial also supports enabling UAP APIs to desktop apps, provided they meet certain requirements and deploy using the new appx model.
Book review: Mastering Windows 8 C++ App Development
- 08 August 2013
Disclaimer: I am a Microsoft MVP in Visual C++, so is Pavel Yosifovich, the author of the book.
Mastering Windows 8 C++ App Development by Pavel Yosifovich is a new addition to the Windows Store development books. It took me a while to read (304 pages) but is well worth the time from the perspective of a C++ developer. The book obviously went through great lengths to be comprehensive, not only introduced the typical Windows Runtime (WinRT) APIs in a crisp manner but also added a refreshment of C++ 11, the Model View ViewModel (MVVM) pattern, and the Windows Runtime C++ Template Library (WRL). In addition, being a book for C++ developers, the author’s emphasis on performance can be found in several tips and discussions, which is a nice focus for C++ developers. There are also several weaknesses in the book. Introducing WRL before C++/CX may be a poor choice as it is difficult to inspire the reader with laborious code. Also the book could use a few more details on DirectX and some WinRT APIs such as GeoPosition. Nevertheless, the book is an excellent text for the subject and I recommend the book to C++ programmers who want to start developing Windows Store apps and can do research outside of the book.
Another breaking change related to 64 bit compatibility, this time in TAPISRV w/Windows 8
- 30 July 2013
The ADO team had to make a breaking change the ADO APIs due to compatibility problem with Microsoft Office. Now it seems to be Tapi’s turn.
In the 64 bit editions of Windows 8 and Windows Server 2012, some TAPI providers would stop getting incoming calls due to implementation changes in the TAPI service (TAPISRV) that had to be done for 64 bit compatibility.
Howto: Ignoring web browser certificate errors in a webbrowser host
- 17 July 2013
Download Example Code: jiangsheng/Samples.
Many applications host webbrowser controls to display web pages inside. Before production the web page is often in an internal server that do not have a valid certificate. This article let you skip the certificate error and continue testing your application
How to restart Windows Explorer programmatically using Restart manager
- 22 January 2013
You can download source code of this post at jiangsheng/Samples
For shell extension programmers, restart Windows Explorer is one of steps in their setup programs. A programmer may also want to force some shell setting changes that would only be read by Explorer on start up. For example, this posts is inspired by a programmer who want to toggle task bar layout automatically depending on the screen resolution, and is used to demonstrate the new Windows Vista restart manager API like RmStartSession, RmRegisterResources, RmGetList, RmShutdown, RmRestart and RmEndSession.
Howto: reset IE security zone settings programmatically
- 26 November 2012
Internet Explorer 7 introduced the IInternetZoneManagerEx2 interface, which has a FixUnsecureSettings method to reset all security zone settings. Like all other IInternetZoneManager* interfaces, you can query this interface from the internet zone manager object:
There’s another CoInternetCreateZoneManager function to get the zone manager object’s IInternetZoneManager interface.
What is the Windows API for
- 21 March 2012
There are the questions programmers ask frequently. This faq does not contain sample code, readers should use keywords (showing in bold, such as function names, CLSIDs or interface names) to find complete solutions elsewhere.
Q: What is the Windows API for the Start Menu?
Choosing formats when putting data on clipboard
- 21 March 2012
The topic is from a forum discussion at https://web.archive.org/web/20131020094354/http://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/94bb2db4-3ca2-4cd8-9f7c-6dd9aab6fd18/need-help-to-complete-gdi-program-to-loadsave-to-clipboard?forum=windowssdk
Generally an application should provide data in as many formats as possible so more applications can recognize the data. For example, IE stores text data in CF_UNICODETEXT, CF_TEXT and CF_HTML formats.
What’s new in Windows 8 Developer Preview SDK headers
- 17 September 2011
This is by no means a complete list but just some observation on files that caught my eye. Some are just regular header file updates for Windows 7 and does not necessary require Windows 8. Some other APIs moved to header files with more readable names.
Improvements are focused, of course, in natural input, efficiency, gaming experience and IE. You can hear the silence scream of “Tablet!Tablet!Tablet!” here. Note Windows 8 is still a developer preview and there is no guarantee any new feature will survive the final cut or there won’t be new API for existing features add in Beta/RC/Gold.
Application crash when forcing IE8 rendering mode in webbrowser host
- 17 November 2010
User stephench is reporting that when setting webbrowser rendering mode to IE8 via FEATURE_BROWSER_EMULATION, the app would crash. The web site crashes IE8 too, but IE8 is able to recover and automatically switch to IE7 mode, while a webbrowser host crash in WinInet when switching to the compatibility mode (Note the ReloadInCompatView function on the call stack). My guess is that reloading requires a WinInet helper process which a webbrowser host app does not have. The call stack is the following urlmon.dll!UUIDToWSTR() + 0x1f bytes urlmon.dll!GUIDToWSTR() + 0x1a bytes urlmon.dll!GUIDToWSTRCch() + 0x16 bytes urlmon.dll!CInPrivateBrowserModeFilter::_EnsureCLSID() + 0x20 bytes urlmon.dll!CSessionBrowserModeFilter::_GetDataStream() + 0x27 bytes urlmon.dll!CBrowserModeFilter::_EnsureBrowserModeFilter() + 0x1d84 bytes urlmon.dll!CBrowserModeFilter::IsIE7Mode() + 0x2e bytes mshtml.dll!CMarkup::ReloadInCompatView() + 0xd0 bytes mshtml.dll!CCssPageLayout::CalcSizeVirtual() + 0x120416 bytes mshtml.dll!CLayout::CalcSize() + 0x164 bytes mshtml.dll!CLayout::DoLayout() + 0x113 bytes mshtml.dll!CView::ExecuteLayoutTasks() - 0x1e376 bytes mshtml.dll!CView::EnsureView() + 0x567 bytes mshtml.dll!CView::EnsureViewCallback() + 0x66 bytes mshtml.dll!GlobalWndOnMethodCall() + 0xcc bytes mshtml.dll!GlobalWndProc() + 0xae bytes user32.dll!_InternalCallWinProc@20() + 0x28 bytes user32.dll!_UserCallWinProcCheckWow@32() + 0xb7 bytes user32.dll!_CallWindowProcAorW@24() + 0x51 bytes user32.dll!_CallWindowProcA@20() + 0x1b bytes mfc100.dll!_AfxActivationWndProc(HWND__ * hWnd=0x00150a28, unsigned int nMsg=32770, unsigned int wParam=0, long lParam=0) Line 471 + 0x11 bytes C++ user32.dll!_InternalCallWinProc@20() + 0x28 bytes user32.dll!_UserCallWinProcCheckWow@32() + 0xb7 bytes user32.dll!_DispatchMessageWorker@8() + 0xdc bytes user32.dll!_DispatchMessageA@4() + 0xf bytes > mfc100.dll!AfxInternalPumpMessage() Line 183 C++ mfc100.dll!CWinThread::Run() Line 629 + 0x7 bytes C++ mfc100.dll!AfxWinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x00152348, int nCmdShow=1) Line 47 + 0x7 bytes C++
How to force popup window to navigate in the same window in a webbrowser control
- 22 November 2009
When clicking on an link that targets a new window, the default behavior of a webbrowser control host application is to open a new window in Internet Explorer. User ben_lai wants to know how to handle the click and navigate to the same window.
There are three events that notifies a new window, NewWindow (The current documentation of this event is wong, check http://support.microsoft.com/kb/185538/EN-US/ for the parameters of the event), NewWindow2 and NewWindow3, each one has a cancel parameter to stop the new window being created, though for NewWindow2, it requires cooperation of BeforeNavigate2 to get the url of the new window. After getting the url, the navigation can be carried out in the original window by calling Navigate2. The obsolete NewWindow Event has the url right in the parameter so you can cancel the navigation and call the navigation methods of the webbrowser control with the new url.
Getting local FTP home directory from IIS programmatically
- 22 November 2009
User xiaoc1026 wants to know how to access IIS to get the home directory of the FTP web site in Visual C++.
Before IIS6 you need to access the metadata in IIS configuration via IMSAdminBase::GetData. The hard part to find the path of the IIS setting. Before IIS 6, the metadata isn’t saved in XML. However you can search the path of a property though the admin script. You can find the path property from the IIS metadata propertiy reference documentation.
Intercept the download dialog in webbrowser control
- 04 November 2009
User rsd102 looks already find the solution to his question when he posted the question to CSDN, except for one missing piece. The sample he found is for overriding the global download manager, and what he need is a process wide override.
It looks like rsd102 is loving research. He found more than he can understand initially. After being suggested twice with the vague IE SDK documentation he decided to post the sample code he was working on. And when the final answer was given he had problem adopting it.
Make the webbrowser control styled the same way as the hosting application
- 27 October 2009
User wtx_sonery wants to know whether it is possible to style the webbrowser control with the rest of the application.
The answer is yes, you can implement IDocHostUIHandler’s GetHostInfo method and return DOCHOSTUIFLAG_THEME in the host flags.
How to change the user agent and download control flags in a webbrowser control host
- 09 October 2009
User vnetvvv wants to know how to change the user agent string in a VB6 webbrowser control.
The knowledge base article PRB: WebBrowser Control Clients Share Global Settings provides the necessary code for changing the user agent of the webbrowser control when the webbrowser ask for it. But how to have the webbrowser control ask for the user agent?
How to disable navigation sound in webbrowser control
- 06 July 2009
User kill211 does not like the click sound when he calls WebBrowser.Navigate. He wonders if there is a way to disable it without modifying HKEY_CURRENT_USER\AppEvents\Schemes\Apps\Explorer\Navigating, which has effect on other applications.
Unfortunately, the API for disabling sound is introduced in IE7. The FEATURE_DISABLE_NAVIGATION_SOUNDS feature can be toggled using registry or the CoInternetSetFeatureEnabled API.
Links
- 03 February 2009
Today’s link spam:
New warning message in MFC9:Warning: Creating dialog from within a COleControlModule application is not a supported scenario. Comments: when people takes the time to add a warning, there must be a reason.
Detect if a MSI component is installed
- 24 March 2008
A C# program for those who don’t know MSI SDK or C++. C++ programmers can find the API inside the msi.h file in Windows SDK.
Memory Leak in the Internet Explorer WebBrowser Control
- 28 February 2007
For automated applications such as parsers, the WebBrowser control may not be appropriate. Under IE4 there were several memory leak problems manifested when the control was repeatedly instantiated and destroyed and also, on occasions, when the control was merely navigated from page to page. Almost all of these problems were fixed and incorporated in the IE5 release. However new memory leaks were introduced in the script engine, the URL navigation history, and the security system. There is no word at this time on when these problems will be fixed. Unfortunately, some leaks ( the travel log that enable you to go back, for example) have been declared to be “by design” by the development team. For those applications where this is not possible it may be necessary for the customer to use a WebBrowser control from a non-Microsoft vendor that is designed for the type of long term continuous real-time activity that your are developing for.
If you need a similar interface, try the Mozilla ActiveX Control (I know little about it, so I am not sure it leaks memory or not) at https://web.archive.org/web/20010920144243/http://www.iol.ie/~locka/mozilla/control.htm. Apparently, you need to have Mozilla installed to use this Activex control. A hosting sample can be found at https://web.archive.org/web/20030422065641/www.codeproject.com/useritems/iemozilla.asp .
Jiangsheng’s CSDN Digest (200604)
- 03 April 2006
I have been summarizing my CSDN posts since 2004. The last article of this kind is “Jiangsheng’s CSDN Digest(April 3, 2006)” (https://web.archive.org/web/20060701050541/http://blog.csdn.net/jiangsheng/archive/2006/04/03/648980.aspx), including following discussions:
web autocomplete using AJAX
Win32 & .Net Q&A 200512
- 24 December 2005
I would like to keep tracking some interesting CSDN discussions, but sometimes I can not find them due to the limit of the CSDN favorite and the CSDN full text search. So again I list some interesting discussions here. For details about the discussion, go to http://search.csdn.net and search posts by their topics. For previous Q&A discussions
MSXML4的文档对象的async属性默认是真,这时候Load是异步的,要等待对象触发事件再访问文档内容。也可以把文档的async属性设置成false切换到同步模式,这样Load调用之后就可以读DOM了。
创建和自动化Internet Explorer和资源管理器窗口
- 20 October 2005
下载示例工程 - 34 Kb jiangsheng/Samples
我在很久之前就开始用程序自动化Shell窗口——主要对象是IE窗口。有时浏览器控件或者MFC类CHTMLView可以满足我的需要,但是很多时候我需要从头嵌入浏览器控件并且尽可能模拟IE的行为,例如实现IDocHostUIHandler来启用自动完成功能。一个很自然的替代方案是直接操作IE窗口。
Win32 & .Net Q&A 200509
- 22 September 2005
I would like to keep tracking some interesting CSDN discussions, but sometimes I can not find them due to the limit of the CSDN favorite and the CSDN full text search. So again I list some interesting discussions here. For details about the discussion, go to http://search.csdn.net and search posts by their topics. For previous Q&A discussions, see my blogs Win32 & .Net Q&A and VC/MFC Q&A 200407 . A topic may appear in these Q&A blogs more than once, but I will try to cover every interesting discussion if I can.
我们知道在电源选项 属性 里面可以设置
集成桌面搜索,模拟器
- 24 August 2005
This is a revised version of an earlier blog at http://blog.joycode.com/jiangsheng/archive/2005/07/19/59725.aspx, published July 19, 2005. The source code is available at jiangsheng/Samples
微软的桌面搜索API推出也有一段时间了,但是网上可以找到的相关技术资料还不多。官方的资料在https://web.archive.org/web/20051030062212/http://addins.msn.com/devguide.aspx可以看到,而且网页上有SDK和一个C#的示例供下载。
Error 3e6 with WriteFile
- 27 June 2005
It looks like you will get error 3E6 when you call write file with an address not aligned to DWORD.
Update: Raymond Chen explained the reason in his blog https://devblogs.microsoft.com/oldnewthing/20250605-00/?p=111250, basically Windows SDK requires aligned pointers, except for those decorated with UNALIGNED. E.g.
在使用浏览器控件的程序中判断HTTP错误
- 07 April 2005
在自动化浏览器控件提交表单之后,浏览器控件可能会在浏览超时时重定向到一个错误页面。有时需要用代码控制页面返回之后重新提交表单。
IE6.0之前的版本浏览器控件没有获得HTTP状态的接口。一个很依赖于网站设置的方法是,捕获TitleChange事件,在页面标题包含”找不到页面”或者”Page Not Found”之类的字符串时,认为浏览失败。另一个方法是处理BeforeNavigate2事件,用winhttp api单独和服务器连接,使用HttpQueryInfo来查询,相应参数是HTTP_QUERY_STATUS_CODE。在这之前,你可能要在打开URL时用INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP | INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS标志来防止服务器的重定向。
Win32 & .Net Q&A
- 28 February 2005
问《VC++技术内幕》第四版p217,关于线程和MFC书上说,不允许在线程之间共享MFC对象(此原则不适用于直接从CObject派生的对象或者是简单的类),那么我想在一个线程中打开一个txt文件并向里面写数据可否这样做:
其中CString g_strSavepath;是一个全局变量。
IStream接口和CString之间的转换
- 24 January 2005
问:如何传递CString中包含的字符串到具有IStream类型参数的函数?
问:如何根据获得的IStream接口指针获得字符串?
编程控制Modem/PPPoE拨号连接
- 23 January 2005
在Windows中拨号上网(包括MODEM和PPPoe),一般都是用Windows平台提供的的Remote Access Service(RAS,远程访问服务):https://learn.microsoft.com/en-us/windows/win32/rras/about-remote-access-service 。其中的连接操作函数(https://learn.microsoft.com/en-us/windows/win32/rras/ras-connection-operations)可以用于对拨号连接进行操作。比较常用的几个函数是RasDial、RasHangUp、RasEnumConnection和RasGetConnectStatus,以及自定义的通知处理函数(https://learn.microsoft.com/en-us/windows/win32/rras/notification-handlers)。
Windows XP/2003内建了对PPPoe拨号连接的支持,参考 https://learn.microsoft.com/en-us/windows/win32/rras/point-to-point-protocol-over-ethernet-connections 。
限制应用程序的实例数目
- 22 January 2005
某些应用程序处理紧缺资源,例如可擦写光驱、串口或者大量内存,通常不希望这种应用程序的多个实例同时运行。
实际上你没有办法限制用户只能启动一次。你可以做到的是在应用程序启动之后查找是否用户启动了另一个实例。如果没有找到现存的实例,应用程序以正常方式启动。否则,通常的处理是退出。
编程控制活动桌面,用ActiveX控件来增强桌面的功能
- 22 January 2005
活动桌面处理和一个例子 (https://web.archive.org/web/20010503055645/http://www.vckbase.com/vckbase/vckbase10/vc/nonctrls/atlcomocx_02/1002001.htm)讲述了使用IActiveDesktop接口可以做到的事情。
活动桌面允许在桌面上显示HTML网页,这也意味着我们可以在桌面上的项目中以在网页中使用ActiveX控件来对网页进行扩展的方式来提供丰富的内容。但是不建议在桌面上使用不安全的控件,例如Windows Media Player 6.0。
Good Bye MFC?
- 12 December 2004
原文地址在https://web.archive.org/web/20041204071945/https://channel9.msdn.com/ShowPost.aspx?PostID=31152
起源是VC开发组的一个人的言论“MFC仅仅用于支持旧的代码,新的代码不应该用MFC编写,而是应该用C#或者Managed C++”
动态屏蔽Control+Alt+Delete(Update)
- 25 July 2004
我曾经编写过一篇关于动态屏蔽Control+Alt+Delete的文章。数月之后我把文章的英文修订版发在了CodeProject(https://web.archive.org/web/20081015201511/http://www.codeproject.com/system/preventclose.asp)。但是当时我并未发现代码在调试环境下崩溃的原因。在很长时间之后,我看到Antonio Feijao在他最近发表的一篇文章之中用C重写了这个代码,并且添加了一些注释说明了编译器设置可能出现的问题。我认为这篇文章对我的文章的读者也是很有用的,所以准备在我的文章中添加他的文章的链接。
文章介绍:
VC/MFC Q&A 200407
- 13 July 2004
问:自编浏览器进入一个网页后,点一个链接后系统自动调用用IE打开网页而不是用自身浏览器打开网页。如何让窗口用我自己的浏览器打开?
答:参考控制新的窗口。默认情况下,浏览器收到创建新窗口请求时,会在IE中打开新的窗口。你可以处理NewWindow2事件来在自己指定的窗口中打开请求的页面。
在应用程序中添加宏支持的注意事项 (Update)
- 27 June 2004
用笔记本用多了,PC键盘用起来不是很习惯了。
在我的一篇文章脚本化浏览器中描述了如何在应用程序中添加宏支持。在添加支持的时候需要注意的是,宏的运行环境——VBS脚本引擎——目前只支持变体数据类型。这造成的一个结果就是当你的应用程序触发一个事件的时候,如果其参数并不都是变体数据类型,那么你编写的宏不是总会被调用。解决的方法是总是声明你的事件参数为变体数据类型。
跨进程访问共享内存的权限问题
- 24 June 2004
问:
我在服务器上用 CreateFileMapping 创建了一段共享内存。让这个exe始终在服务器上跑。同时,别的用户在客户端用IE访问服务器,将要查询的数据通过C#制作的网页提交上来,服务器得到网页参数后,建立一个COM对象访问上一个exe的共享内存,然后将在共享内存中的查询结果返回给客户。问题是现在这个COM无法用openmapping访问exe的共享内存,提示 访问拒绝 。而我在服务器上随便建议一个工程编译成exe,文件就可访问这段共享内存!!为何在网页中就不成?COM难道要有什么权限设置.两个进程之间的权限整合方法是什么?怎么用DACL?
重新启动服务
- 23 June 2004
最近常去的论坛挂了,看起来是IIS进程系统资源占用太多了;服务器管理员又度周末去了,不能重启IIS,郁闷。CSDN服务器的IIS可能重启过于频繁了,分论坛页面经常来不及更新,自己发的帖子出现在列表里面的时候已经沉了,还是郁闷。
微软知识库文章Q194916 Restarting Web Services and Scheduled Tasks with a Batch File(https://www.betaarchive.com/wiki/index.php/Microsoft_KB_Archive/194916)中描述了定时用命令行重新启动IIS的方法,有想偷懒的网管可以试试。平台SDK中包含工具的SC.exe可以对服务进行更加详细的配置。
编程删除IE历史
- 01 April 2004
明天出发去西雅图参加微软全球最有价值专家年会了,暂停更新一段时间。
在你调用IUrlHistoryStg:DeleteUrl 之后, 这个URL项目仍旧会出现在IE历史纪录目录中。
VC编程经验总结第一版完成
- 23 March 2004
该活动由bluebohe发起,CSDN网友积极参与,sgnaw (李逍遥)整理。发布之后反响强烈,但是很多人并未全部看完帖子就留下自己的邮件索取文件……其实下载地址就在第三个回复里面。
文件可以从这里下载 https://web.archive.org/web/20040405025034/http://bluebohe.go.nease.net/vc2004.chm
列表视图自动KillTimer的问题
- 10 March 2004
来自http://expert.csdn.net/expert/Topicview2.asp?id=2751134的讨论。
可以参考Knowledge Base article Q200054: PRB: OnTimer() Is Not Called Repeatedly for a List Control。基本上ListView的默认消息处理是会调用KillTimer的,所以在处理你自己的Timer消息的时候不要调用默认的处理程序。
Ask Mr JS
- 10 March 2004
[url=http://community.csdn.net/expert/Topicview2.asp?id=2732377]xml 支持 模糊 查询吗?[/url]
可以用XPath来进行节点的选择
自定义在RichEdit中插入对象的图标
- 04 March 2004
方法基本同Knowledge Base文章Q220844 HOWTO: Insert a Bitmap Into an RTF Document Using the RichEdit Control (https://jeffpar.github.io/kbarchive/kb/220/Q220844/)
只是在最后插入之前调用一下IOleCache::SetData,用一个HGLOBAL作为参数,HGLOBAL里面的数据是一个METAFILEPICT结构,包含自己提供的图片
DAO拥有ADO/ADOx/JRO所没有的东西(也许从不会有!
- 27 February 2004
转自 http://www.trigeminal.com/usenet/usenet025.asp?2052
微软很清楚地把ADO定位为DAO的替换……许多微软的代理认为DAO 就是DOA(Dead On Arrival(到达即死),在美国,这是一个术语,用来描写那些希望获救的人在救护车刚到达,要抢救他们时,他们就死了)。然而,在DAO中,许多核心函数功能时被支持的,而ADO/ADOx/JRO 却不被支持,而且甚至可能从未被支持,因为微软似乎正把用户推向其他方向。而Jet本身不会“死”,很清楚,它不再是一个策略平台,所以,在Jet中,似乎不只是要有足够的兴趣使工作做得更有效了。 对于全记录,这里是一个DAO有而ADO没有的所有能力表:
让msxml4导出的文本xml缩进和换行
- 06 February 2004
[url=http://expert.csdn.net/expert/Topicview2.asp?id=2637982]讨论链接[/url] 问起过好多次的问题了,手头正好在做XML的生成,就写了一下 其实,缩进和换行就是文本,在需要的位置创建文本节点就可以了。另外一个方法就是用SAX来写
可以这么写出来
分析MFC中的映射
- 05 January 2004
MFC中大量使用了BEGIN_XXX_MAP这样的宏,以及映射进行查找优化,例如消息映射,OLE命令映射,以及接口等等。每个映射包含一个指向基类的映射的指针。这样,当一个类需要根据一定的条件查找一个对象时,它会查找本类对象,如果没有找到,那么会查找基类,直到根基类。这类查找包含Windows消息,命令,事件和OLE命令的分发,和对象实现的接口的查询等等。
下面是函数BOOL CWnd::OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult)的部分代码,演示了如何根据消息的ID查找处理函数。
Ask Mr JS
- 18 December 2003
[url=http://expert.csdn.net/expert/Topicview2.asp?id=2562836] 如何访问 WebBrowser 控件中的XML源码[/url]
总结:注意使用IHtmlDocument::get_Script(唯一的一个方法@_@bb)就可以获得脚本的顶层对象,然后就可以用GetIdsOfNames开始遍历文档结构了
Ask Mr JS
- 16 December 2003
[url=http://community.csdn.net/expert/Topicview2.asp?id=2542812]怎样修改theApp.m_pszAppName[/url]
总结:可以参考微软知识库Q154744
Ask Mr JS
- 12 December 2003
[url=http://community.csdn.net/expert/Topicview2.asp?id=2535830]关于DAO和多线程的问题 [/url]
总结:放弃希望吧,你们这些使用过时技术的人
在Windows2000中动态禁用/启用Ctrl-Alt-Delete
- 09 November 2003
来自CSDN论坛VC/MFC版的讨论 在NT/2000中怎么禁用Ctrl+Alt+Delete?(不能用gina,键盘驱动)(此帖已归档,可以在http://search.csdn.net 搜索此帖)
本文的更新信息位于http://blog.joycode.com/jiangsheng/archive/2004/07/20/27909.aspx
ASF学习笔记 Part 2
- 26 September 2003
使用回调方法
一些Windows Media Format SDK的接口的方法是异步执行的,很多这样的方法使用回调方法和应用程序通讯。
ASF学习笔记 Part 1
- 25 September 2003
一个设置是一个ASF的配置(configuration)的描述数据集合。一个设置必须至少包含一个流的配置设置。
设置中的流信息包含流的比特率(bit rate),缓冲窗口和媒体属性的设置。视频和音频的流信息准确描述了文件中的媒体配置,包括压缩数据使用的编码和解码器(如果有的话)。
摆脱在每个命令消息处理函数中的TRY和CATCH
- 02 August 2001
每个命令处理都可能导致异常,抛出异常通常导致终止当前命令处理。在每个命令处理过程中编写异常处理代码是一个十分繁琐的工作,由于命令是CCmdTarget::OnCmdMsg中处理的,所以可以这个函数中处理所有命令处理过程产生的异常而不用分别编写异常处理函数。
CCccXCommandHandler是一个基于CCmdTarget的类(参考使用单独的命令处理类来处理命令消息)。此示例可推广到所有CCmdTarget的派生类。
使用单独的命令处理类来处理命令消息
- 02 August 2001
适用于有很多命令处理函数的对象,以及共享命令处理函数。
应用程序的主窗口通常要处理许多命令消息。这会使文件变得很大,不容易查找。为明确起见,可以将对象对命令消息的处理抽象出来,做成一个(这里是一个,但是可以按用途分成多个)类。