Solved

Access ing terminal info from powerbuilder

Posted on 2001-06-07
4
384 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

740 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