|
getitem(id,ITM_EDIT)で取得できる項目を番号で指定するなりしてクリック(選択)したいのですが、方法がわかりません…。 MMVとBTNの低レベル関数では可能とは思いますが、他に方法はあるのでしょうか?
|
No.1240 2021/03/07(Sun) 09:16:32
|
☆ Re: ITM_EDITで取得できる項目の選択 / stuncloud |
|
|
|
任意の値を持つエディットコントロールをフォーカスする関数を書いてみました 思ったよりでかくなった…
・使い方
id = getid("対象ウィンドウ") print FocusEdit(id, "選択したい文字列") // TRUEなら成功 print FocusEdit(id, "選択したい文字列", 2) // 複数ある場合は順番を指定
// 空のエディットコントロールなら順番指定でうまいことやってください // ただし順番指定はエディットコントロール全体ではなく // 該当する値を持つエディットコントロールのみが対象です
print FocusEdit(id, "", n)
// [ ] nが1ならここが選ばれる // [あ ] // [ ] 2ならここ // [ ] 3ならここ
// 実装 // def_dllは関数の外に書いても大丈夫です function FocusEdit(parent, text = "", count = 1) def_dll SendMessageA(hwnd, long, long, var string):long:user32 def_dll SetFocus(hwnd):hwnd:user32.dll def_dll GetWindowThreadProcessId(hwnd, dword):dword:user32.dll def_dll AttachThreadInput(dword, dword, bool):dword:user32.dll result = FALSE for id in getallwin(parent) if status(id, ST_CLASS) = "Edit" then buffer = format(chr(0), 1024) h = idtohnd(id) SendMessageA(h, $000D, lengthb(buffer), buffer) if buffer = text then count = count - 1 if count = 0 then edit = GetWindowThreadProcessId(idtohnd(parent), 0) self = GetWindowThreadProcessId(idtohnd(getid(GET_THISUWSC_WIN)), 0) AttachThreadInput(edit, self, TRUE) result = SetFocus(h) = h AttachThreadInput(edit, self, FALSE) break endif endif endif next fend
|
No.1242 2021/03/07(Sun) 15:51:37
|
|
☆ Re: ITM_EDITで取得できる項目の選択 / しろまさ |
|
|
|
// こんな方法もあります
id = exec("notepad") SendStr(id, "class位置テスト") ScKey(id, VK_CTRL, VK_H) // 置換ウィンドウ呼出
idDlg = GetID("置換", "#32770", 2) hdEdt = GetCtlHND(idDlg, "Edit", 2) // class指定でハンドル取得 idEdt = HNDtoID(hdEdt) // オブジェクトのDlg内座標(相対座標)を作成 xEdt = Status(idEdt, ST_X) - Status(idDlg, ST_CLX) yEdt = Status(idEdt, ST_Y) - Status(idDlg, ST_CLY) MouseOrg(idDlg, 1) BTN(LEFT, CLICK, xEdt +7, yEdt +7) // 相対座標クリック MouseOrg(0)
|
No.1243 2021/03/08(Mon) 10:44:49
|
|