随笔分类 -  Windows

摘要:IntroductionArrrgh! So you need to run your console app via a primary application, well ye've come to the right place. This article is intended for those who need to run one of those pesky little console applications without the console window popping up over your main app or worse popping up wh 阅读全文
posted @ 2012-06-29 13:57 瓜蛋 阅读(277) 评论(0) 推荐(0) 编辑
摘要:OverviewCProcessData is a template class that makes it easy to use data allocated in a different process, and is useful when making inter-process SendMessage/PostMessage calls.Example Scenario - 1Imagine that you are sending a DTM_SETSYSTEMTIME message to a Date/Time picker control in a different pr 阅读全文
posted @ 2012-06-29 13:48 瓜蛋 阅读(341) 评论(0) 推荐(0) 编辑
摘要:估计很多人都知道装载DLL过程中的多线程死锁是因为DllMain的顺序调用规则,但是很少人了解卸载DLL过程中的多线程死锁也是由于同样的原因。例如,如果一个DLL的DllMain的代码写成下面的形式,且进程中有至少一个DLL的DllMain没有调用DisableThreadLibraryCalls函数的话,那么卸载该DLL过程中就会因为DllMain的顺序操作特性带来DLL内部线程没有完全退出的错误。 //----------------------start ------------HANDLE g_thread_handle =NULL; // 该DLL内部线程的句柄... 阅读全文
posted @ 2012-06-12 00:28 瓜蛋 阅读(4043) 评论(1) 推荐(1) 编辑
摘要:1.1 链表元素CRuntimeClass当达到RTTI的能力必须要达到一种能力就是在构建类的时候记录必要信息,以建立型录。型录中的类住处最好以链表的形式存。链表元素将以 CRuntimeClass描述struct CRuntimeClass{// Attributes LPCSTR m_lpszClassName; int m_nObjectSize; UINT m_wSchema; // schema number of the loaded class CObject* (PASCAL* m_pfnCreateObject)(); // NULL => abstract class 阅读全文
posted @ 2012-03-22 20:16 瓜蛋 阅读(2332) 评论(0) 推荐(0) 编辑
该文被密码保护。
posted @ 2012-03-19 16:39 瓜蛋 阅读(7) 评论(0) 推荐(0) 编辑
摘要:原谅连接:http://www.codeguru.com/cpp/w-p/ce/controls/article.php/c3509/CCeButtonST-v12.htmThe reference control for MFC flat buttons with text and icons. Give your CE applications a professional look!Environment:eMbedded VC++ 3.0, Windows CE 3.0AbstractCCeButtonST is a class derived from MFC CButton cla 阅读全文
posted @ 2012-03-12 14:59 瓜蛋 阅读(682) 评论(0) 推荐(0) 编辑
摘要:原谅链接:http://www.codeguru.com/Cpp/controls/buttonctrl/article.php/c5157I think some of you may not like the buttons in Windows. Sometimes, I think they're ugly. Fortunately, we can change the appearance of our buttons by overriding the DrawItem function of the CButton class. I 'm going to dem 阅读全文
posted @ 2012-03-10 11:35 瓜蛋 阅读(484) 评论(0) 推荐(0) 编辑
摘要:转自http://www.functionx.com/visualc/controls/bmpbtn.htmA bitmap button is a button that display a picture or a picture and text on its face. This is usually used the button a little explicit. There are two ways you can create a bitmap button: with or without an existing resource identifier.A bitmap b 阅读全文
posted @ 2012-03-07 17:02 瓜蛋 阅读(518) 评论(0) 推荐(0) 编辑
摘要:#pragma onceclass CDBOp {public: bool ReConnect(); bool CloseConnect(); bool OpenConnect(CString hostName, CString dBName, CString userName, CString password); bool GetItemData(CString itemID, float &price, CString &descript); //取存储过程数据,这里只是举例说明 CString GetErrorMsg(); CDBOp(); virtual ~CDBOp 阅读全文
posted @ 2012-02-24 10:19 瓜蛋 阅读(992) 评论(0) 推荐(1) 编辑
摘要:五.使用TCHARTCHAR是一种字符串类型,它让你在以MBCS和UNNICODE来build程序时可以使用同样的代码,不需要使用繁琐的宏定义来包含你的代码。TCHAR的定义如下:#ifdef UNICODEtypedef wchar_t TCHAR;#elsetypedef char TCHAR;#endif所以用MBCS来build时,TCHAR是char,使用UNICODE时,TCHAR是wchar_t。还有一个宏来处理定义Unicode字符串常量时所需的L前缀。#ifdef UNICODE#define _T(x) L##x#else#define _T(x) x#endif##是一个 阅读全文
posted @ 2011-12-23 21:33 瓜蛋 阅读(518) 评论(0) 推荐(1) 编辑
摘要:字符基础--SBCS、MBCS、Unicode所有的 string 类都是以C-style字符串为基础的。C-style 字符串是字符数组。所以我们先介绍字符类型。这里有3种编码模式对应3种字符类型。第一种编码类型是单子节字符集(single-byte character set or SBCS)。在这种编码模式下,所有的字符都只用一个字节表示。ASCII是SBCS。一个字节表示的0用来标志SBCS字符串的结束。第二种编码模式是多字节字符集(multi-byte character set or MBCS)。一个MBCS编码包含一些一个字节长的字符,而另一些字符大于一个字节的长度。用在Wind 阅读全文
posted @ 2011-12-23 21:01 瓜蛋 阅读(382) 评论(0) 推荐(0) 编辑
摘要:1、预备知识临界区非常适合同一进程中对数据的串行访问,它的速度很快。然而,也许你想要使某些应用程序与机器中的其它事件或者其它进程取得同步,这时你就要使用一些核心对象来同步线程。核心对象包括: .进程 .线程 .文件 .文件变化通知(File Change notification) .控制台输入(Console input) .互斥量(Mutex) .信号量(Semaphore) .事件(Event)每个对象在任何时候都可以处于两种状态之一:有信号(Signaled)和无信号(not signaled)。线程能被置于睡眠状态直到一个对象变成有信号的。线程主要使用下面两个函数来使自己睡眠,以便等 阅读全文
posted @ 2011-10-24 22:59 瓜蛋 阅读(340) 评论(0) 推荐(0) 编辑
摘要:2008-09-16 14:54 1049人阅读 评论(1) 收藏 举报 __cdecl和__stdcall都是函数调用规范(还有一个__fastcall),规定了参数出入栈的顺序和方法,如果只用VC编程的话可以不用关心,但是要在C++和Pascal等其他语言通信的时候就要注意了,只有用相同的方法才能够调用成功.另外,像printf这样接受可变个数参数的函数只有用cdecl才能够实现. __dec... 阅读全文
posted @ 2011-08-20 21:55 瓜蛋 阅读(485) 评论(0) 推荐(0) 编辑
摘要:char :单字节变量类型,最多表示256个字符, wchar_t :宽字节变量类型,用于表示Unicode字符, 它实际定义在<string.h>里:typedef unsigned short wchar_t。 为了让编译器识别Unicode字符串,必须以在前面加一个“L”,定义宽字节类型方法如下: wchar_t c = `A' ; wchar_t * p = L"Hello!" ; wch... 阅读全文
posted @ 2011-08-16 21:16 瓜蛋 阅读(384) 评论(0) 推荐(0) 编辑
摘要:去年12月粗粗的也算看完了,这次是仔仔细细的看了一遍,感觉完全和上次不一样啊。不过这次看得有些章节也不太懂,有些也淡淡的读了一下没有深究,唉,留着以后用的时候再深究吧。还有些内容不太清楚,待我以后再慢慢研究,比如:Unicode,子窗口控制,非模态对话框,剪贴板等。下一步该是我进攻下册的时候了。虽然这本书已经老了,可我觉得,仍然有必要再读一遍。 阅读全文
posted @ 2011-05-19 15:36 瓜蛋 阅读(305) 评论(2) 推荐(0) 编辑
摘要:本来一个项目运行得好好的,我重新生成了一下,结果再运行就出现错误,“没有找到mfc42d.dll,因此这个应用程序未能启动”。我从网上下了mfc42d.dll,放到system32目录下,这个错误是没有了,可是又接着出现了错误,”没有找到MSVCR90D.dll,因此这个应用程序未能启动”。在网上搜了下,主要有这样的解决方法:http://blog.csdn.net/zgjxwl/archive/2008/04/29/2344676.aspx将debug模式改为Release,然后在Release模式下可以正常的编译连接和运行.为什么会这样呢,因为release模式下,程序是不会去链接 *.d 阅读全文
posted @ 2011-05-17 15:21 瓜蛋 阅读(393) 评论(0) 推荐(0) 编辑
摘要:VC++里面定义字符串的时候,用_T来保证兼容性。VC++支持ascii和unicode两种字符类型,用_T可以保证从ascii编码类型转换到unicode编码类型的时候,程序不需要修改。如果将来你不打算升级到unicode,那么也不需要_T。_t("hello world")在ansi的环境下,它是ansi的,如果在unicode下,那么它将自动解释为双字节字符串,既unicode编码。这样做的好处,不管是ansi环境,还是unicode环境,都适用。那么在VC++中,字符串_T("ABC")和一个普通的字符串"ABC"有什么区别呢 阅读全文
posted @ 2011-03-23 00:02 瓜蛋 阅读(628) 评论(0) 推荐(0) 编辑
摘要:首先看一下msdn是怎样定义它们的吧,可不要搞错啊:The SetWindowLong function changes an attribute of the specified window. The function also sets the 32-bit (long) value at the specified offset into the extra window memory.Note This function has been superseded by the SetWindowLongPtr function. To write code that is compat 阅读全文
posted @ 2011-02-26 12:16 瓜蛋 阅读(3696) 评论(0) 推荐(0) 编辑
摘要:Impressions on Impressions on MFC vs Qt ProgrammingWritten by Pascal AudouxTranslated and improved by Philippe FremyAfter putting this article on the web, it has received the following critics :It is not very well writtenMFC problems are not very well describedThere is no code examplesQt is praised 阅读全文
posted @ 2011-02-16 21:10 瓜蛋 阅读(895) 评论(3) 推荐(0) 编辑