全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1790
推到 Plurk!
推到 Facebook!

請問如何送字串到 PCMan Novus?

尚未結案
IOann
一般會員


發表:2
回覆:1
積分:0
註冊:2009-02-23

發送簡訊給我
#1 引用回覆 回覆 發表時間:2009-06-15 15:18:03 IP:140.129.xxx.xxx 訂閱
以下是參考網路上的資料,用 SendMessage 做的實例。
已可傳送字串至記事本,但無法送至 PCMan Novus 中,請問還要做什麼修改呢?

[code delphi]
unit EfficientPost;

interface

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

type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Label1: TLabel;
Label2: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
hWnd: THandle;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
hc: THandle;
begin
Button1.Enabled := False;
Button2.Enabled := True;
// hWnd:= FindWindow(nil,'台大批踢踢實業坊 - PCMan');
hWnd:= FindWindow(nil,'EfficientPost.txt - 記事本');
// SetForegroundWindow(hWnd);
// SendMessage(hWnd, WM_SETTEXT, 4, longint(PChar('123')));
hc := GetWindow(hWnd, GW_CHILD);
// hc := GetNextWindow(hc, GW_HWNDNEXT);
SendMessage(hc, WM_Char, ord('abcdefg'), 0);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
Button2.Enabled := False;
Button1.Enabled := True;
end;

end.

[/code]
編輯記錄
IOann 重新編輯於 2009-06-15 18:14:47, 註解 無‧
系統時間:2024-04-24 3:13:35
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!