%1不是有效的win32应用程序错误 [英] %1 is not a valid win32 application error
本文介绍了%1不是有效的win32应用程序错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了64位exe和32位com ...我在某些网站建议的注册表中进行了必要的更改..
现在CoCreateInstance正在返回:
HRESULT_FROM_WIN32(ERROR_BAD_EXE_FORMAT):%1不是有效的Win32应用程序。 HRESULT
能告诉我为什么上面提到的错误。
我尝试了什么:
I Created a 64 bit exe and 32 bit com dll ... i did neccesary changes in registry as suggested by some site ..
now CoCreateInstance is returning :
HRESULT_FROM_WIN32(ERROR_BAD_EXE_FORMAT) : %1 is not a valid Win32 application. HRESULT
Could you please let me know why the error came which is mentioned above.
What I have tried:
int _tmain(int argc, _TCHAR* argv[])
{
ICMATHCAUCULATOR *pMathcalci = nullptr;
HRESULT hr;
CoInitialize(NULL);
hr = CoCreateInstance(CLSID_CMATHCAUCULATOR, NULL, CLSCTX_LOCAL_SERVER, IID_ICMATHCAUCULATOR, (void**)&pMathcalci);
if (SUCCEEDED(hr))
{
cout << "function is called" << endl;
double drresult = 0.0;
pMathcalci->SumofTowNumbers(10.0, 50.0, &drresult);
cout << " value is " << drresult << endl;
}
CoUninitialize();
return 0;
}
exe是64位dll是32位
exe is 64 bit dll is 32 bit
推荐答案
你是如何注册你的COM dll?
默认使用64位版本的RegSvr32,你需要使用32位版本。
见https://support.microsoft.com/en-us/kb/249873 [ ^ ]
这里有一般的信息:流程互操作性(Windows) [< a href =https://msdn.microsoft.com/en-us/library/windows/desktop/aa384231(v=vs.85).aspx\"target =_ blanktitle =New Window> ^ ]
How did you register your COM dll?
By default the 64-bit version of RegSvr32 is used and you need to use the 32-bit version.
See https://support.microsoft.com/en-us/kb/249873[^]
And here is some general information: Process Interoperability (Windows)[^]
除非我误解了文档,否则你不能这样做。请参阅流程互操作性(Windows) [ ^ ]:
在64位Windows上,64位进程无法加载32位动态链接库(DLL)。此外,32位进程无法加载64位DLL。
Unless I misunderstood the documentation, you cannot do that. See Process Interoperability (Windows)[^]:
On 64-bit Windows, a 64-bit process cannot load a 32-bit dynamic-link library (DLL). Additionally, a 32-bit process cannot load a 64-bit DLL.
这篇关于%1不是有效的win32应用程序错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文