<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Code Library &#187; dll</title>
	<atom:link href="http://www.ucosoft.com/tag/dll/feed" rel="self" type="application/rss+xml" />
	<link>http://www.ucosoft.com</link>
	<description>Free Source Code and Program Tips</description>
	<lastBuildDate>Mon, 19 Jul 2010 04:51:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>CComModule in porting ATL DLL project to VC8</title>
		<link>http://www.ucosoft.com/ccommodule-in-porting-atl-dll-project-to-vc8.html</link>
		<comments>http://www.ucosoft.com/ccommodule-in-porting-atl-dll-project-to-vc8.html#comments</comments>
		<pubDate>Fri, 22 Jun 2007 01:33:15 +0000</pubDate>
		<dc:creator>support</dc:creator>
				<category><![CDATA[Win32/MFC]]></category>
		<category><![CDATA[ATL]]></category>
		<category><![CDATA[dll]]></category>
		<category><![CDATA[MS-KB]]></category>
		<category><![CDATA[VC6]]></category>
		<category><![CDATA[VC8]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.ucosoft.com/2007/06/22/ccommodule-in-migrating-atl-dll-project-to-vc8.html</guid>
		<description><![CDATA[When migrating an ATL project from vc6 to vc8, you will get a problem about CComModule. Problem: In vc6, there is such a declaration in stdafx.h as: extern CComModule _Module; and in the main module: CComModule _Module; But when you complie it in vc8, the following errors apears: c:\temp\myatl\stdafx.h(24) : error C2146: syntax error :]]></description>
			<content:encoded><![CDATA[<p>When migrating an ATL project from vc6 to vc8, you will get a problem about CComModule.</p>
<p><strong>Problem</strong>:</p>
<p>In vc6, there is such a declaration in stdafx.h as:<br />
<coolcode lang="cpp" linenum="no">extern CComModule _Module;</coolcode></p>
<p>and in the main module:</p>
<p><coolcode lang="cpp" linenum="no">CComModule _Module; </coolcode></p>
<p>But when you complie it in vc8, the following errors apears:<br />
<coolcode lang="cpp" linenum="no"><br />
c:\temp\myatl\stdafx.h(24) : error C2146: syntax error : missing &#8216;;&#8217; before identifier &#8216;_Module&#8217;<br />
c:\temp\myatl\stdafx.h(24) : error C4430: missing type specifier &#8211; int assumed. Note: C++ does not support default-int<br />
c:\temp\myatl\stdafx.h(24) : error C4430: missing type specifier &#8211; int assumed. Note: C++ does not support default-int<br />
</coolcode></p>
<p><strong>Solution</strong>:</p>
<p>In ATL 7.0, which is the ATL version that is included in Visual C++ .NET and in Visual C++ 2005, the <strong>CAtlBaseModule</strong> class has replaced the obsolete <strong>CComModule</strong> class.</p>
<p>Microsoft has given the solution in KB309705 &#8211; &#8220;_AtlBaseModule.m_hInst replaces _Module.m_hInst in ATL 7.0&#8243; </p>
<p><a href="http://support.microsoft.com/kb/309705/ ">http://support.microsoft.com/kb/309705/ </a></p>

	Tags: <strong><a href="http://www.ucosoft.com/tag/atl" title="ATL" rel="tag">ATL</a>, <a href="http://www.ucosoft.com/tag/dll" title="dll" rel="tag">dll</a>, <a href="http://www.ucosoft.com/tag/ms-kb" title="MS-KB" rel="tag">MS-KB</a>, <a href="http://www.ucosoft.com/tag/vc6" title="VC6" rel="tag">VC6</a>, <a href="http://www.ucosoft.com/tag/vc8" title="VC8" rel="tag">VC8</a>, <a href="http://www.ucosoft.com/tag/visual-studio" title="Visual Studio" rel="tag">Visual Studio</a></strong><br />

	<ul class="st-related-posts">
	<li><a href="http://www.ucosoft.com/some-useful-shortcut-of-visual-studio-6.html" title="Some useful shortcut of Visual Studio 6 (November 30, 2006)">Some useful shortcut of Visual Studio 6</a> (0)</li>
	<li><a href="http://www.ucosoft.com/visual-sourcesafe-microsofts-source-destruction-system.html" title="Some comment about Visual SourceSafe (November 21, 2006)">Some comment about Visual SourceSafe</a> (0)</li>
	<li><a href="http://www.ucosoft.com/microsoft-visual-c-tips-and-tricks2.html" title="Microsoft Visual C++ Tips (November 21, 2006)">Microsoft Visual C++ Tips</a> (0)</li>
	<li><a href="http://www.ucosoft.com/make-the-code-completion-working-again-in-vc-60.html" title="Make the Code Completion working again in VC++ 6.0 (December 6, 2006)">Make the Code Completion working again in VC++ 6.0</a> (0)</li>
	<li><a href="http://www.ucosoft.com/install-global-hook-without-dll.html" title="Install global hook without dll (January 3, 2007)">Install global hook without dll</a> (2)</li>
	<li><a href="http://www.ucosoft.com/how-to-enable-profile-in-vc-6.html" title="How to enable &#8220;profile&#8221; in Visual C++ 6.0 (December 28, 2006)">How to enable &#8220;profile&#8221; in Visual C++ 6.0</a> (1)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.ucosoft.com/ccommodule-in-porting-atl-dll-project-to-vc8.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install global hook without dll</title>
		<link>http://www.ucosoft.com/install-global-hook-without-dll.html</link>
		<comments>http://www.ucosoft.com/install-global-hook-without-dll.html#comments</comments>
		<pubDate>Wed, 03 Jan 2007 09:14:37 +0000</pubDate>
		<dc:creator>support</dc:creator>
				<category><![CDATA[Win32/MFC]]></category>
		<category><![CDATA[dll]]></category>
		<category><![CDATA[hook]]></category>
		<category><![CDATA[message]]></category>

		<guid isPermaLink="false">http://www.ucosoft.com/archives/66.html</guid>
		<description><![CDATA[Chinese version author: peach@newsmth.net Userally, when you install a global hook, you need a dll. But now, you can install WH_KEYBOARD_LL or WH_MOUSE_LL global hook without dll&#8217;s help. The following code was tested under win2k3. And I it will also run on 2k/xp. #define _WIN32_WINNT 0400 #define STRICT #define WIN32_LEAN_AND_MEAN #include #include #include DWORD g_main_tid]]></description>
			<content:encoded><![CDATA[<p><P>Chinese version author: peach@newsmth.net</P><br />
<P>Userally, when you install a global hook, you need a dll. But now, you can install WH_KEYBOARD_LL or WH_MOUSE_LL global hook without dll&#8217;s help.</P><br />
<P>The following code was tested under win2k3. And I it will also run on 2k/xp.
<p>
<span id="more-66"></span><br />
<coolcode lang="cpp" linenum="no" download="src_hook_without_dll.c"><br />
#define _WIN32_WINNT    0400<br />
#define STRICT<br />
#define WIN32_LEAN_AND_MEAN</p>
<p>#include <stdio.h><br />
#include <stdlib.h><br />
#include <windows.h></p>
<p>DWORD   g_main_tid  = 0;<br />
HHOOK   g_kb_hook   = 0;</p>
<p>BOOL CALLBACK con_handler (DWORD)<br />
    {<br />
        PostThreadMessage (g_main_tid, WM_QUIT, 0, 0);<br />
        return TRUE;<br />
    };</p>
<p>LRESULT CALLBACK kb_proc (int code, WPARAM w, LPARAM l)</p>
<p>    {<br />
        PKBDLLHOOKSTRUCT p = (PKBDLLHOOKSTRUCT)l;<br />
        const char *info = NULL;<br />
        if (w == WM_KEYDOWN)<br />
            info = &#8220;key dn&#8221;;<br />
        else if (w == WM_KEYUP)<br />
            info = &#8220;key up&#8221;;<br />
        else if (w == WM_SYSKEYDOWN)<br />
            info = &#8220;sys key dn&#8221;;<br />
        else if (w == WM_SYSKEYUP)<br />
            info = &#8220;sys key up&#8221;;</p>
<p>        printf (&#8220;%s &#8211; vkCode [%04x], scanCode [%04x]\n&#8221;,<br />
            info, p->vkCode, p->scanCode);<br />
        //  always call next hook<br />
        return CallNextHookEx (g_kb_hook, code, w, l);</p>
<p>    };</p>
<p>int main (void)<br />
    {<br />
        g_main_tid = GetCurrentThreadId ();<br />
        SetConsoleCtrlHandler (&#038;con_handler, TRUE);</p>
<p>        g_kb_hook = SetWindowsHookEx (<br />
            WH_KEYBOARD_LL,<br />
            &#038;kb_proc,<br />
            GetModuleHandle (NULL), //ã€€It shouldn&#8217;t be NULL, or will fail<br />
            0);</p>
<p>        if (g_kb_hook == NULL)</p>
<p>        {<br />
            fprintf (stderr,<br />
                &#8220;SetWindowsHookEx failed with error %d\n&#8221;,<br />
                ::GetLastError ());<br />
            return 0;<br />
        };</p>
<p>        // The message loop is necesarry</p>
<p>        MSG msg;<br />
        while (GetMessage (&#038;msg, NULL, 0, 0))<br />
        {<br />
            TranslateMessage (&#038;msg);<br />
            DispatchMessage (&#038;msg);<br />
        };<br />
        UnhookWindowsHookEx (g_kb_hook);<br />
        return 0;<br />
    };<br />
</coolcode></p>

	Tags: <strong><a href="http://www.ucosoft.com/tag/dll" title="dll" rel="tag">dll</a>, <a href="http://www.ucosoft.com/tag/hook" title="hook" rel="tag">hook</a>, <a href="http://www.ucosoft.com/tag/message" title="message" rel="tag">message</a></strong><br />

	<ul class="st-related-posts">
	<li><a href="http://www.ucosoft.com/what-is-the-usage-of-wm_null.html" title="What is the usage of WM_NULL? (November 23, 2006)">What is the usage of WM_NULL?</a> (0)</li>
	<li><a href="http://www.ucosoft.com/ucospy.html" title="ucoSpy,a system enhancement tool like spy++ (November 22, 2006)">ucoSpy,a system enhancement tool like spy++</a> (0)</li>
	<li><a href="http://www.ucosoft.com/solution-crash-in-release-build-with-self-defined-message.html" title="Solution: Crash in Release build with self-defined message (November 28, 2006)">Solution: Crash in Release build with self-defined message</a> (0)</li>
	<li><a href="http://www.ucosoft.com/intermittent-work-in-ui-thread-2.html" title="Intermittent work in UI thread (October 16, 2007)">Intermittent work in UI thread</a> (0)</li>
	<li><a href="http://www.ucosoft.com/intermittent-work-in-ui-thread.html" title="Intermittent work in UI thread (October 16, 2007)">Intermittent work in UI thread</a> (0)</li>
	<li><a href="http://www.ucosoft.com/how-to-sendpost-message-to-cdocument.html" title="How to send/post message to CDocument? (October 24, 2007)">How to send/post message to CDocument?</a> (2)</li>
	<li><a href="http://www.ucosoft.com/how-to-hook-the-file-related-event.html" title="How to hook the file related event (June 22, 2007)">How to hook the file related event</a> (0)</li>
	<li><a href="http://www.ucosoft.com/events-when-click-ontaskbar.html" title="How to catch the events when click on the app icon on taskbar (September 24, 2008)">How to catch the events when click on the app icon on taskbar</a> (0)</li>
	<li><a href="http://www.ucosoft.com/ccommodule-in-porting-atl-dll-project-to-vc8.html" title="CComModule in porting ATL DLL project to VC8 (June 22, 2007)">CComModule in porting ATL DLL project to VC8</a> (0)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.ucosoft.com/install-global-hook-without-dll.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
