How to add (check) system path for 3rtParty bin directory in

Posted by PeterWokke on 20-Feb-2017 05:08

Dear All,

I am using 3rtParty dll's in my progress application.

Redistribute then in a subdirectory named bin in my application.

A specific module of this 3rtParty can not been used while the dll is not the the application DLC. 

And not specifies in the PATH system environment variable.

Would like to check the system path if the 3rtParty bin is included and add it when it is not there during my application startup procedure.

Can someone advice me?

Regards,

Peter

All Replies

Posted by Brian K. Maher on 20-Feb-2017 05:24

Hi Peter,
 
I don’t know of a way to modify the system PATH once your application is loaded and have it take effect within your application.  However, you may want to consider loading the dll’s yourself from your directory using the LoadLibraryA API call or perhaps just loading the dll’s through some exposed function call within the dll’s.  Either way, it you use the PERSISTENT phrase on the external procedure definition then we won’t release them until the app quits.
 
Brian

Posted by PeterWokke on 20-Feb-2017 06:41

Hi Brian,

The basic dll's I load PERSISTENT to interact with this 3rd Party Tool (maned List&Label from Combit).

For some mail option it calls other DLL from those I have loaded. The location of them are in the same folder which I have included in my propath as well but based on debugging log files they explained the following:

Analysing the log file we can see that the application and the modules are stored in two different directories:

Debwin4::CSV::V1;TypeCode;Timestamp;Level;Logger;Thread;Properties;Message

Application                    : C:\PSC\OPENEDGE116\BIN\PROWIN.EXE [11.6.3.1407]

List & Label                   : C:\ABS\ABS422\STAND\BIN\CXLL22.DLL [22.1.2016.36315 (16-12-22 15:14)F]

If the directory containing the cxMX22.dll is not in the PATH system environment variable from Windows, then the application does not find the module.

So I have to add the folder to the PATH.

I would not go to all network computers to set PATH adjustment manually.

But just control it central from the application.

Peter

Posted by Brian K. Maher on 20-Feb-2017 06:48

Hi Peter,
 
Your best bet would be to write some little stub program which would use the CreateProcess API calls to kick off your main app with the environment variable settings you require.
 
Brian

Posted by PeterWokke on 20-Feb-2017 07:06

Hi Brian,

Thank you kindly for your guiding. Have to get myself familiar with this CreateProcess API.

You an example on this to start a progress 11.6.3 64bit application.

Which uses an ini files as startup parameter.

Regards,

Peter

Posted by Brian K. Maher on 20-Feb-2017 07:12

Hi Peter,
 
Here are a couple of KB articles which may help:
 
 
 
Brian

Posted by Matt Gilarde on 20-Feb-2017 09:40

You may be able to use SetDllDirectoryA to add the directory to the DLL search path before loading the third-party DLL. The following KBase article has the external procedure definition for SetDllDirectoryA.

[View:http://knowledgebase.progress.com/articles/Article/Attempt-to-load-external-DLL-located-in-working-directory-fails-with-error-3258-with-a-64-bit-GUI-client:550:50]

As shown in the article, you will need to reset the DLL search path after you're done with the third-party DLL by doing the following:

 RUN SetDllDirectoryA(0).

This thread is closed