您的位置:首页 > 其它

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

2004-08-21 14:19 721 查看
Blog是你的个人专栏,技术问题请到社区提出。非技术文章请勿胡乱勾选技术类别,这次我帮你改了,下次再犯直接删除。——管理员。

有如下程序:

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

#include "stdafx.h"
#include

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)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  windows 测试 struct blog c