AcidUser Posted November 23, 2011 Share Posted November 23, 2011 Hello All!I wanted to create simple looking two-dimensional Gui.On Windows 7 it looks awesome and the button is looking like expected based on Autoit Manual using "$BS_FLAT" style.However, running the same code on Windows XP (Classic Theme) shows that Gui Window is two dimensional, but a Button is with ugly border.I found a thread describing the same problem here: So I added this string: DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)to my project, but result is the same.Is there anything I can do to make button look like it is expected with "$BS_FLAT" style on Windows XP?I tried messing with GuiCtrlCreateLabel, but it is not usable, since if you enable black square, the text of lable will become not visible.Looking forward for advice from experienced AutoIt users.Thanks in advance.Here is a code:expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <StaticConstants.au3> #include <GuiMenu.au3> #include <WinAPI.au3> #include <date.au3> Opt("GUIOnEventMode", 1) Global $afksleep, $lasth, $lastm, $lasts Global $begin = 1000 * 60 * 60 * 2 ; 2 Hours $afksleep = $begin Global $start = TimerInit() Global $WINDOW_WIDTH = @DesktopWidth/5 Global $WINDOW_HEIGHT = @DesktopHeight/8 Global $WINDOW_STYLE = $WS_POPUP Global $WINDOW_EX_STYLE = $WS_EX_TOPMOST Global $WINDOW_BG_COLOR = 0xADD8E6 Global $WINDOW_TITLE_ID Global $WINDOW_TITLE_WIDTH = $WINDOW_WIDTH-10 Global $WINDOW_TITLE_HEIGHT = $WINDOW_HEIGHT/6 Global $WINDOW_TITLE_STYLE = $SS_LEFT Global $WINDOW_TITLE_BG_COLOR = 0xADD8E6 Global $WINDOW_TITLE_TXT_COLOR = 0x000000 Global $WINDOW_TITLE_TXT = " Adobe Reader 10.1.1 installation:" Global $CANCEL_BUTTON_ID Global $CANCEL_BUTTON_TITLE = "Cancel" Global $CANCEL_BUTTON_WIDTH = $WINDOW_WIDTH/3 Global $CANCEL_BUTTON_HEIGHT = -1 Global $CANCEL_BUTTON_LEFT = ($WINDOW_WIDTH-$CANCEL_BUTTON_WIDTH)/2 Global $CANCEL_BUTTON_TOP = $WINDOW_HEIGHT-($WINDOW_HEIGHT/4) Global $CANCEL_BUTTON_STYLE = BitOR($BS_CENTER,$BS_VCENTER,$BS_FLAT,$GUI_ONTOP) $CANCEL_BUTTON_COLOR = 0xADD8E6 Global $FAKE_BUTTON_ID Global $FAKE_BUTTON_STYLE = BitOR($BS_FLAT,$GUI_FOCUS) Global $PROCESS_1 = "iexplore.exe" Global $PROCESS_1_APP = "Internet Explorer" Global $PROCESS_2 = "Firefox.exe" Global $PROCESS_1_APP = "Firefox" Global $PROCESS_3 = "Adrd32.exe" Global $PROCESS_1_APP = "Adobe Reader" Global $CD_TIMER_ID Global $CD_TIMER_LEFT = 5 Global $CD_TIMER_TOP = $WINDOW_TITLE_WIDTH Global $CD_TIMER_WIDTH = $WINDOW_WIDTH-(2*$CD_TIMER_LEFT) Global $CD_TIMER_HEIGHT = -1 Global $CD_TIMER_STYLE = $SS_CENTERIMAGE $Form1 = GUICreate("", $WINDOW_WIDTH, $WINDOW_HEIGHT, -1, -1, $WINDOW_STYLE, $WINDOW_EX_STYLE) ;$size = WinGetClientSize($Form1) ;$iTitle_Height = 20 $WINDOW_TITLE_ID = GUICtrlCreateLabel($WINDOW_TITLE_TXT, 5, 5, $WINDOW_TITLE_WIDTH, 30, $WINDOW_TITLE_STYLE) ; GUICtrlSetResizing($WINDOW_TITLE_ID,$GUI_DOCKALL) MsgBox(64,"",$WINDOW_TITLE_HEIGHT) ;$WINDOW_TITLE_SIZES = WinGetPos(GuiCtrlGetHandle($WINDOW_TITLE_ID)) ;GUICtrlSetPos($WINDOW_TITLE_ID, 0, 0, $WINDOW_TITLE_WIDTH, $WINDOW_TITLE_SIZES[3]+5) ; $WINDOW_TITLE_ID = GUICtrlCreateLabel($WINDOW_TITLE_TXT, 0, 0, -1, -1, $WINDOW_TITLE_STYLE) ; GUICtrlSetBkColor($WINDOW_TITLE_ID, $WINDOW_TITLE_BG_COLOR) GUICtrlSetColor($WINDOW_TITLE_ID, $WINDOW_TITLE_TXT_COLOR) GUICtrlSetFont($WINDOW_TITLE_ID, Default, 600) ;$CD_TIMER_ID = GUICtrlCreateLabel("", $CD_TIMER_LEFT, $CD_TIMER_TOP, $CD_TIMER_WIDTH , $CD_TIMER_HEIGHT, $CD_TIMER_STYLE) ;GUICtrlSetFont($CD_TIMER_ID, Default, 600) ;GUICtrlSetBkColor($CD_TIMER_LABLE,0xCD3700) $CANCEL_BUTTON_ID = GUICtrlCreateButton($CANCEL_BUTTON_TITLE, $CANCEL_BUTTON_LEFT, $CANCEL_BUTTON_TOP, $CANCEL_BUTTON_WIDTH, $CANCEL_BUTTON_HEIGHT, $CANCEL_BUTTON_STYLE) $FAKE_BUTTON_ID = GUICtrlCreateButton("", 1, 1,1, 1,$FAKE_BUTTON_STYLE) ;GUICtrlCreateLabel("",5,25,$size[0],2,$SS_SUNKEN) ;GUICtrlCreateGraphic(5,25,390,2,$SS_SUNKEN) GUICtrlSetState($CANCEL_BUTTON_ID,$GUI_NOFOCUS) GUICtrlSetState($FAKE_BUTTON_ID,$GUI_FOCUS) GUICtrlSetState($FAKE_BUTTON_ID,@SW_HIDE) GUICtrlSetBkColor($CANCEL_BUTTON_ID, $CANCEL_BUTTON_COLOR) GUISetBkColor($WINDOW_BG_COLOR) GUICtrlSetResizing($CANCEL_BUTTON_ID,$GUI_DOCKALL) GUICtrlSetResizing($FAKE_BUTTON_ID,$GUI_DOCKALL) GUICtrlSetResizing($CD_TIMER_ID,$GUI_DOCKALL) GUIRegisterMsg($WM_SYSCOMMAND, "On_WM_SYSCOMMAND") DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0) ;Don't Use WinXP Theme GUISetState(@SW_SHOW) GUICtrlSetOnEvent($CANCEL_BUTTON_ID, "CancelButtonPressed") While ($afksleep > 0) AND (ProcessExists("iexplore.exe") OR ProcessExists("Firefox.exe")) $afksleep = $begin - TimerDiff($start) GoToBathroom() Sleep(1000) WEnd CheckProcess() Func CancelButtonPressed() CheckProcess() EndFunc Func CheckProcess() If Not (ProcessExists("iexplore.exe") OR ProcessExists("Firefox.exe")) Then Exit(0) Else Exit(1) EndIf EndFunc Func On_WM_SYSCOMMAND($hWnd, $Msg, $wParam, $lParam) If BitAND($wParam, 0xFFF0) = $SC_MOVE Then Return False Return $GUI_RUNDEFMSG EndFunc Func GoToBathroom() Local $iHours, $iMins, $iSecs, $CD_TIMER _TicksToTime($afksleep, $iHours, $iMins, $iSecs) If $lasth <> $iHours Or $lastm <> $iMins Or $lasts <> $iSecs Then $CD_TIMER = "Estimated wait time: " & $iHours & ":" & StringFormat("%02d",$iMins) & ":" & StringFormat("%02d",$iSecs) GUICtrlSetData($CD_TIMER_ID,$CD_TIMER) ;ToolTip("Please close all open Internet Browsers (IE, FireFox) and Adobe Reader" & @CR & "Estimated wait time: " & $iHours & ":" & StringFormat("%02d",$iMins) & ":" & StringFormat("%02d",$iSecs), @DesktopWidth/2, @DesktopHeight/2, "Adobe Reader X Installation:", 2, 6) $lasth = $iHours $lastm = $iMins $lasts = $iSecs EndIf EndFunc ;==>GoToBathroom Link to comment Share on other sites More sharing options...
AcidUser Posted November 23, 2011 Author Share Posted November 23, 2011 *bump* anyone? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 23, 2011 Moderators Share Posted November 23, 2011 AcidUser, Please do not bump your own posts within 24 hours. Remember this is not a 24/7 support forum - those who answer are only here because they like helping others and have some time to spare. You just have to wait until someone who knows something about your particular problem, and is willing to help, comes online. Be patient and someone will answer eventually. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
AcidUser Posted November 23, 2011 Author Share Posted November 23, 2011 OK! I just was used that previously I received answers within couple of minutes. I'm not sure whether this thread should be here on in a bug report section. Link to comment Share on other sites More sharing options...
spudw2k Posted November 23, 2011 Share Posted November 23, 2011 Doubt its a bug, prob more a compatibility issue. Have you tried any options that DO work as you desire on XP? Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
ChrisN Posted November 26, 2011 Share Posted November 26, 2011 Put an icon on! Link to comment Share on other sites More sharing options...
Marshin Posted June 20, 2012 Share Posted June 20, 2012 I am also interested in getting this to work in XP. Are there any updates to getting this to display correctly?? At last, after two thousand years of research, the illudium Q-36 explosive space modulator.Well, back to the old drawing board. Link to comment Share on other sites More sharing options...
JScript Posted June 22, 2012 Share Posted June 22, 2012 (edited) See this example: #include <guiconstantsex.au3> #include <windowsconstants.au3> #include <buttonconstants.au3> _Example() ; example Func _Example() Local $iMsg, $iButton1 GUICreate("My GUI", 320, 240) ; will create a dialog box that when displayed is centered $iButton1 = GUICtrlCreateButton("Start", 105, 100, 100, -1, $BS_FLAT) ; Disable Win Theme in button... DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($iButton1), "wstr", 0, "wstr", 0) GUISetState(@SW_SHOW) ; will display an empty dialog box ; Run the GUI until the dialog is closed While 1 $iMsg = GUIGetMsg() If $iMsg = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete() EndFunc ;==>_Example Regards, João Carlos. Edited June 22, 2012 by JScript Xandy 1 http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now