使用鈎子原理+dll 取得TAdvStringGrid資料 |
尚未結案
|
小船仔
一般會員 ![]() ![]() 發表:2 回覆:0 積分:0 註冊:2016-08-27 發送簡訊給我 |
各位大大好,
我使用鈎子原理(hookcell)能取得某個外部程式的TAdvStringGrid資料
但在取同一個外部程式的另一個TAdvStringGrid時,
只能取得該gird的row 0資料、總欄數及總列數
無法取得其他列數或欄數的資料內容
請問出現了什麼問題呢? 謝謝!!
以下為取得資料的程式碼: function MsgWndProc(hwnd: HWND; Msg: UINT; WParam: WPARAM; LParam: LPARAM): LRESULT; stdcall; var // SG: TStringGrid; SG:TDrawgrid; X, Y: Integer; begin case Msg of CM_QUERYROW: begin Result := -1; if P^.DestWnd <> 0 then begin SG := Pointer(FindControl(P^.DestWnd)); if SG <> nil then Result := SG.RowCount; end; Exit; end; CM_QUERYCOL: begin Result := -1; if P^.DestWnd <> 0 then begin SG := Pointer(FindControl(P^.DestWnd)); if SG <> nil then Result := SG.ColCount; end; Exit; end; CM_HOOKCELL: begin Result := -1; P^.Text[0] := #0; if P^.DestWnd <> 0 then begin SG := Pointer(FindControl(P^.DestWnd)); if SG <> nil then begin X := WParam; Y := LParam; if (X >= 0) and (X < SG.ColCount) and (Y >= 0) and (Y < SG.RowCount) then begin Result := Length(SG.Cells[X, Y]); if Result > 0 then begin StrPLCopy(P^.Text, SG.Cells[X, Y], 1024); end; end; end; end; Exit; end; end; Result := DefWindowProc(hwnd, Msg, WParam, LParam); end; 編輯記錄
小船仔 重新編輯於 2017-07-19 16:00:51, 註解 無‧
|
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |