extern "C" const ÎÊÌâ
³õѧWINDOWS API
extern "C" const IMAGE_DOS_HEADER __ImageBase;
void DumpModule(){
HMODULE hModule = GetModuleHandle(Null);
_tprintf(TEXT("with GetModuleHandle(NULL)= 0x%x\r\n"),hModule);
_tprintf(TEXT("with __ImageBase= 0x%x\r\n"),(HINSTANCE)&__ImageBase);
}
int main(int argc, char* argv[])
{
DumpModule();
return 0;
}
Àý×Ó±àÒë³ö´í£¬µÚÒ»¾ä¾ÍÓÐÎÊÌ⣬²»Ã÷°×Ϊʲô£¿£¿
C/C++ code:
#include<windows.h>
#include<tchar.h>
#include<stdio.h>
extern "C" const IMAGE_DOS_HEADER __ImageBase;
void DumpModule()
{
HMODULE hModule = GetModuleHandle( NULL );
_tprintf( TEXT( "with GetModuleHandle(NULL)= 0x%x\r\n" ),hModule );
_tprintf( TEXT( "with __ImageBase= 0x%x\r\n" ),( HINSTANCE )&__ImageBase );
}
int main( int argc, char* argv[] )
{
DumpModule();
return 0;
}
If this parameter is NULL, GetModuleHandle returns a handle to the file used to create the calling process (.exe file).
¸øGetModuleHandle£¨£©´«µÝnull »ñÈ¡calling processµÄ¾ä±úÊÇÄãµÄ±¾ÒâÂð Äã˵µÄ³ö´íÊÇÕâ¾äÂð£¿
__ImageBaseÔÚÄĶ¨ÒåµÄ
C/C++ code
Code
Ïà¹ØÎÊ´ð£º
QQȺ 29152388
ÓÑÇéUP
°ï¶¥
up
°ïup
up Ö§³Ö£¡
up jf
...ÄѵÀÓзÖ..?
up up up
Ï£ÍûÓеüӷ֣¬¹þ¹þ¡£
Ö§³Ö£¬ÎÒ¼ÓÁË£¬Ï£ÍûÂ¥Ö÷ÄܼÓÎÒ£¬¹²Í¬Ñ§Ï°¹þ
¼ÓÁË¡£
¶¥ÉÏ£¬Ã¿ÌìÊÕ»ñÒ»µã£¬Ö§³Ö ......
±àÒëÆÕͨµÄcûÎÊÌâ°¡£¬µ«±àÒëjavahÉú³ÉµÄ¾Í±¨´í£º
gcc -O0 -g3 -Wall -c -fmessage-length=0 -oHelloWorld.o ..\HelloWorld.c
gcc -otest.exe HelloWorld.o
d:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../. ......
6ÔÂ5ÈÕÏûÏ¢£¬XXÍøÕ¾ÈÕÇ°ÆÀ³öÁË10Ïî´óÊÆÒÑÈ¥µÄ¼ÆËã»ú¼¼Êõ¡£ÆäÖУ¬ÓÐЩ¼¼ÊõÒѾ±»ÌÔÌ£¬ÓÐЩ¼´½«±»ÌÔÌ¡£ÈçÖøÃûµÄCobolÓïÑÔ£¬ÒÔ¼°IBMµÄOS/2ϵͳ¡£
¡¡¡¡ÒÔÏÂΪXXÍøÕ¾ÆÀ³öµÄ±»ÌÔ̵Ä10Ïî¼ÆËã»ú¼¼Êõ£º
¡¡¡¡ ......
ÓÃÕâ±¾ÊéÈëÃÅÔõôÑùÄØ ¸úÌ·ºÆÇ¿µÄÏà±ÈÈçºÎ£¿ лл
ÎÒ°ÑÕâ±¾¿´Á˼¸Æª£¬È·ÊµºÜºÃµÄÊé¡£¾Í²»ÒªÄÃËü¸ú Ì· µÄÊé±ÈÁË£¬ Ì· µÄÊéÒªÕÕ¹ËÈ«¹ú¶ÁÕß¡£
²»¿ÉͬÈÕ¶øÓï
Ò»¸öÊǹúÍâµÄ£¬Ò»¸öÊǹúÄÚµÄ
ѧÍêc primer ......
VC ++ 6.0 visual studio 2003 ÓëC ++ ÓÐʲôÇø±ð <ѧVC֮ǰһ¶¨ÒªÑ§C++Âð£¿
²»¹ýÎÒÂòµÄÊ鶼ЩºÚ¿Í±à³ÌµÄ,ºÜÉÙÌáµ½MFCµÄ,ÊéÉϵÄÔ´ÂëÄ ......