Skip to content

Instantly share code, notes, and snippets.

@stuncloud
Last active November 26, 2020 09:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stuncloud/432e8267f08e738c71fafd011b8ea36f to your computer and use it in GitHub Desktop.
Save stuncloud/432e8267f08e738c71fafd011b8ea36f to your computer and use it in GitHub Desktop.
デスクトップの中にウィンドウを移動させるやつ
call WindowInDesktop.uws
WindowInDesktop.Start() // 準備
balloon("hogehoge")
WindowInDesktop.Set(getid(GET_BALLOON_WIN))
thread ThreadSetSlctbox()
ret = slctbox(SLCT_STR, 0, "なんか押す", "foo", "bar", "bax")
msgbox(ret + " が押されました")
procedure ThreadSetSlctbox()
public WindowInDesktopResult
id = getid("", "TUslctBox_uwsc", 10)
WindowInDesktopResult = WindowInDesktop.Set(id)
fend
module WindowInDesktop
hashtbl WorkerW
function Start()
def_dll SendMessageTimeoutA(hwnd, uint, uint, long, uint, uint var dword):int:user32.dll
// WorkerWを追加
progman = getid("", "Progman")
hProgman = idtohnd(progman)
ret = 0
result = SendMessageTimeoutA(hProgman, $052C, 0, 0, 0, 1000, ret) <> 0
fend
function Set(id)
def_dll SetParent(hwnd, hwnd):hwnd:user32.dll
// 追加したWorkerWのIDを得る
flg = FALSE
WorkerW[id] = -1
for id1 in getallwin()
if getallwin(id1) = 0 then continue
for id2 in ALL_WIN_ID
if flg then break
if status(id2, ST_CLASS) = "SHELLDLL_DefView" then
flg = TRUE
break
endif
continue 2
next
if status(id1, ST_CLASS) = "WorkerW" then
if status(id1, ST_PARENT) = -1 then
WorkerW[id] = id1
break
endif
endif
next
result = SetParent(idtohnd(id), idtohnd(WorkerW[id])) > 0
fend
// procedure Dispose(id)
// ctrlwin(id, CLOSE)
// ctrlwin(WorkerW[id], CLOSE)
// fend
endmodule
@stuncloud
Copy link
Author

後始末をどうするべきなのかわかってないし終了後の状態も確認してません
心配ならタスクマネージャからエクスプローラを右クリックして再起動させる

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment