无法从本地路径加载msvcr90.dll

时间:2017-02-21 11:20:05

标签: visual-c++ loadlibrary

我正在尝试构建一个示例Win32 Exe应用程序,其中我从C:\ ProgramFiles(x86)\文件夹加载msvcr90.dll。但这是在抛出错误。 我的目的是从应用程序的路径而不是C:\ Windows \ WinSxS文件夹加载msvcr90.dll。但是不能这样做。

代码段: -

int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
                     _In_opt_ HINSTANCE hPrevInstance,
                     _In_ LPTSTR    lpCmdLine,
                     _In_ int       nCmdShow)
{
    UNREFERENCED_PARAMETER(hPrevInstance);
    UNREFERENCED_PARAMETER(lpCmdLine);

    // TODO: Place code here.
    MSG msg;
    HACCEL hAccelTable;

    // Initialize global strings
    LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
    LoadString(hInstance, IDC_DEMO_LOAD_EXE, szWindowClass, MAX_LOADSTRING);
    MyRegisterClass(hInstance);

    // Perform application initialization:
    if (!InitInstance (hInstance, nCmdShow))
    {
        return FALSE;
    }

    DWORD dwError = 0;
    SetLastError(dwError);
    LoadLibrary(L"C:\\Program Files (x86)\\<myApp>\\<myApp1>\\msvcr90.dll");
    dwError = GetLastError();


    hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_DEMO_LOAD_EXE));

    // Main message loop:
    while (GetMessage(&msg, NULL, 0, 0))
    {
        if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }

    return (int) msg.wParam;
}

在dwError中我收到126错误

0 个答案:

没有答案