I have built an application using VC++ 2015, It is an MFC application I set the project "Cahracter Set= Not set" so I don't need Unicode version.
My application uses ADO to connect to database so
try {
HRESULT hr = m_pConnection.CreateInstance(__uuidof(adoNS::Connection));
if (SUCCEEDED(hr)) {
MessageBox(TEXT("CreateInstance succeeded!"));
}
catch (_com_error& e) {
MessageBox(e.Description());
}
catch (...) {
MessageBox(TEXT("OnNewDocument Exception!"));
}
So another handling above. When I build the project it runs fine on my computer Windows 7 x64. But If I run the application on another windows 7 I don't get any exception, no CreateInstance succeeded!??
So The problem is with ADO library how can I figure it out please?
After some search I have Copied the folder ADO from the the target machine (another computer running windows 7 x86) to my Computer (with win7 x64) and VS2015. Now I imported this new ADO library:
#import "C:\Users\User7\Desktop\MyMfcProg\ado\msado15.dll" \
rename_namespace("adoNS") \
rename("EOF", "adoEOF")
Now if I build it runs fine one both machines! So what is the problem there? Should I link to ADO of each target computer? or the problem just concerns ADO 64 bit and ADO 32 bit?
If so I have an ADO on my win7 x64:
C:\Program Files (x86)\Common Files\System\ado
I linked to it but the same problem?
Related
Recently I wrote a program with VS2019, invoking Tesseract OCR dll compiled in C++ (x64) and display result on a .NET Windows form. Everything works fine on my Windows 10 dev PC. When deployed to Windows Server 2012 (x64), it crashed, complaining that the C++ dlls are not found.
What I tried:
Install vc_redist.x64.exe from Microsoft, it's still not work. (Maybe not enough?)
Run a simple .NET windows form program on that server, and it works well. (It's not a .NET problem)
Update:
I used Dependency Walker that #Fenixil suggested, and the dlls below are not found:
API-MS-WIN-CORE-KERNEL-32-PRIVATE-L1-1-1.DLL
API-MS-WIN-CORE-PRIVATEPROFILE-L1-1-1.DLL
API-MS-WIN-SERVICE-PRIVATE-L1-1-1.DLL
MF.DLL
MFPLAT.DLL
MFREADWRITE.DLL
API-MS-WIN-CORE-SHUTDOWN-L1-1-1.DLL
EXT-MS-WIN-NTUSER-UICONTEXT-EXT-L1-1-0.DLL
IESHIMS.DLL
SETTINGSYNCPOLICY.DLL
WLANAPI.DLL
Those dlls can be found in my dev PC, in C:/Windows/WinSxS, multiple files in same name under different directory. Do they belong to some Windows SP update, or are they in the Win10 platform API? What's the best way to install them instead of simply copying them to production server?
There are multiple versions of vc_redist, you need to provide one that is used in your application. Here is some discussion with vc_redist not found, might be related to your issue.
You can use Dependency Walker tool to check which dlls are missing in the system
I am trying to port a Qt project that I have developed on Linux first. It is the first time that I'm experiencing building on Windows, and the fact that I could not solved the problem might come from a very obvious missing thing.
The Windows configurations I tried until now are the next one:
Windows 10 with Qt 5.8 MSVC 2015, Windows Kit 10, Qt Creator 4.5
Windows 7 SP1 with Qt 5.8 MSVC 2015, Windows Kit 10, Qt Creator 4.6
With both configs, I obtain an executable file that can be successfully run on the host machine, but when I deploy the application on freshly installed Windows 10, the application starts for few seconds and then stops(/crashes?). However, neither error messages, nor recoveries dialog, nor event log are showing up anything.
On freshly installed Windows 7 SP1, I get an error message saying that the entry point for CreateFile2 couldn't be find. I know that this function has been added since Windows 8, but I cannot understand why the application is built with such a entry point although I define the _WIN32_WINNT as follow in my .pro file:
DEFINES += "_WIN32_WINNT=0x0601"
I tried to the WINVER definition as well, without success:
DEFINES += "WINVER=0x0601"
I assumed no DLL were missing using a dependency software available at this git. I also tried the "more than depreciated" Dependency Walker, which didn't show missing libs.
By advance, thank you to the Windowsians who will save me!
Okay, I figured out that one of the static libraries my project is using, and that I compiled through VS 2017 was containing the CreateFile2 reference (using dumpbin.exe). I recompiled it using the right _WIN32_WINNT value, and also fresh-recompiled the Qt project. However, the CreateFile2 reference is still present.
Eventually, I found the problem!
The problem was coming from this external library I was building aside, and then linking to my final app in static mode. After rebuilding the external lib with the correct _WIN32_WINNT, it worked!
Hope this topic will help winnoob like me :)
I did an application with Qt5.5, wich use open cv.
It works, so now I want to deploy it on several computers.
On the first PC (PC1), it works too : I copied the dll of Qt and open cv and add the paths in the environment variables. I copied a folder with my application, some dll and datas (images).
On the second PC (PC2), I did the same, but I can't open the application. I have the error "msvcp120d.dll is missing..".
I compiled my app in release mode.
On my PC and PC1 I moved msvcp120d.dll on the desk, and the app don't request it.
Do you know why the app asks a debug dll?
I soon installed the redistribuables packages visual C++ (x64 and x86) on PC2, but it doesn't install msvcp120d.dll.
Do you have an other idea?
thanks'
It seems like some of the libraries that you are using is linking against a Debug CRT library (indicated by the trailing d in "msvcp120d.dll"). Those aren't redistributable, and are only available on systems, where Visual Studio is installed.
I would recommend to use dependency walker to find out which dlls/libraries that need the debug version and then recompile them as release configuration.
I've been using the CppShellExtContextMenuHandler sample project from Microsoft's All-In-One framework to add a custom menu item + icon to windows's context menu.
However, it seems that I can't register the DLL provided by this sample on other computers than mine. The DLL, compiled on a Windows 7 x86 machine from unmodified code, doesn't run on:
Another Windows 7 x86
A fresh Windows XP SP3 x86 install on VirtualBox
I get:
LoadLibrary(CppShellExtContextMenuHandler.dll) Failed to find
specified procedure
(translated) on the XP machine
The module "CppShellExtContextMenuHandler.dll"
failed to load.
Make sure the binary is stored at the specified path or debug it to check for problems with the binary or dependent .DLL files.
The specified module could not be found
on the other Windows 7 machine
I use Regsvr32 CppShellExtContextMenuHandler.dll in the commandline to register the DLL.
Did anyone encounter this problem? Did I miss something (dependencies/project config)?
I'm not sure how to debug this one.
Thank you for your help!
PS1: Code is available here: http://1code.codeplex.com/releases/view/71395, under ./Visual Studio 2010/CppShellExtContextMenuHandler in the package.
PS2: Compiled version of the sample is here: https://fgt.bo/GmQ
Finally found the answer, thanks to Choosing a Deployment Method on MSDN.
To make the DLL file compiled from the CppShellExtContextMenuHandler sample work on non-dev computers, you need to accompany it with the VC++ Runtime DLLs it depends on.
I used the wonderful tool on a client's (non-dev) machine to get the name of the DLLs my context menu handler depended on (the tool indicates which of them are missing on the arget computer!).
It turned out I had to redistribute the msvcr100.dll and msvcp100.dll files from [Program Files\Microsoft Visual Studio 10.0\VC\Redist] along with the CppShellExtContextMenuHandler.dll file to make it work.
To make the handler work on Windows XP, I also had to replace the two occurences of
hr = HRESULT_FROM_WIN32(RegDeleteTree(...
by:
hr = SHDeleteKey(...
...in the Reg.cpp file. In fact, according to C++ Windows Shell context menu handler Sample, the RegDeleteTree function isn't available on XP.
The SHDeleteKey is equivalent and can be found in Shlwapi.h, on all versions of windows I tested.
Thank you for your time reading and trying to solve this!
I have a very strange problem with my MFC application. Details:
Built with Microsoft Visual Studio 2008 (Version 9.0.30729.1 SP) under Windows Vista SP1 Ultimate.
This app. is about 15 years old and has seen most VS versions.
I have a separate test-pc with: Windows XP Pro SP3, Vista Home Premium, 7 Ultimate.
Of course I installed the VC++ redistributable on all Windows.
Now I will try to describe the problem:
The program uses MFC classes for working with CArchive objects. A user can create a new project that contains one or more sheets that contain cells that may contain text, pictures, or both. e.g. a sheet with an 8x8 grid. This project can be saved to disk: MySheet.K01, MySheet.K02, etc. The sheets are viewed with a CMultiDocTemplate.
I created a branch of this project for creating a program that can convert these files to another format. I made it a console application using AllocConsole().
When I test the program, the results are that it works fine on Windows 7, partially under Windows Vista and nothing but crashes on Windows XP.
I have ruled out the possibility that it matters if the program is compiled under Windows XP.
Here is what I think is what is going wrong:
CFile myFile;
CMyDoc *pDoc = (CMyDoc *)m_pDocViewTemplate->CreateNewDocument(); // Get a CDocument and cast it
CFileException myError;
TCHAR *arcFileName = new TCHAR[MAX_PATH];
BOOL bTmp = myFile.Open(arcFileName, CFile::modeRead, &myError);
char lpszError[1024];
myError.GetErrorMessage(lpszError, 1024, 0);
_cprintf(lpszError);
_cprintf("\n");
if(!bTmp)
{
_cprintf("ERROR: Unable to open the file!\n");
return;
}
myFile.SeekToBegin();
CArchive myArc(&myFile, CArchive::load, 8192, 0);
myArc.m_bForceFlat = TRUE;
myArc.m_pDocument = pDoc;
pDoc->Serialize(myArc);
I am really at a loss here. I can provide more details if needed.
Thanks in advance.
arcFileName will contain something like: "C:\MyProject\MySheet.K01"
Obviously...
It crashes when run from the IDE on XP? What crash do you get? Does it crash in Debug and Release versions?