Solved

Application execution error (R0021) calling Global External Function frm PB 11.5

Posted on 2010-11-24
8
3,259 Views
Last Modified: 2013-12-26
I am using PB 11.5 and trying to call external function GetUsernameW
Tried declararing the function as
Public Function boolean GetUsernameW( ref string userID, ref ulong len ) library "ADVAPI32.DLL" Alias for "GetUsernameW"
Then called the function like the one below.

string  ls_temp
ulong   lul_value
boolean lb_rc
lul_value = 255
ls_temp = Space( 255 )
lb_rc = GetUserNameW( ls_temp, lul_value )

I get Application execution error (R0021).  Enclosing the screen shot.
Tried for GetUsernameA as well. The other external functions example GetModuleFileName in Kernel32.dll doesn't give any such errors. Please suggest what could be wrong.



error.JPG
0
Comment
Question by:adithya
  • 4
  • 3
8 Comments
 
LVL 2

Expert Comment

by:kmanoharnaik
ID: 34204103
Hi,

Canyou clear all the values in watch window when you try to debug?

i could not see what are the variables exist in watch window

please let me know if you have problem.

thanks
msn
0
 

Author Comment

by:adithya
ID: 34204205
Hi..
Am enclosing another screen shot for variable values during debug. I have not added anything in watch window. Is it anything to do with the path where dll is present?
error.JPG
0
 
LVL 2

Expert Comment

by:kmanoharnaik
ID: 34204223
Hi,

where did u place the dlls???

can you please place it in C:\WINDOWS\system32


regards
msn
0
 

Author Comment

by:adithya
ID: 34204407
The dll's are in the same path as you have mentioned
Our powerbuilder source code is in E drive though. Will this impact?
Tried regenerating the objects .. still the problem persists.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 2

Expert Comment

by:kmanoharnaik
ID: 34204426
Hi,

it doesnt give problem with PB installation drive as per my knowledge.

is this the case only with this DLL function or any?

thanks
msn

0
 

Author Comment

by:adithya
ID: 34204565
Hi..

I have problem with only that advapi32 dll. We have other dlls like Kerenel32.dll,shell32.dll,user32.dll which are working fine.
For example we had used the following extrenal function for kernel.dll
Public Function Integer GetModuleFileName( Integer hModule, REF String Filename, Integer Size) library 'Kernel32.dll
The advapi.dll is releted to Active directory.Probalbly because of this we are getting error? please give suggestions
can you please tell how to check active directory is active or not?
0
 
LVL 12

Accepted Solution

by:
Harish Varghese earned 500 total points
ID: 34213860
Hello Adithya,

Function name in Alias For clause is case-sensitive. GetUserNameW should have G, U, N and W letters capital.

Please change below code
Public Function boolean GetUsernameW( ref string userID, ref ulong len ) library "ADVAPI32.DLL" Alias for "GetUsernameW"

To
Public Function boolean GetUsernameW( ref string userID, ref ulong len ) library "ADVAPI32.DLL" Alias for "GetUserNameW"
0
 
LVL 2

Expert Comment

by:kmanoharnaik
ID: 34215313
hi,

I believe alias will be added when you migrate the source code from earlier versionto latest version.
And  I dont see the syntax was wrong in Aditya's code while calling, if it is a case sensitive in declaring alias name, it is wrong. i hope it works without alias if its not migrated source code.
Please let me know the response from Aditya if Harish suggetsion works out.

regards
msn
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org (http://seleniumhq.org) Go to that link and select download selenium in the right hand columnThat will then direct you to their downlo…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now