Get computer name

I found the code below in an old Google session for this newsgroup.  I am
just wondering if the GetComputerNameA Win32 API works in 95, 98, 2000 and
XP.  Anyone?


To get the computer name, use the GetComputerNameA Win32 API call as
follows:

FUNCTION boolean GetComputerNameA( REF string lpBuffer, REF ulong lpnSize )
LIBRARY "kernel32.dll"

// sample code
string    ls_name
ulong    lul_maxlen

lul_maxlen = 260
ls_name = Space( lul_maxlen )
IF NOT GetComputerNameA( ls_name, lul_maxlen ) THEN
    // handle the error
ELSE
    MessageBox( "Computer Name", ls_name )
END IF



0
Woody
5/20/2002 4:54:06 PM
sybase.powerbuilder.general 62418 articles. 17 followers. Follow

2 Replies
2668 Views

Similar Articles

[PageSpeed] 14

Yes, it works for all of those platforms:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/sysinfo
_08f9.asp

See the very bottom of that page where it discusses platform requirements.

On Mon, 20 May 2002 09:54:06 -0700,
 in powersoft.public.powerbuilder.general
Woody <woody@splawns.com> wrote: 
>I found the code below in an old Google session for this newsgroup.  I am
>just wondering if the GetComputerNameA Win32 API works in 95, 98, 2000 and
>XP.  Anyone?
>
>
>To get the computer name, use the GetComputerNameA Win32 API call as
>follows:
>
>FUNCTION boolean GetComputerNameA( REF string lpBuffer, REF ulong lpnSize )
>LIBRARY "kernel32.dll"
>
>// sample code
>string    ls_name
>ulong    lul_maxlen
>
>lul_maxlen = 260
>ls_name = Space( lul_maxlen )
>IF NOT GetComputerNameA( ls_name, lul_maxlen ) THEN
>    // handle the error
>ELSE
>    MessageBox( "Computer Name", ls_name )
>END IF
>
>
>

Bruce Armstrong [TeamSybase]
http://www.teamsybase.com
http://www.needhim.org

---== Posted via the PFCGuide Web Newsreader ==---
http://www.pfcguide.com/_newsgroups/group_list.asp
0
Bruce
5/20/2002 5:50:52 PM
According to the Microsoft site, it works in all of the 32 bit environments 
(however the date of the article if prior to XP).  I can confirm it works 
for our installations of NT.

- Joe Slawsky (NOSPAMFORME_jslawsky@planetdx.com)
www.planetdx.com
0
Joe_Slawsky
5/20/2002 6:11:58 PM
Reply:

Similar Artilces:

How to get DNS Name be the DNS Name rather than computer name
In Patchlink associated with computers there is "DNS Name" field. This field seems to be the computer name (netbios name) for windows computers rather than the dns name assocated with the IP address. Is there a way to configure the patchlink server so this field reports the DNS Name rather than the computer name? where is that "DNS name" field? -- Shaun Pond > where is that "DNS name" field? > > -- > > Shaun Pond > > From the web interface: 1) From the Reports ->Computer Status Report the second field ins...

How can i get the computer client computer name not the IP address
I have been trying to get the client computer name and ip address. For the IP address i can get it. For the computer name i a gain get the IP address. Is there some thing i have to do in order to get the computer name not the IP. My application runs on a server in the company's intranet. Below is my sample code. I also want to get the "timea" just in hour/minutes format. At the moment timea is bringing to much details(I dont if there seconds or millisecoinds, but just to much figures) Dim username As String = HttpContext.Current.User.Identity.Name Dim timea As String = DateTime.Now.TimeOf...

Get Computer Name
How to get the computer name in Win95 and Win3.1(workgroup)? Thanks in advance. Do any web site that contain all Window API calls, thanks. Edward Chan For Win95: FUNCTION ulong GetComputerNameA( REF string lpBuffer, REF ulong nSize ) LIBRARY "kernell32.dll" Roy se5a03 wrote in message <3522454C.2CB87E94@hotmail.com>... >How to get the computer name in Win95 and Win3.1(workgroup)? > >Thanks in advance. > >Do any web site that contain all Window API calls, thanks. > >Edward Chan > se5a03 a �crit dans le message <35...

How to get computer name?
How do I get the computer name from a vb.net 2.0 program?TIA,Owen Ok. I Found it.My.Computer.Name Owen...

How do I get the computer name?
We have an application that is run on either the user's local machine or the server. I can get the local computer name using n_cst_platform.of_getComputerName(), but how do I get the server name will that function work as well? TIA > We have an application that is run on either the user's > local machine or the server. I can get the local computer > name using n_cst_platform.of_getComputerName(), but how do > I get the server name will that function work as well? > > TIA > > Are you just trying to determine if it is being run on a loal d...

get names of computer and their users
Hello, is there a way to get all the computers and their users in a domain? Thnx, geert I use NetQueryDisplayInformation http://msdn.microsoft.com/library/en-us/netmgmt/netmgmt/NetQueryDisplayInformation.asp?frame=true A good example can be found here http://www.topwizprogramming.com/redirect.html?page=freecode > Hello, > > is there a way to get all the computers and their users in > a domain? > > > Thnx, > > geert ...

How can I get the computer name?
hi, somebody there can help me please? I'm new in ASP.NET, I'm working in something where I need get the client computer name....how can i do that?........I think it could be possible with some script. Ask the user. there's no easy way to just get this automatically.RTFM - straight talk for web developers. Unmoderated, uncensored, occasionally unreadableJason Brown - MVP, IIS...

How can I get a computer name
Hi! How can I get a computer name, which is running my application? Sancho Sandris The platform service of the PFC has an of_GetComputerName() function. Good Luck Michael Walker Cascadia Software Sandris wrote: > Hi! > How can I get a computer name, which is running my application? > > Sancho > > > ...

Getting Computer Login Name.
  Hi all I'm using VWD Im trying to get the computer Login Name(Username) in my web application. I tried using HttpContext.Current.User.Identity.Name and alot of other way like the old method servervariables? and many other. But cannot rem them no. All of it works IF im working local Host. But it Just Became Empty or Wrong Value if its working on a server/client basis.   And ideas how to get it using web Application?   Thx in advance Cheers Did you tried just User.Identity.Name and what you got! Also what value it's showing. One more quesiton, are you using forms ...

get computer name in a network
Hello, I'm trying to get the computername from which a user has been logged in from. Is there a way to do this??????? Thnx, Geert http://eric.aling.tripod.com/PB/tips/pbtip14.htm Good luck... ;) U�ytkownik <Geert Vancleef> napisa� w wiadomo�ci news:4063fab6.370d.846930886@sybase.com... > Hello, > > I'm trying to get the computername from which a user has > been logged in from. Is there a way to do this??????? > > > Thnx, > > Geert Hi Geert, //external API declaration FUNCTION boolean GetComputerNameA(ref string ...

Get Client Computer Name
I'm attempting to retrieve the client computer name from my ASP.NET web application. I'm using System.Net.Dns.GetHostName(). This is returning the computer name of the web server. The application is being used an a Windows 2000 Active Directory Intranet. How do I get the name of the client computer, not the web server name? Thank you. Try either Request.ServerVariables["REMOTE_HOST"] for the client computername or Request.ServerVariables["REMOTE_ADDR"] for the client ip address Regards Fredr!k Close... Request.ServerVariables("remote_a...

How to get a bitmap name from a Computed Fied
I am setting a computed field to a bitmap by using the expression :: Bitmap(Case(f_find_maint(sxpr_pk, ordd_sku_cd ) WHEN IS = 1 THEN "spman.bmp" when is = 2 then "zoom.bmp" else "stop.bmp")) The problem is that I cannot access the name of the bit map in the code. Does anyone have a clue on how to get the bitmap name? Thanks Have two computed fields, the first with expression Case(f_find_maint(sxpr_pk, ordd_sku_cd ) WHEN IS = 1 THEN "spman.bmp" when is = 2 then "zoom.bmp" else "stop.bmp") and the second wit...

Getting the computer name of the client user
Is it possible to get the client's computer name?ez Ez416:Is it possible to get the client's computer name? I dont think so.I do not think a post/get request will send such information. It can be done using an ActiveX object, but the client computer's setting has to be set to a ridiculously low level.When you ask a question, remember to click "mark as answered" when you get a reply which answers your question.My latest ASP.NET AJAX blog entries. Probably it is enough to use Request.UserHostName and Request.UserHostAddress (on server-side). no?[MCPD: WEB]...

How to get computer name application is running on?
I have a Windows Service and need to be able to get the name of the computer the service is running on from code for logging purposes. How can I get that? System.Environment.MachineName should contain the information you need----------------------------------------------Mark helpful posts as "Answer"Check out my cheese making blog http://cheeseathome.blogspot.com...

Web resources about - Get computer name - sybase.powerbuilder.general

Computer - Wikipedia, the free encyclopedia
"Computer technology" and "Computer system" redirect here. For the company, see Computer Technology Limited . For other uses, see Computer (disambiguation) ...

Computer - Wikipedia, the free encyclopedia
"Computer technology" and "Computer system" redirect here. For the company, see Computer Technology Limited . For other uses, see Computer (disambiguation) ...

Computer Show
The first episode premiered at XOXO last month, and it brought the house down. I think you’re best off going in cold — just grab a beverage and ...

Intel and Google Equip Smartphones with 3D Cameras and Computer Vision
Computer vision and sensing are crucial for cars, robots, drones and many other applications. However, existing devices such as personal computers ...

Pushbullet adds picture messaging for computer
... was always there. It worked fine and I wondered why I had never used it before. This morning I realized why – Pushbullet just added computer-based ...

3 ways to optimize your iPhone and computer for $81 total
If your iOS devices had a new year’s resolution, it would be to run faster, better, and more securely. Luckily, we’ve got an easy way to make ...

Microsoft gives Reed College $500K to help build new computer science program
Liberal arts bastion Reed College has raised almost $5 million for its new computer science program. Now it can count Microsoft as a backer. ...

What Are People Building With 21 Inc’s Bitcoin Computer?
While it's still early days, there are a number of intriguing projects built around 21 Inc's Bitcoin Computer. CoinDesk looks at the best.

Sample computer and e-mail usage policy
This one-page computer and email usage policy from a manufacturing company with fewer than 50 employees covers unauthorized access, software ...

ISIS Backer Joins Bundy's Militants, Hijacks Government Computers To Build Militia Website
A militant who recently joined Ammon Bundy's armed occupation of the Malheur National Wildlife Refuge as the resident computer expert is a follower ...

Resources last updated: 1/18/2016 3:47:19 PM