关于测试一个windows动态链接库的问题;请教各位大侠!

王朝system·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

有如下程序:

// test1.cpp : Defines the entry point for the console application.

//

#include "stdafx.h"

#include <windows.h>

int main(int argc, char* argv[])

{

printf("Hello World!\n");

typedef int(*pSleep)(long sleepTime);

HINSTANCE hDLL;

pSleep psleep;

HDLL=LoadLibrary("D:\\广东省建设银行\Sleep\sleep\Debug\sleep.dll");//加载动态链接库sleep.dll文件;

psleep=(pSleep)GetProcAddress(hDLL,"sleep");

for (int i=0;i<3;i++){

printf("Sleeping for %d seconds\n", i);

psleep(300);

}

FreeLibrary(hDLL);//卸载MyDll.dll文件;

return 0;

}

编译是为何报这个错:

D:\广东省建设银行\Sleep\test1\test1.cpp(15) : error C2440: '=' : cannot convert from 'struct HINSTANCE__ *' to 'int'

This conversion requires a reinterpret_cast, a C-style cast or function-style cast

Error executing cl.exe.

test1.obj - 2 error(s), 0 warning(s)

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航