How can PB application read dlls

Hi,
Are there any functions or a way for a Powerbuilder
application to read a particular dll,which is not in a fixed
location.For eg,in one laptop it might be under c:\test and
in another laptop it can be under c:\temp.

Thanks
Sayed
0
Sayed
1/12/2011 8:50:49 PM
sybase.powerbuilder.general 62418 articles. 11 followers. Follow

5 Replies
737 Views

Similar Articles

[PageSpeed] 37

Since the external function declaration points to a specific directory, 
I don't think you could point to a directory that is not known until run 
time.
If there is a small set of possible locations, you might use 
polymorphism as in the old PFC's platform service.
It's probably easiest to just copy the dll to a fixed location and 
specify that in the declaration. IIRC PB doesn't attempt to load the dll 
until the first time you call one of its methods.

Report Bugs to Sybase:  http://case-express.sybase.com/cx/welcome.do
Product Enhancement Requests:
http://my.isug.com/cgi-bin/1/c/submit_enhancement

On 1/12/2011 3:50 PM, Sayed wrote:
> Hi,
> Are there any functions or a way for a Powerbuilder
> application to read a particular dll,which is not in a fixed
> location.For eg,in one laptop it might be under c:\test and
> in another laptop it can be under c:\temp.
>
> Thanks
> Sayed
0
Jerry
1/12/2011 9:51:44 PM
Hi Sayed;

  Is adding the location of the external DLL(s) to the System Path not an 
option as this would make it transparent to the application?

Regards ... Chris
President: OSUG / STD Inc.
Blog: http://chrispollach.blogspot.com
PBDJ: http://chrispollach.sys-con.com
SourceForge: http://sourceforge.net/projects/stdfndclass

"Sayed" wrote in message news:4d2e1428.6267.1681692777@sybase.com...

Hi,
Are there any functions or a way for a Powerbuilder
application to read a particular dll,which is not in a fixed
location.For eg,in one laptop it might be under c:\test and
in another laptop it can be under c:\temp.

Thanks
Sayed 

0
Chris
1/13/2011 1:17:11 AM
If I'm reading Help correctly, the LIBRARY part of the declaration is 
required. ALIAS is optional if the PB name is the same as the actual 
name of the function in the DLL.

Report Bugs to Sybase:  http://case-express.sybase.com/cx/welcome.do
Product Enhancement Requests:
http://my.isug.com/cgi-bin/1/c/submit_enhancement

On 1/12/2011 8:17 PM, Chris Pollach wrote:
> Hi Sayed;
>
> Is adding the location of the external DLL(s) to the System Path not an
> option as this would make it transparent to the application?
>
> Regards ... Chris
> President: OSUG / STD Inc.
> Blog: http://chrispollach.blogspot.com
> PBDJ: http://chrispollach.sys-con.com
> SourceForge: http://sourceforge.net/projects/stdfndclass
>
> "Sayed" wrote in message news:4d2e1428.6267.1681692777@sybase.com...
>
> Hi,
> Are there any functions or a way for a Powerbuilder
> application to read a particular dll,which is not in a fixed
> location.For eg,in one laptop it might be under c:\test and
> in another laptop it can be under c:\temp.
>
> Thanks
> Sayed
0
Jerry
1/13/2011 3:01:51 AM
Hi,

Before the first call to functions from the DLL use LoadLibrary WinAPI 
finction to load the DLL from your temp folder.

In declarations of your ext. functions in the LIBRARY clause specify 
DLL's file name only (without path).

At program exit or after the first call to the DLL use FreeLibrary 
function to unload the DLL, otherwise PB IDE will keep it locked (when 
running from IDE).

Ext. declarations for the above functions:
Function ulong LoadLibraryA (readonly string lpLibFileName) Library 
"KERNEL32.DLL" // for PB9 and below
Function ulong LoadLibraryW (readonly string lpLibFileName) Library 
"KERNEL32.DLL" // for PB10 and above
Function boolean FreeLibrary (ulong hLibModule) Library "KERNEL32.DLL"

Sample:
ulong ll_handle
string ls_fulldllname

ls_fulldllname = of_get_dll_name() // returns someth like "c:\temp\your.dll"

ll_handle = LoadLibraryW(ls_fulldllname)
If ll_handle <> 0 Then
     // loaded; call something in the DLL
     YourDllFunc() // increments DLL use counter from 1 to 2
     // unload the DLL
     FreeLibrary(ll_handle) //decrements the use counter from 2 to 1
Else
     // No loadable DLL in ls_fulldllname
End If

Regards

On 12.01.2011 22:50, Sayed wrote:
> Hi,
> Are there any functions or a way for a Powerbuilder
> application to read a particular dll,which is not in a fixed
> location.For eg,in one laptop it might be under c:\test and
> in another laptop it can be under c:\temp.
>
> Thanks
> Sayed

0
Anatoly
1/13/2011 1:23:53 PM
Hi Sayed,

If you distribute this DLL along with your application, then you can simply 
put it in the application executable's folder. Another option would be, as 
Chris suggested, to put it in a folder belonging to the System Path.

Anyway, you can do some preliminary checks for the availability of the DLL 
before any call to an external function:

1) simply using FileExists() method. Passing only a filename (with no path) 
to this method would make it search along the entire system path, not just 
in your current folder.

2) here's a sample function which checks if a given method of a given DLL 
file is available to your application:

External function declarations:
-----------------------------------------
FUNCTION ulong LoadLibrary (ref string lpLibFileName) Library "KERNEL32.DLL" 
Alias for "LoadLibraryW"
FUNCTION boolean FreeLibrary (ulong hLibModule) Library "KERNEL32.DLL"
FUNCTION ulong GetModuleHandle(string lpModuleName) Library "KERNEL32.DLL" 
Alias for "GetModuleHandleW"
FUNCTION ulong GetProcAddress(ulong hModule, string pProcName) Library 
"KERNEL32.DLL" Alias for "GetProcAddress"

The source code:
------------------------
function of_get_availability(as_module_name, as_function_name) returns 
boolean

ulong lul_module_handle, lul_func_address
boolean lb_loaded = FALSE  // if we load the DLL, we shall unload it

// First, try to find the DLL in the memory
lul_module_handle = GetModuleHandle(as_module_name)
if ISNULL(lul_module_handle) or (lul_module_handle = 0) then
   // Module not available in the memory, try to load it
   lul_module_handle = LoadLibrary(as_module_name)
   if ISNULL(lul_module_handle) or (lul_module_handle = 0) then return FALSE 
// Module could not be loaded
   lb_loaded = TRUE
end if

// Second, find the method within the DLL
lul_func_address = GetProcAddress(lul_module_handle, as_function_name)
if ISNULL(lul_func_address) or (lul_func_address = 0) then
   if lb_loaded then FreeLibrary(lul_module_handle)  // unload
   return FALSE  // Function is not found within this module
end if

// Function is found within this module
// at address lul_func_address
if lb_loaded then FreeLibrary(lul_module_handle)  // unload

return TRUE

Sample usage:
---------------------
if not of_get_availability("wininet.dll", "InternetCrackUrlW") then
   MessageBox("Error", "Missing WININET functionality... cannot continue!", 
StopSign!)
end if

Regards,
Ivaylo

<Sayed> wrote in message news:4d2e1428.6267.1681692777@sybase.com...
> Hi,
> Are there any functions or a way for a Powerbuilder
> application to read a particular dll,which is not in a fixed
> location.For eg,in one laptop it might be under c:\test and
> in another laptop it can be under c:\temp.
>
> Thanks
> Sayed 


0
Ivaylo
1/13/2011 2:10:00 PM
Reply:

Similar Artilces:

Can a PB Application read DB schema?
Can an application, developed in PB, read the script of ASA database object? In other words, I need to retrieve and show the script (schema) of a database function to user through the application. My application accesses to the database through ODBC interface. It's odd, isn't it!? Thanx Lara Jacob wrote: > Can an application, developed in PB, read the script of ASA > database object? In other words, I need to retrieve and show > the script (schema) of a database function to user through > the application. Can't really understand the purpose of the ex...

Application in Powerbuilder 5.0.2 with PFC
I recently found myself in charge of an application built in Powerbuilder 5.0.2 using the PFC. Nobody seems to have the installation disks for PB 5.0.2 available anymore, so I was looking at Powerbuilder 8. I have never used PB 8 nor have I used PFC in any version. My 2 questions are 1) can and go from PB 5.0.2 to PB 8 and 2) how do you migrate using the PFC?? Thanks. Wallace Henry whenry@newcorp.com On Fri, 1 Feb 2002 16:29:33 -0500, in powersoft.public.powerbuilder.pfc Wallace Henry <whenry@newcorp.com> wrote: >I recently found myself in charge of an application...

can we run another application from a PB application
Can anybody tell me if its possible to run a second PB application from an already running PB application? If yes, then is there any way to terminate the first application and continue with the second? Thanks, Menka Gupta Corsair Communications, Inc. Run("secondapp.exe") Halt Close S Rivankar Menka Gupta wrote in message <3846D57A.FE3778BB@corsair.com>... >Can anybody tell me if its possible to run a second PB application from >an already running PB application? > >If yes, then is there any way to terminate the first application and >con...

How Can I handle a PB Application from another Windows Application
Hy Guys, I have a big problem, I don't know how handle an Application created by PB from another application. I. E.How can I launch the an event or a global function or get some properties value? Thanks. Stefano Giostra. You can trigger user events mapped to pbm_custom01-pbm_custom75 by using the SendMessage Win32 API using message IDs between 1024 and 1098, respectively. You will need to use the FindWindow API to get the handle of the main window of the application you want to "talk" to. -- pbm_hopethishelps, Roy Kiesler [TeamSybase] Sybase Develop...

PB Application to PB Application communication
I need to have 2 powerbuilder application be able to communicate with one another. A string is all I need to pass between the two applications. I tried creating a com object that I could connect to from both applications. This com object would basically store the information I want to pass between the two applications in an instance variable. One application would populate that instance variable, then notify the other application(through the send command) to go read the information in the com object. I created the com object fine and can call a function on the com object ...

How Can VB Application Trigger Events or [talk to] PB Application
Hi all I want to know - if applicable - How Can Visual Basic Application Call PowerBuilder Application to Run functions, Open windows, Etc -- Thanks in advance ------------------------------------------------------- Waleed Seada ------------------------------------------------------- Check out the use of OLE Automation in PowerBuilder, within the Application Techniques manual. On 11 May 2004 00:13:51 -0700, "Waleed Seada[BearingPoint]" <DSweetPrince@hotmail.com> wrote: >Hi all > I want to know - if applicable - How Can Visual Basic >...

SQLCA works when application runs in PB not when application is run with Powerbuilder WDK.
Hi, My applications with out SQLCA run great through Powerbuilder WDK, my applications that contain SQLCA information doesn't. When I run the application in PB I get a splash screen and then the application starts. When I run it through PB WDK the splash screen starts and the I get a login box. No matter what I do it always show's up and when I hit OK I get the following SQLSTATE = 08001 error. How can I stop this from occurring? The SQLCA code and ini file are below. code: startupfile = "pds.ini" /* Populate sqlca from current PB.INI settings */ sqlca.DBMS...

How can I launch other application from PowerBuilder and wait until the launched application terminates before continuing?
I need to write function launches the application specified by StringParameter with the command line parameters. The function should wait until the launched application terminates before continuing. How can I do it using PowerBuilder and Windows API ? mail: igorm@proactivityinc.com In article <i6rNFfSBAHA.203@forums.sybase.com>, igor@proactivityinc.com says... > I need to write function launches the application specified by > StringParameter with the command line parameters. The function should wait > until the launched application terminates before continuing...

Frontend PB application for a mainframe General Ledger application using Platinum Infosession
Hi, I am trying to get a project to write a frontend PB GUI application for a mainframe General Ledger. I have succeeded to make an example for a login and CEMT list + update of CICS programs. The customer requires me to do an example based on a very small part of the General Ledger so that he can demonstrate to his colleagues this is viable and this will remove the necessity of training for the users to pass through natural and cumbersome mainframe screens to reach general ledger. They intend to have the whole of general ledger to get a GUI interface... My question is: Th...

PB 5.0.4 Application can't migrate to PB 6.5
Hi, I try to migrate the application from PB5.0.4 to PB6.5. After migration, some errors occurs. Problem 1: A window ( say w_abc) which is inherited from another window (w_inherit). After migration, it has following errors Object: w_abc Instance Variables (0002) Error C0001: Illegal data type: istru_result istru_result - is a window structure in w_inherit window and it is used in w_abc instance variables In w_abc window, Instance variables: istru_result istru_result1 Problem 2: If a function which used string array ...

pb application deployment of application
ver 10.5 is there an easy way of finding which pb runtime files i need to deploy with my application to create an installation for a customer First of all, check out the PB runtime packager, and documentation in HTML books under application techniques, chapter 40. You can also use tools like process explorer (www.sysinternals.com - now Microsoft) that lists the active DLL's used by an application. Including tools like Dependency Walker (www.dependencywalker.com). (That even integrates with Process Explorer.) Regards Andr� P� Wed, 21 Feb 2007 12:04:10 +0100, sk...

Can an PB application be too big?
Using Powerbuilder desktop v 8.03 I have developed a large application (dll's 41 mb and 19mb) from which graphics appear in a printed text document. Recently I added some functions and controls, the recompiled application performed such that the document output was devoid of the graphics. When I further added some global variables and recompiled, not only were the graphics missing but some text was truncated as well. When the newly added global features were deleted, the text was complete but graphics were missing . Then when the new functions and controls were removed, the ...

Powerbuilder application "crashing" another powerbuilder application
This is a repost of the above subject since there has been some problem for messages posted on the 19th - 22nd July 2002. *************** Hi All, I have an application (App A)built using PB7.0.3 build 10077 and it seems to work fine. However, recently, another application (App B) built using PB 7.0.3 build 10047 as well was installed and it seems to trigger Dr Watson on App A. There is an embedded OCX on a "main" window on App A, which receives triggers from external applications. The OCX will then call another function sitting on another main window. That function w...

PB 11.5 application is lower than the same application on PB 9
Hi, We have recently migrated our full source from PB 9 to PB 11.5. We found that the program is running extremely slow. We noticed that it happens mostly when using GUI. There are delays even when tabbing though controls on the screen. We run tracing on both environments, and most of the functions show that the response time is better in PB 11.5, but the experience of using PB11.5 application is very slow anyway. Has anyone experienced the same? On Aug 21, 9:13=A0am, chaau <andrew.chered...@gmail.com> wrote: Sorry, typo in the title. Should be PB 11.5 application is slo...

Web resources about - How can PB application read dlls - sybase.powerbuilder.general

Application - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Second visa application 'likely' to be approved
The family of a terminally ill Pakistani student can 'hopefully come to Australia sooner rather than later' says Immigration Minister Peter Dutton. ...

Tashfeen Malik's visa application under scrutiny - Business Insider Deutschland
The US government has released the visa application for Tashfeen Malik, who along with her husband killed 14 people in an attack in San Bernardino, ...

Panasonic Develops a Stretchable Resin Film and Its Application Materials for Stretchable Electronics ...
A stretchable film is developed. This film stretches to 2.5 times the original length and then returns to the original form. A conductive paste ...

MBA: Mortgage Applications Increase in Latest MBA Weekly Survey, Purchase Applications up 37% YoY
From the MBA: Refinance, Purchase Applications Both Up in Latest MBA Weekly Survey Mortgage applications increased 7.3 percent from one week ...

Lawmaker: Immigration Officials Didn’t Fully Vet Tashfeen Malik’s Visa Application
"It’s unacceptable that U.S. Citizenship and Immigration Services did not fully vet Malik’s application and instead sloppily approved her visa," ...

German-Based Spirea Promotes Decentralized PV Applications In Uruguay
... Its technical operations specialist, Laurie Lawrence, pointed out that Uruguay [&hellip German-Based Spirea Promotes Decentralized PV Applications ...

Visa application of San Bernardino shooter released
CNN Visa application of San Bernardino shooter released CNN (CNN) The visa application of one of the San Bernardino shooters was released ...

ZTE to develop smartphone application processors in house
ZTE has stepped up its efforts to internally develop smartphone chipset solutions, aiming to re-capture the title as one of the top-three smartphone ...

IBM Takes on AT&T Managed Application, Hosting Services
AT&T’s networking, security and mobility solutions coupled with IBM Cloud offers companies a fully managed IT environment.

Resources last updated: 1/6/2016 10:05:28 AM