易截截图软件、单文件、免安装、纯绿色、仅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\C++如何计算函数的导数

C\C++如何计算函数的导数,本人新手,想写个程序,但是不知道如何下手,还望高手指点一二,谢过。
这个……

跟函数的具体形式有关吧,难道你想编出个“万能”的求导函数?

俺上学时想过自动推导公式,后来 ......

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

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

不可同日而语

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

学完c primer ......

C学位你发基础该干啥?

  现在谭浩强的C语言已经快学忘了,但都是很基础的东西感觉,不能干什么,要想再提升接下来干点啥好
编点小工具,再学数据结构

看看课后习题

如果学c的话,看《the c programming language》,是c语言的 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号