Code: Select all
DEFINE title$ = Space(100)
DEFINE hwnd.l = GetTopWindow_(GetDesktopWindow_())
REPEAT
hwnd = GetNextWindow_(hwnd, #GW_HWNDNEXT)
IF hwnd = #NULL : BREAK : ENDIF
GetWindowText_(hwnd, @title$, len(title$))
debug title$
FOREVER
Code: Select all
DEFINE title$ = Space(100)
DEFINE hwnd.l = GetTopWindow_(GetDesktopWindow_())
REPEAT
hwnd = GetNextWindow_(hwnd, #GW_HWNDNEXT)
IF hwnd = #NULL : BREAK : ENDIF
GetWindowText_(hwnd, @title$, len(title$))
debug title$
FOREVER
Code: Select all
EnableExplicit
DEFINE title$ = Space(100)
DEFINE hwnd.l = GetTopWindow_(GetDesktopWindow_())
REPEAT
hwnd = GetWindow_(hwnd, #GW_HWNDNEXT)
IF hwnd = #Null : BREAK : ENDIF
GetWindowText_(hwnd, @title$, GetWindowTextLength_(hwnd)+1)
debug hwnd
debug title$
FOREVER
You will run into the occasional API that isn't natively imported into PB and when that happens you must find your own way to make it available. You have two choices, both of which usually work but not always. These are: 1) OpenLibrary and 2) Import.Are some win32 functions just not supported?
Code: Select all
Prototype PrintWindow(hWnd, hDC, nFlags)
user32 = OpenLibrary(#PB_Any, "user32.dll")
Global PrintWindow_.PrintWindow = GetFunction(user32, "PrintWindow")
; Import "user32.lib"
; PrintWindow_(hwnd, hdc, flags) As "_PrintWindow@12"
; EndImport
hwnd = FindWindow_(0, "PureBasic 5.20 LTS (x86)") ; Change this to whatever the title of your IDE main window is
GetWindowRect_(hwnd, this.RECT)
w = this\right-this\left
h = this\bottom-this\top
CreateImage(0, w, h, 24)
hdc = StartDrawing(ImageOutput(0))
PrintWindow_(hwnd, hdc, 0)
StopDrawing()
OpenWindow(0,0,0,512,512,"",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)
ImageGadget(0,0,0,0,0,ImageID(GrabImage(0,#PB_Any,0,0,512,512)))
Repeat:Until WaitWindowEvent() = #PB_Event_CloseWindow
Code: Select all
Import "c:\program files\microsoft platform sdk\lib\user32.lib"