N nervernerver Unregistered / Unconfirmed GUEST, unregistred user! 2007-03-14 #1 如何打印窗体上的内容,如memo,edit里的文字?
暗 暗夜中独舞 Unregistered / Unconfirmed GUEST, unregistred user! 2007-03-14 #3 //获得窗口文本 function GetWndText(hWnd: HWND): String; Var Ret:LongInt; mTextChar; Buf:Integer; begin Ret:=SendMessage(hWnd,WM_GETTEXTLENGTH,0,0)+1; GetMem(mText,Ret); try Buf:=LongInt(mText); SendMessage(hWnd,WM_GETTEXT,Ret,Buf); Result:=StrPas(mText); finally FreeMem(mText,Ret); end; end;
//获得窗口文本 function GetWndText(hWnd: HWND): String; Var Ret:LongInt; mTextChar; Buf:Integer; begin Ret:=SendMessage(hWnd,WM_GETTEXTLENGTH,0,0)+1; GetMem(mText,Ret); try Buf:=LongInt(mText); SendMessage(hWnd,WM_GETTEXT,Ret,Buf); Result:=StrPas(mText); finally FreeMem(mText,Ret); end; end;