How to get a name of PC?
Moderator: Rathinagiri
-
huangchenmin
- Posts: 157
- Joined: Mon Jun 07, 2010 2:24 am
How to get a name of PC?
Hello everyone
How to get a name of PC?
Please Help
Best Regards
How to get a name of PC?
Please Help
Best Regards
- danielmaximiliano
- Posts: 2763
- Joined: Fri Apr 09, 2010 4:53 pm
- DBs Used: DBF
- Location: Argentina
- Contact:
Re: How to get a name of PC?
use GEtenv
Source http://www.harbour-project.org/doc/getenv.htm
Understanding Windows XP's environment variables
http://articles.techrepublic.com.com/51 ... 86211.html
Saludos
DaNiElMaXiMiLiAnO
Code: Select all
FUNCTION MYRUN(cComando,nStyle,lWait,lShowResult)
LOCAL oShell, RET, lRetorno:=.T.
*
IF OS_IsWin9x() .or. OS_IsWin98()
RUN (cComando)
ELSE
IF valtype( nStyle ) != "N"
nStyle := 0
ENDIF
IF ValType( lWait ) != "L"
lWait := .T.
ENDIF
IF ValType( lShowResult ) != "L"
lShowResult := .F.
ENDIF
*
TRY
oShell := CreateObject( "WScript.Shell" )
IF !GetEnv( "OS" ) == "Windows_NT"
cComando += "start " + cComando
ENDIF
RET := oShell:Run( "%comspec% /c " + cComando, nStyle, lWait )
IF lShowResult .AND. RET > 0 .and. RET <= 32
MessageBox(,"Erro Win_Run(): "+ltrim(Str( RET )))
ENDIF
oShell := NIL
lRetorno:=(RET==0)
CATCH oErro
TRY
RUN (cComando)
CATCH oErro
MessageBox(,'Erro ao rodar MYRUN()')
END
END
ENDIF
RETURN lRetornoUnderstanding Windows XP's environment variables
http://articles.techrepublic.com.com/51 ... 86211.html
Saludos
DaNiElMaXiMiLiAnO
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*
Saludos / Regards
DaNiElMaXiMiLiAnO
Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
Telegram invitation https://t.me/HMGWorkspace
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*
Saludos / Regards
DaNiElMaXiMiLiAnO
Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
Telegram invitation https://t.me/HMGWorkspace
- Rathinagiri
- Posts: 5482
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: How to get a name of PC?
Great! Thanks a lot Daniel.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
-
huangchenmin
- Posts: 157
- Joined: Mon Jun 07, 2010 2:24 am
Re: How to get a name of PC?
danielmaximiliano wrote:use GEtenvCode: Select all
FUNCTION MYRUN(cComando,nStyle,lWait,lShowResult) LOCAL oShell, RET, lRetorno:=.T. ............. [b]DaNiElMaXiMiLiAnO[/b][/quote] Got it! Appreciate! Thanks for your supports. Best Regards chen min
-
fprijatelj
- Posts: 14
- Joined: Wed Mar 10, 2010 4:09 pm
Re: How to get a name of PC?
Hi
Computer name is stored in registry entry:
"HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName\ComputerName"
Here is a code:
#include "hbwin.ch"
PROCEDURE Main()
?ComputerName()
RETURN
function ComputerName()
RETURN hb_ValToStr(win_regRead("HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName\ComputerName") )
BRGS
Franček
Computer name is stored in registry entry:
"HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName\ComputerName"
Here is a code:
#include "hbwin.ch"
PROCEDURE Main()
?ComputerName()
RETURN
function ComputerName()
RETURN hb_ValToStr(win_regRead("HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName\ComputerName") )
BRGS
Franček
- Rathinagiri
- Posts: 5482
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: How to get a name of PC?
Fantastic. Thanks Franček
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
-
huangchenmin
- Posts: 157
- Joined: Mon Jun 07, 2010 2:24 am
Re: How to get a name of PC?
Dear Frančekfprijatelj wrote:Hi
.........
function ComputerName()
RETURN hb_ValToStr(win_regRead("HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName\ComputerName") )
BRGS
Franček
Very impressive!
Allow me a silly question!
Is hb_valtostr()、win_regread() harbour or HMG build-in function ?
-
fprijatelj
- Posts: 14
- Joined: Wed Mar 10, 2010 4:09 pm
Re: How to get a name of PC?
Hi
Both functions are Harbour functions (hbwin.lib).
But you can use HMG function RegistryRead( cRegPath ) instead.
Best regards
Franček
Both functions are Harbour functions (hbwin.lib).
But you can use HMG function RegistryRead( cRegPath ) instead.
Best regards
Franček
-
huangchenmin
- Posts: 157
- Joined: Mon Jun 07, 2010 2:24 am
Re: How to get a name of PC?
Got it!fprijatelj wrote:Hi
Both functions are Harbour functions (hbwin.lib).
But you can use HMG function RegistryRead( cRegPath ) instead.
Best regards
Franček
Thanks for your supports!
Rest Regards
chen min