External function call from Powerbuilder

Hi,
I am having trouble in calling the function GetUsernameA()  function from
the Advapi32.dll.
GetUsernameA(string lpBuffer, long lpnsize)
The function requires a pointer to a string and pointer to a long as
arguements. The PB equivalants to this are string and long. IF I call this
function it returns only the size (lpnsize) and not the lpBuffer. Can
somebody help me in this. I am stuck with this

Thanks in advance

Vinod Thomas


0
name
12/9/1999 8:08:52 PM
sybase.powerbuilder.general 62418 articles. 17 followers. Follow

3 Replies
734 Views

Similar Articles

[PageSpeed] 38

Vinod --

You need to preallocate space for the name and pass the amount of space in
the 'size' argument.  Something like this:

// function declaration
function boolean GetUserNameA(ref string  lpBuffer, ref ulong nSize) library
"ADVAPI32.DLL"
// function usage
boolean lb_rc
ulong  lul_size = 255
string  ls_name

ls_name = space(lul_size)

lb_rc = GetUserNameA( ls_name, lul_size)

IF NOT lb_rc THEN
 Return ""
ELSE
 Return ls_name
END IF

HTH

Ron Gallagher, CPDP
Atlanta, GA
rongallagher@mindspring.com

name,name <name@here> wrote in message
news:XV26uFoQ$GA.88@forums.sybase.com...
> Hi,
> I am having trouble in calling the function GetUsernameA()  function from
> the Advapi32.dll.
> GetUsernameA(string lpBuffer, long lpnsize)
> The function requires a pointer to a string and pointer to a long as
> arguements. The PB equivalants to this are string and long. IF I call this
> function it returns only the size (lpnsize) and not the lpBuffer. Can
> somebody help me in this. I am stuck with this
>
> Thanks in advance
>
> Vinod Thomas
>
>


0
Ron
12/9/1999 8:31:24 PM
Hellow, Name Name

Declare:
Function boolean GetUserNameA (ref string name, ref ulong len) library
"ADVAPI32.DLL"

use:

string ls_temp
ulong lul_value
boolean lb_rc

lul_value = 255
ls_temp = space(255)
lb_rc = GetUserNameA(ls_temp, lul_value)
If lb_rc Then
  return ls_temp
 Else
 Return ls_temp
End If


name,name <name@here> escribi� en el mensaje de noticias
XV26uFoQ$GA.88@forums.sybase.com...
> Hi,
> I am having trouble in calling the function GetUsernameA()  function from
> the Advapi32.dll.
> GetUsernameA(string lpBuffer, long lpnsize)
> The function requires a pointer to a string and pointer to a long as
> arguements. The PB equivalants to this are string and long. IF I call this
> function it returns only the size (lpnsize) and not the lpBuffer. Can
> somebody help me in this. I am stuck with this
>
> Thanks in advance
>
> Vinod Thomas
>
>


0
Alex
12/9/1999 8:50:30 PM
Like Ron and Alex said, you must allocate space for the string buffer and
remember that when you declare an external decleration, when you are passisng
a string to the function and the function is going to modify the string in any
way you must pass it as a reference.  hence the ref before the string.

"name,name" wrote:

> Hi,
> I am having trouble in calling the function GetUsernameA()  function from
> the Advapi32.dll.
> GetUsernameA(string lpBuffer, long lpnsize)
> The function requires a pointer to a string and pointer to a long as
> arguements. The PB equivalants to this are string and long. IF I call this
> function it returns only the size (lpnsize) and not the lpBuffer. Can
> somebody help me in this. I am stuck with this
>
> Thanks in advance
>
> Vinod Thomas

0
Ken
12/9/1999 9:10:04 PM
Reply:

Similar Artilces:

How do I create an external function that can be called by PowerBuilder using Absoft Fortran 95?
I've downloaded a trial version of Absoft Pro Fortran 9.0 in order to create a DLL that I can call from PowerBuilder. I am able to build a DLL without problem but I when I run PowerBuilder I either get an error message "[R0015] Error calling external function x at line y in open event of object z" or PB crashes. The error would seem to indicate that PB can't find the specified routine inside the DLL but I've used every possible combination of name and/or alias that I can think of. Is there any way of "looking into" the DLL to see what the na...

External Functions in PowerBuilder !!!!!
Hi: I`m working with PowerBuilder 6.5. I want to make an external function and access it from an application. That�s i want to make an external component that PowerBuilder developers can use it, but not see its source code. For example, a dll or another file. I don`t want to use the object functions that provides PB, cause if i do it, its code can be copied. How can i do it ??? And one more thing, i want that that function can be called from any PBuilder script and it returns any PB datatypes, such as datawindow with information !!!!! Is that possible ??? If you have the solution ...

Calling a PowerBuilder Function...
Hi Everyone, Ok, here's my problem : I've made a HTML Page with CheckBoxes and a button. When I click on the button I want to catch all checkboxes that are checked to delete the entries in a database. So my problem is to give a PwerBuilder function all adequate parameters from within a HTML Page. Please Help !!! Thanx You need to give each checkbox field a name and a value. Something like this: <input type="checkbox" name="question026" value="2"> Then in your PB function, declare your arguments with the same name as the c...

Calling win32api functions from powerbuilder
Hi, I used to use a function called FindWindow in the user.exe windows 3.11 api library. I want to move my app. to a 32 bit app. on windows 95 using pb5.0. How do I declare this function in windows 95 and what library can i find it in? The old declaration syntax was: function int FindWindow (string classname, string window) library "user.exe" Any help will be greatly appreciated. Thanks, Rohit FUNCTION uint FindWindowA (long classname, & string windowname) LIBRARY "user32.dll" Then add code like the following to your application's open e...

Function call from Powerbuilder DLL
Hi All, I am using poerbuilder(6.5) created DLL(Machine code) and i have following code in VB to call function from that DLL. Private Sub Command1_Click() Dim pbo As New PBCOM.CoMsg Dim ret As Integer ->ret = pbo.of_status(6) 'This line got error message End Sub Error message : Run Time Error 429 ActiveX component cant create object. Here is PB DLL detail: PB COM Server File Name: C:\mdesai\pbcom\PBCOM.dll Interface Definition File Name: C:\mdesai\pbcom\PBCOM.idl PB COM Server Type: In Process Server Object :uo_msg COM ClassName:CoMsg Program ID:PB60CO...

PowerBuilder and OLEObject Function Calls...
Hello PowerBuilders, I got a OLE Object in which I use one of the Functions to Open a Specific Dialog. Where the user can type in some data. I think after about one minute in the Dialog, PowerBuilder brings up the message "Error calling external Function...". Is it possible to raise the timout, PowerBuilder waits for a correct return out of the function ? I am using PowerBuilder 7 Build 7023... Thanks in Advance, Andreas Eibegger andreas.eibegger@grz.andritz.com The default timeout is 5 minutes. If you want to make it longer than that, look at the SetAutoma...

Calling a Java function from PowerBuilder
Hi all, We need to call a Java function from within PowerBuilder. I realize PB 6.5 can generate Java code but how do we call the functions? We know we can write an external function call to a C program which can make the call. Is there a better way? Thanks. Andy Egleston Is it a running applet or application that can be listening for requests on a socket? You could use a socket OCX and communicate with it from PB that way. Carson ________________________________________________ Carson Hager Dynamic Data Solutions, Inc. Te...

Calling external dll from PowerBuilder
Hi. Can anyone help us with this problem? We have a PowerBuilder (6.5) application which calls an external C dll passing it references to arrays of structures. We have noticed that there will be a 30 second delay immediately after PowerBuilder would call the C dll (between the PowerBuilder function call and entry into the C dll). Now we pass references to fixed (bouded) arrays of structures to the C dll. Upon further testing we discovered that if we reduce the array numbers (they are rather large) then there would be no gap - it would go in a flash. The million dollar question ...

PowerBuilder 5.0 with external functions
I am developing a PB application with PB 5.0.2 which has to access external functions.I am accessing a library x.dl and I have around 16 function calls to the same.My application seems to get a GPF after the 5 function.Has somebody got an insight to any other settings I may have to use (Memory setting) etc. Any further information (technical white papers information would be appreciated. Whoever you are <usernamepc>, You are not giving us much here to work with... What platform are you using (16/32-bit)? Can you provide the DLL function prototypes and corresponding PB fu...

Calling wininet functions in Powerbuilder 9
Hi everybody! I want to download a file from an URL using local external functions within wininet.dll. ( I must use this dll because the application is working on different OS from windows 98 til windows XP ) I used to do it with a FTP connection. Now I want to use HTTP instead of FTP. First question : Is it possible? If yes, wich function within the dll should I call to download the file on my hard disk? If anybody has an example..... best regards Steph ...

Calling a Powerbuilder function from C++ DLL
Hi All, I need to execute a powerbuilder function from a DLL written in Watcom C++ ? Is there a way to do it or any workaround ? My problem is the following : From a function written in Watcom C++ i have to read data from a database table currently connected to a powerbuilder data source. Any help appreciated Stefano Bullo You cannot invoke a PB function externally. The next best thing is to use the SendMessage Win32 API function to trigger a user event on a PB window (use the range of WM_USER to WM_USER+ 74, mapped to pbm_custom01-pbm_custom75). ...

Calling OCX specific functions in Powerbuilder
Hi Can anybody help me to include an OCX in my application. I am able to insert the control in a window but I don�t know how to call its functions. Maybe sombody can help Thanks Joachim To access a method or property in an OCX control, you would do something like this; ocx_1.Object.propertyhere = xxx li_Return = ocx_1.Object.function ( xxx, xxx, xxxx ) The properties and methods you call depend (greatly!) on the OCX that you are using. C ya! Brez Andrew Bereznak abereznak@pkms.com Joachim Vorwerg wrote in article <01bc8dff$e5d5c420$9825e8c3@vorwerg>... >...

PowerBuilder 11 and .NET: Callback function that passes foreign types to PowerBuilder
Hi I'm using a C# assembly to catch COM events (using IConnectionPoint etc) from a particular API. But instead of handling the events in .NET, I pass the information on back to PB so it simulates a type of callback. It seems to work, but I don't know for how long. This is the one the events that gets raised. The _notifyItemMethod is the name of the method on the PowerBuilder object. The _pbSession is obtained from the .Session property of the PowerBuilder object that I pass to the constructor of the event handler. public void NtfyItem(string oper, int flags, ...

how to call a powerbuilder function which name is defined in a string
Is there a way (undocumented ?) to call a powerbuilder function when the name of that function is stored in a string? What about the parameters? I know I can triggerevent() an event, but what about functions ? If it's a global function, you might be able to use Describe(Evaluate()) -- All views expressed in this message are my own and not necessarily those of my employer "Philip SIDGWICK" <philip.sidgwick@noemail.please> wrote in message news:5LnV4uLVCHA.258@forums.sybase.com... > Is there a way (undocumented ?) to call a powerbuilder function when ...

Web resources about - External function call from Powerbuilder - sybase.powerbuilder.general

PowerBuilder - Wikipedia, the free encyclopedia
PowerBuilder is an integrated development environment owned by Sybase , a division of SAP . It has been in use since 1991, peaking around 1998 ...

Sybase PowerBuilder tool readied for Microsoft's .Net
... Win32 or newer style .Net development After several years of work, Sybase is ready to deliver on the final step in its plan to move PowerBuilder ...

Jim O'Neil (@jimoneil) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Open Directory - Computers: Programming: Languages
about dmoz - dmoz blog - report abuse/spam - help the entire directory only in Programming/Languages Description Top : Computers : Programming ...

The HP Booth Staff (Goons) Owe Me an Apology
... when you might need to use it. For instance, when I was in the WinRunner world there were plugins for driving terminal emulators and powerbuilder ...

Contact Us - Sybase Inc
Thanks for visiting the 主页 section of Sybase.com. Here you will find information about Contact Us. For more information about Business Intelligence, ...

热门搜索 - 我的异常网
... 我的异常网 » 热门搜索 sdpnet2 移动【A111】其它用户原因鉴权失败,是什么意思啊 http:// 192.168.1.102:22578 本网站服务器位于美国,受美国法律保护 MiniUI js 破解 http://192.168.1.103:8080/ powerbuilder ...

Mobile app security: Always keep the back door locked
The best way to keep mobile apps safe is to secure the services they connect to.

10 Tech Skills That Will Instantly Net You A $100,000+ Salary
... that let's developers run Java applications. Java is highly popular language for writing web apps and custom enterprise apps. No. 8: PowerBuilder ...

Top Ranked Articles
Top Ranked Articles - Free source code and tutorials for Software developers and Architects.; Updated: 23 Feb 2013

Resources last updated: 12/28/2015 6:41:11 AM