想获得包含资源的模块句柄
但因没用MFC所以不能用AfxGetResourceHandle函数
用GetResourceHandle(NULL),编译提示“error C2065: 'GetResourceHandle' : undeclared identifier”
不知是否需要#include什么头文件?或者有其他解决方法?谢谢!

解决方案 »

  1.   

    #include "cluadmex.h" (MSDN)

      

  2.   

    Header: Declared in cluadmex.h.
      

  3.   

    谢谢楼上两位回复,加上#include "cluadmex.h"了还是一样,是否要加什么dll?
      

  4.   

    我是在VC6.0 MFC环境下测试的,你可以把你的project->settings->Use MFC in a Shared dll
    然后 Use AfxGetResourceHandle。。
      

  5.   

    试了汪洋的办法,还是报告error C2065: 'afxGetResourceHandle' : undeclared identifier
    不知AfxGetResourceHandle需要#include什么
    手上没有MSDN 
    见笑了
      

  6.   

    因为程序不是用MFC写的,用了#include "AFXWIN.H"就不能用"#include <windows.h>",
    这样一来出现的问题就更多了我是想把音频资源集成到.exe中,使用
    PlaySound(MAKEINTRESOURCE(IDR_WAVE1), AfxGetResourceHandle(), D_FILENAME|SND_ASYNC);
    实现,请问在不用MFC的情况下是否还有其他函数可以代替其中的AfxGetResourceHandle()?
      

  7.   

    有朋友建议用PlaySound(MAKEINTRESOURCE(IDR_WAVE1), GetModuleHandle(NULL), SND_RESOURCE);
    试了下,编译链接可以通过,但是.exe一运行就报错,自动关闭
      

  8.   

    用GetLastError看看什么错误,查一MSDN上GetModuleHandle(LPCTSTR lpModuleName)的用法吧。。
      

  9.   

    查了下,GetModuleHandle是VB的API,看来是不能用
      

  10.   

    不知是否还有其他实现方法?不用MFC的话
    谢谢赐教