Fórum Capturar o nome do computador em uso #307483
03/01/2006
0
Pessoal alguém possui alguma rotina onde eu possa capturar o nome do computador que esta em uso naquele momento, ou no momento de login?
Abraço
Wagner
Wagnermarrane
Curtir tópico
+ 0Post mais votado
03/01/2006
Eniosb
Gostei + 1
Mais Posts
03/01/2006
Marcio.theis
procedure TForm1.BitBtn1Click(Sender: TObject); var Computer: PChar; CSize: DWORD; begin Computer:=#0; CSize:=MAX_COMPUTERNAME_LENGTH + 1; try GetMem(Computer,CSize); if Windows.GetComputerName(Computer,CSize ) then ShowMessage(Computer); finally FreeMem(Computer); end; end;
Gostei + 0
03/01/2006
Wagnermarrane
procedure TForm1.BitBtn1Click(Sender: TObject); var Computer: PChar; CSize: DWORD; begin Computer:=#0; CSize:=MAX_COMPUTERNAME_LENGTH + 1; try GetMem(Computer,CSize); if Windows.GetComputerName(Computer,CSize ) then ShowMessage(Computer); finally FreeMem(Computer); end; end;
Esta apresentando o seguinte erro
[Error] Unit1.pas(29): E2410 Unsafe pointer variables, parameters or consts only allowed in unsafe procedure
Gostei + 0
03/01/2006
Marcio.theis
Gostei + 0
03/01/2006
Wagnermarrane
Delphi 2005
Gostei + 0
03/01/2006
Marcio.theis
Gostei + 0
03/01/2006
Wagnermarrane
na declaração da variavel
var
Computer: PChar;
Gostei + 0
03/01/2006
Marcio.theis
procedure TForm1.BitBtn1Click(Sender: TObject); var buffer: array[0..255] of char; size: dword; begin size:=256; if GetComputerName(buffer, size) then ShowMessage(buffer); end;
Gostei + 0
03/01/2006
Wagnermarrane
Gostei + 0
03/01/2006
Wagnermarrane
desculpe me enganei ... na verdade a imcompatibilidade ocorre com StringBuilder e Array
em relação ao componente IDIPWatch, no delphi 2005 não encontrei a função LOCALNAME, até que existe a LOCAL IP mas a LOCALNAME não....
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)