问题描述
我正在尝试构建一个示例Win32 Exe应用程序,我在其中从C:\ProgramFiles(x86)\文件夹加载msvcr90.dll。但这是在抛出错误。我的目的是从应用程序的路径而不是C:\ Windows \ WinSxS文件夹加载msvcr90.dll。但是不能这样做。
我尝试过:
I am trying to build a sample Win32 Exe Application in which I am loading msvcr90.dll from C:\ProgramFiles(x86)\ folder. But it is throwing error. My purpose is to load msvcr90.dll from application's path instead of C:\Windows\WinSxS folder. But not able to do so.
What I have tried:
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;
}
推荐答案
LoadLibrary(LC:\\Program Files(x86)\\< myapp> \\< myapp1> \\ msvcr90.dll);
dwError = GetLastError();
LoadLibrary(L"C:\\Program Files (x86)\\<myapp>\\<myapp1>\\msvcr90.dll");
dwError = GetLastError();
您提供的路径无效('<'
和'>'$ c $路径中不允许使用c。)
您明显忽略 GetLastError
返回值。
You are providing an invalid path ('<'
and '>'
are not allowed in paths).
You are plainly ignoring the GetLastError
return value.
这篇关于无法从本地路径加载msvcr90.dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!