Solved

Access ing terminal info from powerbuilder

Posted on 2001-06-07
4
390 Views
Last Modified: 2013-12-26
Is there a way to retrieve the the computer network name or network card address of a computer within a Powerbuilder application? Is there a way to retrieve network userid from within a Powerbuilder application?
0
Comment
Question by:frank_s
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
rajeXsh earned 100 total points
ID: 6165446
You can use the windows system information functions. You will have to declare tham as external functions.

This link will point you the msdn site with the information of these functions

http://msdn.microsoft.com/library/default.asp?URL=/library/psdk/sysmgmt/sysinfo_8k6w.htm
0
 

Author Comment

by:frank_s
ID: 6182262
rajeXsh,

We have been trying to perform a Windows API call within PowerBuilder. We are trying to call the "GetComputerName" (which is the name of the computer or network address of the computer) and "GetUserName" (name of the person logged into this workstation) functions and we are not having any luck. My task is to figure out a way to prohibit concurrent logons of the PowerBuilder app. I am trying to indentify the computer that is being used and who the user is that is logged onto the computer. If you have some sample code already written that works could you please forward it to me.

Thanks,

Frank
0
 
LVL 2

Expert Comment

by:rajeXsh
ID: 6182569
GetComputerNameA( )

This function returns the computer's name into a string by reference. Be sure to allocate enough space for the string or you'll get a GPF when you exit PowerBuilder.

Global External Function:
 
FUNCTION boolean GetComputerNameA(ref string cname,ref long nbuf) LIBRARY "Kernel32.dll"

Script:
 
string ls_compname
long ll_buf
ll_buf = 25
ls_compname = space(ll_buf)
GetComputerNameA(ls_compname, ll_buf)
MessageBox("Computer name is:", ls_compname)

---------

GetUserNameA( )

This function returns the current users logon name. Be sure to allocate enough space for the string or you'll get a GPF when you exit PowerBuilder.

Global External Function:

 
FUNCTION boolean GetUserNameA(ref string uname, ref ulong slength) LIBRARY "ADVAPI32.DLL"

Script:
 
string ls_username
string ls_var
ulong lu_val
boolean rtn
lu_val = 255
ls_username = Space( 255 )
rtn = GetUserNameA(ls_username, lu_val)
Messagebox("GetUserNameA", "Username = " + string(ls_username))

0
 

Author Comment

by:frank_s
ID: 6296596
Sorry for the delay, but thank you for your help.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

623 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