主题:[原创]本人自己编写的直接终止净网先锋(网吧使用的软件)的源程序代码
程序头文件如下:
//---------------------------------------------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
#include <Grids.hpp>
#include <ValEdit.hpp>
#include "ImButton.h"
#include <ComCtrls.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TTimer *Timer1;
TImButton *ImButton1;
TPanel *Panel1;
TRichEdit *RichEdit1;
void __fastcall Timer1Timer(TObject *Sender);
void __fastcall ImButton1Click(TObject *Sender);
void __fastcall FormCreate(TObject *Sender);
private: // User declarations
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER(WM_QUERYENDSESSION,TMessage,OnWMQueryEndSession)
END_MESSAGE_MAP(TForm);
void __fastcall TForm1::OnWMQueryEndSession(TMessage &Message);
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
主程序体如下:
//---------------------------------------------------------------------------
#include <vcl.h>
#include "stdio.h"
#include "winreg.h"
#include "Registry.hpp"
#include "dos.h"
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "ImButton"
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::OnWMQueryEndSession(TMessage &Message)
{
Message.Result=0; //不允许关机。
}
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ImButton1Click(TObject *Sender)
{
ImButton1->Enabled=false;
HWND jwxf,jwxf1;bool bl[2];
AnsiString str="";
jwxf=FindWindow(NULL,"净网先锋");
if(jwxf != NULL)
{
PostMessage(jwxf, WM_QUIT, 0, 0);
str="执行结果1:MainPro.exe 进程已经终止!\n";
}
else str="执行结果1:未找到 MainPro.exe 进程!\n";
jwxf1=FindWindow(NULL,"AnnexPro");
if(jwxf1 != NULL)
{
PostMessage(jwxf1, WM_QUIT, 0, 0);
str=str+"执行结果2:AnnexPro.exe 进程已经终止!\n";
}
else str=str+"执行结果2:未找到 AnnexPro.exe 进程!\n";
ShowMessage(str);
Timer1->Enabled=true;
}
//---------------------------------------------------------------------------
以上的程序是我自己编写的,望各位点评点评,谢谢!!!!!
//---------------------------------------------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
#include <Grids.hpp>
#include <ValEdit.hpp>
#include "ImButton.h"
#include <ComCtrls.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TTimer *Timer1;
TImButton *ImButton1;
TPanel *Panel1;
TRichEdit *RichEdit1;
void __fastcall Timer1Timer(TObject *Sender);
void __fastcall ImButton1Click(TObject *Sender);
void __fastcall FormCreate(TObject *Sender);
private: // User declarations
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER(WM_QUERYENDSESSION,TMessage,OnWMQueryEndSession)
END_MESSAGE_MAP(TForm);
void __fastcall TForm1::OnWMQueryEndSession(TMessage &Message);
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
主程序体如下:
//---------------------------------------------------------------------------
#include <vcl.h>
#include "stdio.h"
#include "winreg.h"
#include "Registry.hpp"
#include "dos.h"
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "ImButton"
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::OnWMQueryEndSession(TMessage &Message)
{
Message.Result=0; //不允许关机。
}
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ImButton1Click(TObject *Sender)
{
ImButton1->Enabled=false;
HWND jwxf,jwxf1;bool bl[2];
AnsiString str="";
jwxf=FindWindow(NULL,"净网先锋");
if(jwxf != NULL)
{
PostMessage(jwxf, WM_QUIT, 0, 0);
str="执行结果1:MainPro.exe 进程已经终止!\n";
}
else str="执行结果1:未找到 MainPro.exe 进程!\n";
jwxf1=FindWindow(NULL,"AnnexPro");
if(jwxf1 != NULL)
{
PostMessage(jwxf1, WM_QUIT, 0, 0);
str=str+"执行结果2:AnnexPro.exe 进程已经终止!\n";
}
else str=str+"执行结果2:未找到 AnnexPro.exe 进程!\n";
ShowMessage(str);
Timer1->Enabled=true;
}
//---------------------------------------------------------------------------
以上的程序是我自己编写的,望各位点评点评,谢谢!!!!!