Jiangsheng的CSDN Digest(March 4, 2006)(2)
如何在regedit中打开特定的键并选中一个的指定的值(VC/MFC 基础类)
我想在程序中,调用regedit.exe打开一个特定的键,并且一个特定的值被选中.请问如何做才好.
就像在regmon中双击listview中的一项就能用regedit定位到相应的值上
write your own viewer, or use Win32 API to automate the regedit window( code may vary in different version of Windows.)
see http://support.microsoft.com/kb/178665
我的控件变量ip地址不能正确显示(VC/MFC 网络编程 )





































//这里把32位二进制换成字符串
in_addr in;
in.S_un.S_addr = g_dwLocalIP;
m_IP.Format("%s", ::inet_ntoa(in));//然后赋给给控件变量,直接赋也不正确,控件变量是CString!
显示是204.204.204.204
204=0xCC
这说明
1 变量没有初始化
2 你没有检查函数调用的返回值判断调用是否成功
::GetAdaptersInfo(pAdapterInfo,&ulLEN);
pAdapterInfo= (PIP_ADAPTER_INFO)::GlobalAlloc(GPTR,ulLEN);
=>
::GetAdaptersInfo(pAdapterInfo,&ulLEN);//获取需要的缓冲区大小
pAdapterInfo= (PIP_ADAPTER_INFO)::GlobalAlloc(GPTR,ulLEN);//分配缓冲区
::GetAdaptersInfo(pAdapterInfo,&ulLEN);//获取信息
关于IHTMLDocument2接口的问题(.NET技术 C# )
我想设计一个win32对话框,点击对话框里面一个按钮,就用ie打开一个新窗口,那个窗口可以用那个IHTMLDocument2对象控制。
这样能不能用那个open方法做?
You need to create a COM object with the CLSID CLSID_INTERNETEXPLORER or progid internet.application
reference:
You will need to create a WinForm application instead of Console application.
The DLL you will need is SHDocVw.DLL. To avoid name conflict, use AXIMP.EXE to generate your wrappers. Then, use ILDASM do disassemble the wrappers for both. Once you have that, you can recompile the IL for ShDocVw.dll (the one that AXIMP
generated) into another assembly with a different name. Then, you should be able to do the same with the IL for AxShDocVw.dll, adding a reference to the new dll that you just compiled. You should then be able to have these in your directory and use them no problem.
Better if you can program in managed C++.
如何更改xml节点的属性(VC/MFC HTML/XML )
xml文件的格式如下:




















小弟现在想要修改<enabled>...</enabled>的属性的值
1 可以用正则表达式进行文本替换
2 可以用MSXML DOM或者SAX将文件读入,之后进行修改后写回
参见
http://www.codeproject.com/string/use_regular_expression_in_your_program.asp
http://www.perfectxml.com/CPPMSXML/20020710.asp
WriteProcessMemory后,目标进程异常 (VC/MFC 进程/线程/DLL )
1. 程序A 用CreateProcess产生程序B的 M个实例。
2. 当程序B的 实例1 的某一页(为可读可写页)发生改变后,这时程序A用WriteProcessMemory把这一页写到其它M-1个实例中。
3.程序B中有一个查看按钮,单击此按钮会引用到刚才修改的页,平时一切正常,但当程序A中的 WriteProcessMemory执行后,点击此按钮,当前正在执行的实例就会终止运行。
4.通过一些内存查看软件观察,数据其实已经被写入到该页中。
5.我用FPE,发现程序A的WriteProcessMemory执行后,用FPE观察指定页,然后点击fpe上的“刷新”,这时再点击实例中的查看按钮,实例就不会中止了。
6.只想在ring3下解决这个问题,不想用ring0下修改pte绕过copy on write的办法。
a common mistake is trying to access the stack in another process.
如何替换windows启动时的登陆窗口(VC/MFC 基础类)
我想实现用自己的界面来替换windows的登陆窗口,如何实现?
或者说windows启动到桌面之前,先加载我定制的窗口界面,类似网吧客户机那种效果
http://msdn.microsoft.com/library/en-us/secauthn/security/supporting_new_logon_protocols.asp
LPCITEMIDLIST类型的数据如何能做到序列化(VC/MFC 基础类)
我想了两个方案,一转换为路径cstring再序列化.二.从cobject继承,实现一个CLPCITEMIDLIST,不知道行不行
你可以获得pidl的绝对路径之后再序列化。pidl中的数据仅作目录中临时定位用,并不能保证在程序关闭之后仍然有效。
微软的DrawCli例子中如何实现下列功能(VC/MFC 基础类)
问题1:我用例子上画矩形的方法画了一个矩形,这个矩形是如何被拖动的。用到哪些关键函数? 拖动效果是靠画了有擦,擦了再画的方式实现的吗?
问题2:我又添加了一个ToolBar,然后在上面添加了一个按钮。我想一点击此按钮就能在当前窗体上画一个2行2列的表格。此表格应该像矩形一样可以托拽。
1 DrawCli用的是CRectTracker,也就是画了再擦的技术。
2 添加一个自定义的shape,并且设计对应的Tool(就是鼠标和键盘处理啦)
一组还是一个对象,完全看你的数据组织方式。比如矩形,也可以看作4条线,也可以看作很多个点的集合,但是这里作为一个对象处理。你的表格,虽然是很多线条,当然也可以看作一个对象处理,在没有类的年代都可以,有了类只不过更简单了。比如,你可以定义一个CTable类来处理你的表格,可以包装表格大小,可以绘制自己,也可以处理创建、拖动等操作。
DoModal()返回-1(VC/MFC 基础类)
我的一个基于MFC对话框的程序.里面有CWebBrowser和CShockwaveFlash控件,在一台新装的机器上运行程序的时候InitInstance()里的Domodal()函数直接返回-1 ,对话框都没显示出来...重装系统前还可以用的
Shockwave Flash is not present in a fresh machine.
ask your user to go to www.macromedia.com/go/getflashplayer to download one, or pack a recent version of flash player in your setup program.
怎么通过应用程序产生ctrl+alt+delete的sas消息(VC/MFC 进程/线程/DLL )



























































































当前用户需要对登录桌面有DESKTOP_READOBJECTS权限
紧急!!!window.external 我在vc程序实现了自己的接口,但是ie本身的却没有了。(VC/MFC 网络编程)
我用vc,实现了ie的getexternal接口,在网页中可以访问到vc的函数了。但是,ie本身的接口却没有了,如addfavorite,showbrowserui.
关于addfavorte, 前天搜索了一下,一个高手介绍了可以发送消息 message=wm_command, wparam=2261给浏览器窗口。是可以实现的得了,但是其他的接口如showbrowserui等又如何解决。
可以把原来的external对象的IDispatch接口保存下来,getidsofnames和invoke的时候转发一下就可以了。showbrowserui是你自己要实现的……你还要实现一个external对象,需要支持的属性包括menuarguments 和 Shell UI helper的全部属性。






然后,在自己实现的 GetIDOfNames及Invoke中,对于不是自定定义的函数直接调用
m_pShell->GetIDOfnames(....)及m_pShell->Invoke(....).
其中有个问题需要注意,就是如果在GetIfOfnames中,如果你给rgDispId赋值则可能跟ie内置函数的id重复,如调试中我得到showbrowserui的dispid=13。此时,需要通过另外变量辨别是默认函数或者是自定义函数了。
http://support.microsoft.com/kb/183339/
http://www.codeguru.com/cpp/com-tech/atl/article.php/c3565/
http://www.codeproject.com/atl/multidisp.asp
WinInet依赖IE,如果程序读取网页后关闭程序再打开程序,它还会从cache里读取内容么 (VC/MFC 基础类)
有的参数可以禁止从cache读取.我的意思是,在不使用这些参数的前提下,什么情况使程序直接从网上读取网页而不从cache读取?
可以肯定的是下面这些情况:
如果打开程序,读取网页,再次读取网页肯定是从cache读;如果从IE读取网页,然后再用程序读,肯定是从cache读
我想知道的是:如果读取网页后关闭程序再打开程序,它还会从cache里读取网页么?如果读取网页后重新启动操作系统,再打开程序,它还会从cache里读取网页么?
http返回的响应头里包含了下载文件的大小,时间,可以得到这个值和本地的文件大小、时间比较的
IE is based on WinInet.search URLDownloadToFile and URLDownloadToCacheFile in MSDN
CString遇"undeclared identifier"的问题(CLR) (.NET技术 VC.NET )
首先我是用vc.net开了一个CLR项目,可能会出现混合库的问题,这个问题现在还不知道怎么描述
1、最初使用cstring时,告知"error C2065: 'CString' : undeclared identifier"
2、看了一些文档后,增加#include "afx.h",提示"fatal error C1189: #error : Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]D:\xp\Microsoft Visual Studio 8\VC\atlmfc\include\afx.h24"
3、又看了一些文档,有些人推荐用string 代替cstring,故使用
String ^jc = gcnew String(pHeader->m_pReportV3[i].m_szName);
提示"The pointer passed in as a String must not be in the bottom 64K of the process's address space."
混合库用/CLR可以,但是用MFC的话得要有CWinApp对象,而这个对象又封装了应用程序的入口,所以建议还是用MFC的程序向导生成程序
vc.net lnk2001 unresolved external symbol int _cdecl func1(int) (?func1@@JOYAHH@Z) (.NET技术 VC.NET )
在vc++6中 使用a.h ,a.lib 和a.dll调用函数func1没有任何问题
在vc.net(vs2003.net)中总是报如题错误。
Calling a C function from a C++ program without using extern "C" (which causes the compiler to use the C naming convention) can cause LNK2001. Compiler options /Tp and /Tc cause the compiler to compile files as C or C++, respectively, regardless of the filename extension. These options can cause function names different from what you expect. Also, calling a function with parameter types that do not match those in the function declaration can cause LNK2001. There is currently no standard for C++ naming between compiler vendors or even between different versions of a compiler. Therefore, linking object files compiled with other compilers may not produce the same naming scheme and thus cause error LNK2001.
reference
http://msdn.microsoft.com/library/en-us/vccore/html/_error_Name_Decoration.asp
请问在服务程序中如何知道Windows已登录? (.NET技术 VC.NET )
下面的代码列出控制台用户的用户名
Topic in microsoft.public.vc.language
FindWindow() to terminal service clients

















































































































