How to use external Dll in Air Native Extension? - windows

The structure of my ANE file looks like this:
<META-INF>
<ANE>
<Windows-x86>
ExtensionDll.dll
DllUsedByExtensionDll.dll
extension.xml
mimetype
catalog.xml
library.swf
If ExtensionDll.dll uses the functions in the other Dll, the extension won't load. DllMain is not called. It seems like DllUsedByExtensionDll.dll is not in the Dll search path when the air application uses the extension is running.
How should I make the application find the extra Dlls, if I don't want to put them into some common Dll path?

I've had the same problem and went at this for a few days. Turns out there's two ways to solve this.
Export Release Build, while making sure that the DllUsedByExtensionDll.dll is packaged in the same directory as your executable.
For debugging purposes, copy the DllUsedByExtensionDll.dll into your Adobe AIR SDK bin directory, where the Air Debug Launcher (adl) executable is located.
You do not need to package DllUsedByExtensionDll.dll in the ANE that you are building.
The problem is that ExtensionDll.dll cannot find the DllUsedByExtensionDll.dll when it is launched from the debugger, since the executable for the debugger is located in the AIR SDK. Once you export the release build however, the your app is the executable, so now it looks for the dll in its root directory.
If you want to debug this in order to find out more information on what could be wrong, I suggest that you run your app by command line using the adl command.
For me, running through Flash Builder's debug/run meant that I could not see the Windows error "the program can't start because dll is missing from your computer". And that led me on a wild goose chase for a long time.

If your dll is using other dlls then include the reference dll's in the project where you are going to use that ANE file.

Related

".exe file has stopped working" when file isn't in solution folder - ScreenReaderAPIWrapper causing the crash

Running the solution without problems in Visual studio 2017, or directly through .exe file in solution folder (inside release and debug folders). But when the ".exe" file is not in the solution folder, it will crash and stop working.
I found that these lines are causing the issue:
ScreenReaderAPIWrapper.ScreenReader sc = new ScreenReaderAPIWrapper.ScreenReader();
sc.SayString(textDisplay.Text.ToString());
The ScreenReaderAPIWrapper library for .net you're using is a wrapper around another library called UniversalSpeech. There are several solutions alike out there, like Davy Kager's Tolk or Chris Toth's AccessibleOutput. All of these libraries make use of native APIs provided by corresponding screen reader modules (jfwapi.dll, saapi32.dll, NvdaController32.dll and others).
For these libraries to work, you have to provide all of the needed DLLs along with your executable, otherwise you'll get those errors about the exe file that stopped working.
If you need to distribute your program, consider using installer tools like NSIS or InnoSetup to pack all needed files into one single installer.

Qt Macdeploy tool alternative for windows

Hi I am trying to make my qt app run just copying the exe. With hours of static build I succeded it however; I discovered that there is a tool for mac named 'macdeployqt' doing all the process for you.
So I wondered if any equivalent tool or script exists for windows. It will get the exe extract dependencies, creates qt.conf file and put the dll's and exe into right paths.
What I mean here is not about creating setup package, just a folder containing all necesseray libraries etc.

Visual Studio c++ 2015 runtime deployment with legacy application

I have a winforms .net4.5.2 application which depends on a c++\cli wrapper which is included in the VS project by reference. When the winforms application, that is built using Any CPU, is launched a assembly resolver is used to point out the correct platform dll for the reference and Assembly.Load(ed) in the platform specific folders in the root of the application folder i.e. \x64 or \x86.
This c++\cli is now built using the v140 platform toolset which depends on the Universal CRT dll:s. Looking here https://blogs.msdn.microsoft.com/vcblog/2015/03/03/introducing-the-universal-crt/ I was able to locate the necessary dll:s (41 * 2 of them) and I did what I was told to copy them inside the \x86 and \x64 folders. Now since the change to v140 platform my application does not start anymore and ProcessMonitor file operations tell me the following:
SUCCESS C:\MyApp\x64\TheCLIWrapper.x64.dll
SUCCESS C:\MyApp\x64\ADependency.dll
SUCCESS C:\MyApp\x64\msvcp140.dll
SUCCESS C:\MyApp\x64\vcruntime140.dll
SUCCESS C:\MyApp\x64\api-ms-win-crt-runtime-l1-1-0.dll
NAME NOT FOUND C:\MyApp\ucrtbase.dll
How is this even possible if before assembly resolving my c++\cli wrapper I explicitly set the dll directory (using SetDllDirectory) to the C:\MyApp\x64 folder? By this I mean why is the loading process looking in C:\MyApp for the ucrtbase.dll?
Naturally, if all the 41 dlls of a specific platform are copied to the root C:\MyApp\ folder it works but this is not an option for me, nor is the installation of c++ runtime executable on the clients running the application.
Does anyone have an idea or any tips on how to solve this deployment problem?
So you basically wanna do x-xopy deployment with x86-dll's in MyApp\x86, and x64-dll's in MyApp\x64?
How about explicitly loading the dll's with LoadLibrary?
I used procmon to inspect where the UCRT DLLs were trying to load each other from. Noticed the paths it was searching did not include the path set from the earlier SetDllDirectory. No matter what I tried the paths it searched seemed to only include the default values.
The working directory was always included as per Dynamic-Link Library Search Order and the only solution I could get was to change the current working directory to the appropriate one, load the DLL with the UCRT requirement, and change it back. Nothing else worked (including changing PATH environment variable)
Note this is very much not threadsafe

Where can i get dll's to deploying app in Qt on windows?

My app successfully runs from Qt Creator, but in explorer it alarms missing dll's and so. I copied QtCore4.dll, QtGui4.dll in .exe containing directory, but it abuses on something related with vs runtime!
screenshot
(also it is question which QtCore4.dll, QtGui4.dll are proper, because there some versions with different sizes and i think their combinations may cause the error)
What can i do?
One way to find out what DLL files are needed by your Qt application is the following:
Start the application from Qt Creator.
Open Process Explorer (by Microsoft) and select your application process from the list.
Click View->Lower pane view->DLLs to see what DLLs are being used by your application.
The DLL view shows also the paths of the DLLs.
this problem has nothing to do with the dependencies of the application. It looks like your application is statically embedding (containing) the C-runtime library, while (at the same time) some dependencies of this application use another type of binding with the C-Runtime library.

How to Deploy VB6 Applications?

How to run the exe file to other system?
Using VB 6
I copied the exe file to other system, then run that exe file, it not working it showing error
“component comdlg32.ocx or one its dependencies not correctly registered a file is missing or invalid”`
Can any one help me how to avoid this error?
When deploying VB6 applications, you should create a Setup, this will manage the DLL's that the VB6 application depends on. Since it is not enough to just copy the .Exe and .Dll's. You also need to register them.
The creation of the setup is included in the VB6 environment.
You can read this http://support.microsoft.com/kb/830761 which is very comprehensive.
1: http://support.microsoft.com/kb/830761 for more information.
Or if you just want the redistributable files check this kb http://support.microsoft.com/kb/290887
Copy and register the comdlg32.ocx on other system. Link: Fix Missing Comdlg32.ocx Run time Error in Portable apps.
Create an installer for your program.
Unless you are deploying your program to really old versions of Windows (prior to XP), one nice alternative is to create an XCopy package using reg-free COM. This is fairly easy for most simple programs using Make My Manifest though it can be done by hand or using other tools if you invest in a little study.
Even then a formal installer package is usually desireable though, if nothing else to create Start Menu shortcuts and set up application workspace directories.
Keep in mind that even the PDWizard is difficult to use blindly. Packaging and deployment is a topic that requires some learning investment.
Outdated or missing comdlg32.ocx runtime library is causing this error. Here is a copy of comdlg32.ocx (~60 Kb Zip). Download the file to the Desktop and extract the comdlg32.ocx to your the Windows\System32 folder.
Note: If you already have a copy of comdlg32.ocx, backup the existing file to a different folder and delete it from System32 folder.
1. Download comdlg32.zip and save to Desktop.
2. Unzip the file using WinZip or any other utility.
3. Extract comdlg32.ocx to Windows\System32 folder.
4. Type the following command from Start, Run dialog:
regsvr32 %Systemroot%\System32\comdlg32.ocx
Typically a VB 6 app will consist of an .exe some .dll libraries and a config.ini file. The exe is the starting place and it consumes the dll's and config.ini and other resources to run => you have to have all parts in the same directory for the app to run typically called "packaging" an app. E.g. An installer simply ensures that all those files in a packaged app are placed on a users computer in an Windows application directory, and creates a shortcut launch icon so that a user can click the shortcut in the start bar and the app will run.
To "package" your app (put the dll's and exe in the same folder) you can use an Add-In called "Package and Deployment Wizard":
And here is a demo of using it: https://www.youtube.com/watch?v=XT7jaoAiKDo
You can either package and create an installer and package or just create a package:
Now if the Deployment Wizard doesnt show as an add-in on your VB6 Editor Installation, go to editor's program folder and find the tools Tools folder, i.e:
Then you should be able to find the Deployment Wizard there:
Open it to use it.

Resources