[轉貼]如何取得unicode text control 的內容(test) (WM_GETTEXT)

有關Delphi 的語法, 程式, 等
回覆文章
頭像
tim
文章: 1380
註冊時間: 2008年 11月 26日, 00:49

[轉貼]如何取得unicode text control 的內容(test) (WM_GETTEXT)

文章 tim »

請參考,
http://www.delphipraxis.net/topic37467_ ... icode.html

代碼: 選擇全部

     
    function GetWindowText(wnd: HWND): WideString; 
    var  
      TextLength: Integer;  
      Text: PWideChar;  
    begin 
      Result := '';  
      if wnd = 0 then  
        Exit; 
      TextLength := SendMessageW(wnd, WM_GETTEXTLENGTH, 0, 0); 
      if TextLength <> 0 then  
      begin  
        GetMem(Text, TextLength * 2  + 1);  
        SendMessageW(wnd, WM_GETTEXT, TextLength + 1, Integer(Text));  
        Result := Text;  
        FreeMem(Text);  
      end;  
    end; 
多多留言, 整理文章, 把經驗累積下來.....
回覆文章