易截截图软件、单文件、免安装、纯绿色、仅160KB

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


相关问答:

c基础

#include <string.h>
#include <stdio.h>

void main()
{
int i;
char buf[]="abcde";
strncpy(buf,"abc",3);
for(i=0;i <5;i++)
printf(&q ......

一个简单的c游戏

13个人围成一圈,从第一个人开始顺序报号1,2,3。凡报到3者退出圈子,找出最后留在圈子中的人原来的序号
结果应该是13 可我的程序的结果是11 希望好心人帮改一下
#include <stdio.h>
#include < ......

两个C文件的问题

以前在VC里面建一个工程,都只用一个 .c 文件,昨天在一个工程里用了两个 .c文件了,遇到问题了,请大家指点。比如:
File1.c Fil ......

大家觉得 C Primer Plus 这本书怎么样呢?

用这本书入门怎么样呢  跟谭浩强的相比如何? 谢谢
我把这本看了几篇,确实很好的书。就不要拿它跟 谭 的书比了, 谭 的书要照顾全国读者。

不可同日而语

一个是国外的,一个是国内的

学完c primer ......

C如何调用PHP函数

如题,请知道的高手指点一下,THANKS
PHP函数都是用C实现的~
反其道而行之~

HOHO,关键是,自已再去实现这个功能累啊,PHP有现成的就直接调用好了,

顶起,有高手点解一下,或者是我直接将PHP 源码中的 .c ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号