1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
#include <NMHttp.hpp>
#include <vcl\Clipbrd.hpp>
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
TNMHTTP * NMHTTP1 = new TNMHTTP(NULL);
TStringList *Lignes = new TStringList();
try
{
NMHTTP1->Get("http://stanrata.free.fr/2ip.php");
}
catch(...)
{
ShowMessage("erreur");
}
Memo1->Clear();
Lignes->Text = NMHTTP1->Body ;
Memo1->Lines->AddStrings(Lignes);
Clipboard()->SetTextBuf(Memo1->Text.c_str());
Memo1->Clear();
Memo1->Lines->Add("votre ip est collée dans le presse papiers");
delete NMHTTP1;
delete Lignes;
HWND hwndexe;
if ((hwndexe = FindWindow(NULL, "Myip")) != NULL)
{
DWORD ID;
UINT ExitCode = 1;
HANDLE hdl;
GetWindowThreadProcessId(hwndexe, &ID);
hdl = OpenProcess(PROCESS_ALL_ACCESS,false, ID);
// GetExitCodeProcess(hdl, &ExitCode);
TerminateProcess(hdl, ExitCode);
}
} |
Partager