How to get a name of PC?
Posted: Thu Nov 11, 2010 4:00 pm
Hello everyone
How to get a name of PC?
Please Help
Best Regards
How to get a name of PC?
Please Help
Best Regards
Exclusive forum for HMG, a Free / Open Source xBase WIN32/64 Bits / GUI Development System
http://mail.hmgforum.com/
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 lRetornodanielmaximiliano 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
Dear Frančekfprijatelj wrote:Hi
.........
function ComputerName()
RETURN hb_ValToStr(win_regRead("HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName\ComputerName") )
BRGS
Franček
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