jsTree e jQuery

Pesquisar este blog

Contribua

Te ajudei? Quer retribuir? PIX de qualquer quantia.

3D Game Builder - Obter IP Externo

Baixe o arquivo:
http://wsantos.eti.br/3d_game_builder/ipexterno.rar

Descompacte o arquivo onde o .exe do seu projeto se encontra.

No OnCreate do mapa:
[code]
const SW_HIDE = 0;       // prompt roda oculto 
const SW_SHOWNORMAL = 1; // prompt será mostrado

SaveStringToFile('c:\saida_ipexterno.txt', 'Aguarde 30 segundos e tente novamente.'); 
ShellExecute('open', 'cmd.exe', '/C ipexterno > c:\saida_ipexterno.txt', NULL, SW_HIDE);
[/code]

No OnInteract do botão:
[code]
var stringList    : TStringList;
var strInicial    : String;
var intPosInicial : Integer;
var intPosFinal   : Integer;
var intQtd        : Integer;

stringList := TStringList.Create(); 
stringList.LoadFromFile('c:\saida_ipexterno.txt');

strInicial    := 'Address: ';
intPosInicial := Pos(strInicial, stringList.GetText());

if (intPosInicial = 0) then
begin 
    SetLabelText('Label1', stringList.GetText());
end
else
begin
    intPosInicial := intPosInicial + Length(strInicial); 
    intPosFinal   := Pos('</body>'  , stringList.GetText());
    intQtd        := intPosFinal - intPosInicial;
    SetLabelText('Label1', copy(stringList.GetText(), intPosInicial, intQtd));
end;
[/code]

Aqui está o exemplo completo:
http://wsantos.eti.br/3d_game_builder/ExemploIPExterno.rar


Nenhum comentário:

Postar um comentário