SendMessage 向文本框发送内容和回车事件
var Ret: LongInt; mText: PChar; Buf: Integer; sCode:string; begin sCode:='123213123'; GetMem(mText, Length(sCode)); StrCopy(mText, PChar(sCode)); Buf := LongInt(mText); SendMessage(hand,WM_SETTEXT,0,Buf); //向主界面的文本框发送商品条码 PostMessage(hand, WM_KEYDOWN,VK_RETURN,0);//回车事件 PostMessage(hand, WM_KEYUP,VK_RETURN,0); end;