Posted: Mon Sep 08, 2008 3:30 pm
Sparkie,
thank you for your nice StatusBar coloring example. But I have to point out that it isn't sufficient to test for a windows version to be greater or equal to WindowsXP because nevertheless an error is reported if running on WinNT and Win9x. The compiler doesn't really care for that if-statement and nevertheless tries to find the UXTheme.DLL for GetWindowTheme_() and SetWindowTheme_(). It reports this error in a lengthy error message box listing all the directory paths in which it has searched for that DLL. In order to circumvent this problem you have to use OpenLibrary() and use SetWindowTheme with CallFunction():
thank you for your nice StatusBar coloring example. But I have to point out that it isn't sufficient to test for a windows version to be greater or equal to WindowsXP because nevertheless an error is reported if running on WinNT and Win9x. The compiler doesn't really care for that if-statement and nevertheless tries to find the UXTheme.DLL for GetWindowTheme_() and SetWindowTheme_(). It reports this error in a lengthy error message box listing all the directory paths in which it has searched for that DLL. In order to circumvent this problem you have to use OpenLibrary() and use SetWindowTheme with CallFunction():
Code: Select all
#SB_SETBKCOLOR = #CCM_SETBKCOLOR
Procedure.L DisableXPSkin(Handle.L)
Protected LibHandle.L
Protected Result.L
LibHandle = OpenLibrary(#PB_Any, "UXTheme.DLL")
If LibHandle = 0
ProcedureReturn #False
Else
Result = CallFunction(LibHandle, "SetWindowTheme", Handle, @" ", @" ")
CloseLibrary(LibHandle)
If Result <> #S_OK
ProcedureReturn #False
EndIf
EndIf
ProcedureReturn #True
EndProcedure
If OpenWindow(0, 0, 0, 355, 180, "Statusbar Color", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
SetWindowColor(0, RGB(100, 100, 255))
hStatus = CreateStatusBar(0, WindowID(0))
SendMessage_(hStatus, #SB_SETBKCOLOR, 0, GetWindowColor(0))
;...Any XP theme will need to be removed from StatusBar
If OSVersion() >= #PB_OS_Windows_XP
DisableXPSkin(hStatus)
EndIf
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf