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 < ......
在ue中从远程unix用二进制方式下载c文件到本地,修改之后用二进制方式上传到unix中,再用vi打开该文件,每行后面就会有一个^M的换行符,如果采用ascii方式下载,二进制方式上传的话就没有^M,那请问这样会对程序文件 ......
想知道每条指令或函数的系统消耗。比如系统执行int a=0;的开销是多少。有没有类似的文档之类的。不要和我说用什么clock()函数来测试。我想要相关总结好的文档
先反汇编,然后拿着cpu的指令手册查每条指令的时间周期 ......
'\108'作为字符常量对不对?
转义字符'\ddd'表示3位8进制所代表的字符。 但是108不是正确的8进制表示方法,因此应该是错误的。
但是char a='\108'; 为什么编译不出错呢?
\108 没超过 ......