Declare-Windows
From Xojo Documentation
Contents
Flash App Indicator in Task Bar
Declare Function FlashWindow Lib "User32" (HWND As Integer, invert As Boolean) As Boolean
Call FlashWindow(MyWindow.Handle, True) ' flash once
Call FlashWindow(MyWindow.Handle, True) ' flash once
Enable Window Compositing
Sub EnableComposite(w As Window)
#If TargetWindows
Const GWL_EXSTYLE = -20
Const WS_EX_COMPOSITED = &h2000000
Declare Function GetWindowLongW Lib "user32" (hwnd As Integer, nIndex As Int32) As Integer
Dim style As Integer = GetWindowLongW(w.Handle, GWL_EXSTYLE)
style = BitwiseOr(style, WS_EX_COMPOSITED)
Declare Sub SetWindowLongW Lib "user32" (hwnd As Integer, nIndex As Int32, dwNewLong As Integer)
SetWindowLongW(w.Handle, GWL_EXSTYLE, style)
#EndIf
End Sub
#If TargetWindows
Const GWL_EXSTYLE = -20
Const WS_EX_COMPOSITED = &h2000000
Declare Function GetWindowLongW Lib "user32" (hwnd As Integer, nIndex As Int32) As Integer
Dim style As Integer = GetWindowLongW(w.Handle, GWL_EXSTYLE)
style = BitwiseOr(style, WS_EX_COMPOSITED)
Declare Sub SetWindowLongW Lib "user32" (hwnd As Integer, nIndex As Int32, dwNewLong As Integer)
SetWindowLongW(w.Handle, GWL_EXSTYLE, style)
#EndIf
End Sub
Declare Example Projects
- Examples/Advanced/GetPID
- Examples/Advanced/WindowOpacity
- Examples/Platform-Specific/Windows/CommandLinkExample
- Examples/Platform-Specific/Windows/CPUUsage
- Examples/Platform-Specific/Windows/CustomWindowShape
- Examples/Platform-Specific/Windows/DeclareDrawing
- Examples/Platform-Specific/Windows/SetWindowIcon
Other Resources
These external sources of information might also be helpful when working with Declares on Windows:
- WinAPILib library on GitHub
- Calling Native Windows APIs
- Windows Functionality Suite on GitHub
- Windows APIs to Xojo data type conversion
- Implement Declares with Xojo on Windows book from xDevLibrary