Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Access ing terminal info from powerbuilder

Posted on 2001-06-07
4
Medium Priority
?
394 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 400 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
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 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 and create new code templates in NetBeans IDE 8.0 for Windows.

721 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