动态加载DLL

心代码片断:

void CLoadLibraryTestDlg::OnLoad() 
{
    typedef int (WINAPI * MyFun)(HWND,LPCTSTR,LPCTSTR,UINT);
    MyFun fun=NULL;
    HINSTANCE hHandle;
    hHandle=LoadLibrary("user32.dll");
    fun=(int (WINAPI *)(HWND,LPCTSTR,LPCTSTR,UINT))::GetProcAddress(hHandle,"MessageBoxA");
    if(fun!=NULL)
    {
        fun(NULL,"hahahahahahahaha","success :)",MB_OK);
    }
}

你可能感兴趣的:(user,null,dll,fun,winapi)