Solved

Access ing terminal info from powerbuilder

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
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…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

758 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

23 Experts available now in Live!

Get 1:1 Help Now