程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> .NET網頁編程 >> .NET實例教程 >> 向遠程計算機發送按鍵

向遠程計算機發送按鍵

編輯:.NET實例教程
 這個是一人COM應用,利用客戶應用程序通過遠程服務器上的服務端應用發送按鍵。由於這段工作時間緊,我先將源代碼中部份內容貼上,並在資源中提供全部源代碼下載。  注意看到程序代碼裡“魔獸世界”四個字,大家就應該可以想到我用它是干什麼的了,不是要黑別人,而是要帶一個牧師小號,呵呵。
 ==========服務器端================
unit skSrv;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls,SyncObJS;

type
  TfrmskSrv = class(TForm)
    Panel1: TPanel;
    Panel2: TPanel;
    Panel3: TPanel;
    Button1: TButton;
    memInfo: TMemo;
    chkBlock: TCheckBox;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);

    procedure chkBlockClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmskSrv: TfrmskSrv;
  csection:TCriticalSection;
  InfoCount:integer;
  BlockInfo:integer;

implementation

{$R *.dfm}

procedure TfrmskSrv.Button1Click(Sender: TObject);
begin
  Close;
end;

procedure TfrmskSrv.FormCreate(Sender: TObject);
begin
  csection:=TCriticalSection.Create;
  BlockInfo:=0;
end;

procedure TfrmskSrv.FormDestroy(Sender: TObject);
begin
  csection.Free;
end;

procedure TfrmskSrv.chkBlockClick(Sender: TObject);
begin
 if chkBlock.Checked then
    InterlockedIncrement(BlockInfo)
 else
   InterlockedDecrement(BlockInfo);
end;

end.//======類型庫===========
unit SdkSrv_TLB;

// ************************************************************************ //
// WARNING                                                                   
// -------                                                                   
// The types declared in this file were generated from data read from a      
// Type Library. If this type library is explicitly or indirectly (via       
// another type library referring to this type library) re-imported, or the  
// 'Refresh' command of the Type Library Editor activated while editing the  
// Type Library, the contents of this file will be regenerated and all       
// manual modifications will be lost.                                        
// ************************************************************************ //

// PASTLWTR : 1.2
// File generated on 2007-08-07 19:37:40 from Type Library described below.

// ************************************************************************  //
// Type Lib: D:\MyPrograms\Sendkey\src\SdkSrv.tlb (1)
// LIBID: {3B01ECB9-6782-4B27-8BB4-84B2B4E4B962}
// LCID: 0
// Helpfile:
// HelpString: SdkSrv Library
// DepndLst:
//   (1) v2.0 stdole, (C:\Windows\system32\STDOLE2.TLB)
// ************************************************************************ //
{$TYPEDADDRESS OFF} // Unit must be compiled without type-checked pointers.
{$WARN SYMBOL_PLATFORM OFF}
{$WRITEABLECONST ON}
{$VARPROPSETTER ON}
interface

uses Windows, ActiveX, Classes, Graphics, StdVCL, Variants;
 

// ********************

*************************************************//
// GUIDS declared in the TypeLibrary. Following prefixes are used:       
//   Type LibrarIEs     : LIBID_xxxx                                     
//   CoClasses          : CLASS_xxxx                                     
//   DISPInterfaces     : DIID_xxxx    

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved