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
相关问答:
13个人围成一圈,从第一个人开始顺序报号1,2,3。凡报到3者退出圈子,找出最后留在圈子中的人原来的序号
结果应该是13 可我的程序的结果是11 希望好心人帮改一下
#include <stdio.h>
#include < ......
C\C++如何计算函数的导数,本人新手,想写个程序,但是不知道如何下手,还望高手指点一二,谢过。
这个……
跟函数的具体形式有关吧,难道你想编出个“万能”的求导函数?
俺上学时想过自动推导公式,后来 ......
你们现在还在用C吗?C有前途吗?
一定,并永远坚持
引用
一定,并永远坚持
顶
有用。
楼主何出此言
楼主来c版问这个问题是踢馆用意吗哈哈
越来越冷是肯定的,完全淘汰倒也没那么容易
c ......
用这本书入门怎么样呢 跟谭浩强的相比如何? 谢谢
我把这本看了几篇,确实很好的书。就不要拿它跟 谭 的书比了, 谭 的书要照顾全国读者。
不可同日而语
一个是国外的,一个是国内的
学完c primer ......