已得到視窗句柄后,使用
l_handle=guo_sendtext.FindWindowA(0,ls_wname)
ls_temp=sle_1.text
Clipboard(ls_temp)
guo_sendtext.SendMessage(3213642 ,guo_sendtext.WM_PASTE, 1, '')//可發送字符成功到目標文本框內
3213642是通過spy++獲得了文本框句柄,
因那個視窗有多個文本輸入框,而其句柄也是動態變化的。
uj5u.com熱心網友回復:
沒回呼函式.應用視窗句柄可以通過API得到.
//關于windows視窗操作的api
//根據行程獲得程式的主視窗
Function ulong GetProcessWindow_local(ulong processid) Library "user32.dll" alias for "GetProcessWindow"
//根據視窗獲得行程
SUBROUTINE GetWindowThreadProcessId_local(ulong hwnd, ref ulong pid) Library "user32.dll" alias for "GetWindowThreadProcessId"
Function ulong FindWindowA_local(String lpClassName,String lpWindowName) Library "user32.dll" alias for "FindWindowA"
Function Long SetWindowPos_local(Long hwnd, Long ord, Long px, Long py, Long dx, Long dy, Long uflag) Library "user32.dll" alias for "SetWindowPos"
Function int GetClassName_local(ulong hWnd, ref string lpClassName, int nMaxCount) library "user32" alias for "GetClassNameA"
function long GetWindowText_local(long hwnd, ref string lpString, long nMaxCount) library "user32" alias for "GetWindowTextA"
function long SetWindowText_local(long hwnd, string lpString ) library "user32" alias for "SetWindowTextA"
Function ulong FindWindow_Handle_local(ulong lpClassName,String lpWindowName) Library "user32.dll" alias for "FindWindowW"
Function ulong FindWindowEx_local(ulong hWnd1 , ulong hWnd2 , String lpClassName , String lpsz2 ) Library "user32" Alias for "FindWindowExA"
Function Ulong FindWindowByWindowName_local(String lp_WindowName ) Library "user32" Alias for "FindWindowByWindowNameA"
function ulong GetWindow_local(ulong hwindow,int nrelationship) library "user32.dll " alias for "GetWindow"
//將視窗恢復到原來的位置
SUBROUTINE SwitchToThisWindow_local(Long hWnd,boolean fAltTab ) Library "user32.dll" alias for "SwitchToThisWindow"
//獲得指定的視窗
Function ulong GetWindow_local(ulong hWd,ulong ul_wm_message) Library "user32.dll" alias for "GetWindow"
FUNCTION ulong lstrcat_local(ref string lpString1,ref string lpString2) LIBRARY "kernel32.dll" ALIAS FOR "lstrcatA"
FUNCTION ulong lstrcmp_local(ref string lpString1,ref string lpString2) LIBRARY "kernel32.dll" ALIAS FOR "lstrcmpA"
FUNCTION ulong lstrcmpi_local(ref string lpString1,ref string lpString2) LIBRARY "kernel32.dll" ALIAS FOR "lstrcmpiA"
FUNCTION ulong lstrcpy_local(ref string lpString1,ref string lpString2) LIBRARY "kernel32.dll" ALIAS FOR "lstrcpyA"
FUNCTION ulong lstrcpyn_local(ref string lpString1,ref string lpString2,ulong iMaxLength) LIBRARY "kernel32.dll" ALIAS FOR "lstrcpynA"
FUNCTION ulong lstrlen_local(ref string lpString) LIBRARY "kernel32.dll" ALIAS FOR "lstrlenA"
Function long StrCopy_local(long Destination, REF string Source, long Size) library "kernel32.dll" Alias for "RtlMoveMemory"
Function long LocalAlloc_local(long Flags, long Bytes) library "kernel32.dll" alias for "GetProcessWindow"
Function long LocalFree_local(long MemHandle) library "kernel32.dll"
FUNCTION ulong MapVirtualKeyA_local(UINT uCode, UINT uMapType) Library "user32.dll" alias for "MapVirtualKeyA"
//剪貼版得函式
FUNCTION boolean OpenClipboard_local( UINT hWndNewOwner) Library "user32.dll" alias for "OpenClipboard"
FUNCTION boolean EmptyClipboard_local( ) Library "user32.dll" alias for "EmptyClipboard"
FUNCTION boolean CloseClipboard_local() Library "user32.dll" alias for "CloseClipboard"
uj5u.com熱心網友回復:
求樓主給個流程或實體不?不甚感激,立馬結貼!uj5u.com熱心網友回復:
查詢一下在PB里如何遍歷視窗控制元件的貼子,應該可以幫到你uj5u.com熱心網友回復:
如果是sheet可以用pb本身的函式得到,如果api一般用findwindow函式
uj5u.com熱心網友回復:
請問如何實作:IF 復選框勾選 THEN 在資料庫表的添加一行,并在該行第二列添加一個欄位(值)。謝謝!轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/63682.html
標籤:API 調用
