PB-IDE Tools habe ich noch nicht versucht.
Die folgenden API-Funktionen könnten vielleicht in die richtige Richtung schubsen...
Code: Alles auswählen
;' show and hide windows ?
SetWindowPos_(hWnd, 0, 0, 0, 0, 0, #SWP_HIDEWINDOW | #SWP_NOSIZE | #SWP_NOMOVE | #SWP_FRAMECHANGED)
SetWindowPos_(hWnd, 0, 0, 0, 0, 0, #SWP_SHOWWINDOW | #SWP_NOSIZE | #SWP_NOMOVE | #SWP_FRAMECHANGED)
;' Special to #SWP_FRAMECHANGED (acc. to MSDN)
;' Applies new frame styles set using the SetWindowLong function. Sends a WM_NCCALCSIZE message to the window,
;' even if the window's size is not being changed. If this flag is not specified, WM_NCCALCSIZE is sent only
;' when the window's size is being changed.
;' get window client size
GetWindowRect_(hWnd, @rc.RECT)
;' width = rc\right-rc\left
;' height = rc\bottom-rc\top
;' move to x, y and to the top of the z-order
SetWindowPos_(hWnd, #HWND_TOPMOST, x, y, 0, 0, #SWP_NOSIZE|#SWP_NOACTIVATE)
Um die windows handle zu erhalten habe ich so ein kleines hilfstool (vielleicht hilft es dir ja auch)
Code: Alles auswählen
;' File: WindowUnderCursor.pb
;' Purpose: shows window under mouse cursor and all its parent windows
;' License: Free, unrestricted, no warranty
;'
Global hMainWnd
Procedure.s GetClassName(hWnd)
Protected cn${256}
GetClassName_(hWnd, @cn$, 256)
ProcedureReturn cn$
EndProcedure
Procedure.s GetWindowText(hWnd)
Protected wt${256}
GetWindowText_(hWnd, @wt$, 256)
ProcedureReturn wt$
EndProcedure
Procedure DebugWindowInfo(Level, hWnd, Text$)
Protected s$
s$ = Space(Level<<1)
AddGadgetItem(0, -1, s$+Text$)
AddGadgetItem(0, -1, s$+"+ Window Handle: 0x"+Hex(hWnd)+", ("+Str(hWnd)+")")
AddGadgetItem(0, -1, s$+"+ Classname : '"+GetClassName(hWnd)+"'")
AddGadgetItem(0, -1, s$+"+ Window Text : '"+GetWindowText(hWnd)+"'")
AddGadgetItem(0, -1, "")
EndProcedure
Procedure UpdateWindowInfo(MX, MY)
Static hCurrentWnd = -1
Protected hWnd, hWndParent, level
hWnd = WindowFromPoint_(MY<<32 | MX)
If hWnd <> hCurrentWnd And hWnd <> hMainWnd ;' new window under cursor
ClearGadgetItems(0)
level = 0
DebugWindowInfo(level, hWnd, "Window under Cursor")
hWndParent = GetParent_(hWnd)
While hWndParent
level + 1
DebugWindowInfo(level, hWndParent, "Parent Window (Level "+Str(level)+")")
hWndParent = GetParent_(hWndParent)
Wend
hCurrentWnd = hWnd ;' memorize
EndIf
EndProcedure
Procedure OnEventSizeWindow()
ResizeGadget(0, #PB_Ignore, #PB_Ignore, WindowWidth(0), WindowHeight(0))
EndProcedure
Procedure MainProgram()
hMainWnd = OpenWindow(0, 0, 0, 600, 400, "Windows ", #PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget)
If hMainWnd <> 0
ListViewGadget(0, 0, 0, 600, 400)
BindEvent(#PB_Event_SizeWindow, @OnEventSizeWindow(), 0)
AddWindowTimer(0, 1, 100)
Repeat
Select WaitWindowEvent()
Case #PB_Event_Timer
If EventTimer() = 1
UpdateWindowInfo(DesktopMouseX(), DesktopMouseY())
EndIf
Case #PB_Event_CloseWindow
Break
EndSelect
ForEver
RemoveWindowTimer(0, 1)
EndIf
ProcedureReturn 0
EndProcedure
End MainProgram()
; BoF
Mostly running PureBasic <latest stable version and current alpha/beta> (x64) on Windows 11 Home