bourny Posted July 12, 2016 Share Posted July 12, 2016 Hi, I have a new Gui that works great on Windows 7 and8 but on windows 10 none of the buttons work and the gui appears to be frozen. This is down to the use of GuiCtrlCreatePic. If I remove this and get rid of the background image working as the skin, the gui starts working. I have seen this behaviour in windows 7 and 8 if I do not use $Gui_disable in the GuiCtrlCreatePic. For some reason on windows 10 it behaves like I have not used the $Gui_Disable which I clearly have done and works in W7. Has anyone seen this in windows 10. Many Thanks Link to comment Share on other sites More sharing options...
AutoBert Posted July 12, 2016 Share Posted July 12, 2016 and where is your (or a reproducer) script code showwing the issues you have. Without this there is only reading tea leaves possible. Link to comment Share on other sites More sharing options...
bourny Posted July 12, 2016 Author Share Posted July 12, 2016 Hi, My program is SQL linked and has a lot of code so I will need to create a model version of it that I can post to demonstrate the issue. My question is just to get a feel for anyone who has come across this issue before as its very apparent in windows 10. Below is the bit of script that is responsible for freezing the gui in windows 10 but not in windows 7. $hGUI = GUICreate('MyGui', 1252, 750) GUISetBkColor(0xFFFFFF) GUICtrlCreatePic('c:\Skins\MyGuiBackground.jpg', 0, 0, 1252, 750) GUICtrlSetState( -1, $GUI_Disable) now in windows 7 if I change the $gui_disable parameter to $Gui_enable I get exactly the same type of issue with windows 7 where none of my controls work and the GUI appears to be frozen just showing a pretty graphic. Many Thanks. Link to comment Share on other sites More sharing options...
AutoBert Posted July 12, 2016 Share Posted July 12, 2016 (edited) this gui works for me on Win10: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Example() Func Example() GUICreate("My GUI picture", 350, 300, -1, -1, $WS_SIZEBOX + $WS_SYSMENU) ; will create a dialog box that when displayed is centered GUISetBkColor(0xE0FFFF) Local $idTest = GUICtrlCreateButton('Test',55,55) Local $idClose = GUICtrlCreateButton('Exit',55,155) Local $sPicPath=StringReplace(StringReplace(@AutoItExe,'_x64',''),'Autoit3.exe','') & 'Examples\GUI\mslogo.jpg' Local $idPic = GUICtrlCreatePic($sPicPath, 50, 50, 200, 50) GUICtrlSetState( -1, $GUI_Disable) GUISetState(@SW_SHOW) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idClose ExitLoop Case $idTest MsgBox(16,'Test','test') EndSwitch WEnd GUIDelete() EndFunc ;==>Example but if the path is wrong the button $idClose is disabled and don't work. Without GUICtrlSetState( -1, $GUI_Disable) the button $idTest isn't visible at start, but comes in front when mouse is over. And the small snipet you posted works on all circumstances (if skript is correctly completet) even if the pic isn't found. The only issue i know is pic isn't found and used as a button. This is as GuictrlcreatePic returns 0 if path is wrong. Here a scirpt showing this issue: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Example() Func Example() GUICreate("My GUI picture", 350, 300, -1, -1, $WS_SIZEBOX + $WS_SYSMENU) ; will create a dialog box that when displayed is centered GUISetBkColor(0xE0FFFF) Local $sPicPath=StringReplace(StringReplace(@AutoItExe,'_x64',''),'Autoit3.exe','') ;& 'Examples\GUI\mslogo.jpg' $idPic=GUICtrlCreatePic($sPicPath& 'Examples\GUI\msoobe.jpg', 0, 0,350, 300) GUICtrlSetState( -1, $GUI_Disable) $idTest=GUICtrlCreatePic($sPicPath& 'Examples\GUI\mslogo.jpeg', 50, 50,255, 40) Local $idClose = GUICtrlCreateButton('Exit',55,155) GUISetState(@SW_SHOW) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idClose ExitLoop Case $idTest MsgBox(16,'WindowLogo clicked','$idPic'&$idPic) EndSwitch WEnd GUIDelete() EndFunc ;==>Example after correcting the path of the second PicControl the sjkript works without any issue. Edited July 12, 2016 by AutoBert Link to comment Share on other sites More sharing options...
bourny Posted July 14, 2016 Author Share Posted July 14, 2016 I have since found that out of 5 windows 10 laptops in my department 2 of these work without issue and the majority show the frozen screen. I am now going through the differences in installed programs and windows updates but at this stage I have no clue why some work and some don't with the controls disabled with the graphic used in the background of the GUI, Is there any other method to add a jpg to the background of a GUI without using GUICtrlCreatePic. Clearly on some windows 1 machines (and I will find out what eventually) causes this function to disable all the controls on the gui. any help appreciated with this mystery or a work around form using GUICtrlCreatePic. Many Thanks Link to comment Share on other sites More sharing options...
AutoBert Posted July 14, 2016 Share Posted July 14, 2016 Yes, some possibile solutions: Test after each GuiCtrlCreatePic, CtrlId <> 0 Use like example 1 in https://www.autoitscript.com/forum/topic/134350-file-to-base64-string-code-generator-v120-build-2015-01-20-embed-your-files-easily/ Link to comment Share on other sites More sharing options...
bourny Posted July 15, 2016 Author Share Posted July 15, 2016 I have tried testing it after the GuiCtrlCreatePic and do not get any issues as it displays the image fine its just the rest of the controls are not functional as if the image is active when it should not be. I looked at your link but this seems to be a bit out of my depth. I was looking for an alternative method of placing an image on the Gui. I have heard while browsing topics in the past about using GDI or dll`s to place the image on the screen. I will do some digging around that to see if I can avoid using GuiCtrlCreatePic Link to comment Share on other sites More sharing options...
bourny Posted July 15, 2016 Author Share Posted July 15, 2016 I have discovered this is not the background image that is causing the issue. I have included below a stripped down version of my GUI. This is simply a tabbed gui that has some boxes drawen on it as labels. The background image I am using is not necessary to the functionality of the program. This works on windows 7 clicking the boxes moves the tabs however on windows 10 clicking the labels does not work. expandcollapse popup#include <GUICONSTANTS.au3> Global $LocalClientWKDir = "c:\tmp" ;Tab Global Vars Global $Item = -1 Global $Over = -1 Global $Pic[5] Global $Tab, $Tab1, $Tab2, $Tab3, $Tab4, $Tab5 MakeGui() LaunchGUI() Func MakeGui() $hGUI = GUICreate('MYGui', 1252, 750) BuildTabs() GUISetState() EndFunc Func LaunchGUI() While 1 $Msg = GUIGetMsg() If $Item = -1 Then $Msg = $Pic[0] $Item = 1 EndIf Switch $Msg Case $GUI_EVENT_CLOSE Exit Case $Pic[0] To $Pic[UBound($Pic) - 1] If $Msg <> $Pic[$Item] Then GUICtrlSetImage($Pic[$Item], "c:\WindowsMail.bmp") ; GUICtrlSetcolor($Pic[$Item] + 1, 0x708090) $Item = _Index($Msg) GUICtrlSendMsg($Tab, $TCM_SETCURFOCUS, $Item, 0) $Over = -1 EndIf Case $GUI_EVENT_CLOSE Exit Case $Tab $ReadID = GUICtrlRead($Tab, 1) Select Case $ReadID = $Tab2 ConsoleWrite("I am here tab2 " & @crlf) Case $ReadID = $Tab3 ConsoleWrite("I am here tab3 " & @crlf) Case $ReadID = $Tab4 ConsoleWrite("I am here tab4 " & @crlf) EndSelect EndSwitch WEnd EndFunc Func BuildTabs() $Pic[0] = GUICtrlCreatePic("c:\WindowsMail.bmp", 100, 40, 1, 1) GUICtrlSetState(-1, $GUI_Disable) GUICtrlCreateLabel("", 80, 18, 42, 42, $SS_BLACKFRAME); $Pic[1] = GUICtrlCreatePic("c:\WindowsMail.bmp", 120, 90, 1, 1) GUICtrlSetState(-1, $GUI_Disable) GUICtrlCreateLabel("", 115, 85, 42, 42, $SS_BLACKFRAME) $Pic[2] = GUICtrlCreatePic("c:\WindowsMail.bmp", 160, 150, 1, 1) GUICtrlSetState(-1, $GUI_Disable) GUICtrlCreateLabel("", 150, 145, 42, 42, $SS_BLACKFRAME) $Pic[3] = GUICtrlCreatePic("c:\WindowsMail.bmp", 120, 280, 1, 1) GUICtrlSetState(-1, $GUI_Disable) GUICtrlCreateLabel("", 112, 210, 42, 42, $SS_BLACKFRAME) $Pic[4] = GUICtrlCreatePic("c:\WindowsMail.bmp", 120, 320, 1, 1) GUICtrlSetState(-1, $GUI_Disable) GUICtrlCreateLabel("", 111, 498, 42, 42, $SS_BLACKFRAME) $Tab = GUICtrlCreateTab(172 + 4, 10 + 4, 523 - 8, 149 - 8) $Tab1 = GUICtrlCreateTabItem('TAB1') GUICtrlCreateLabel("TAB 1", 250, 50, 300, 50) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetcolor(-1, 0x708090) GUICtrlSetFont(-1, 30, 400, 0, 'Calisto MT') $Tab2 = GUICtrlCreateTabItem('TAB2') GUICtrlCreateLabel("TAB 2", 250, 50, 300, 50) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetcolor(-1, 0x708090) GUICtrlSetFont(-1, 30, 400, 0, 'Calisto MT') $Tab3 = GUICtrlCreateTabItem('TAB3') GUICtrlCreateLabel("TAB 3", 250, 50, 300, 50) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetcolor(-1, 0x708090) GUICtrlSetFont(-1, 30, 400, 0, 'Calisto MT') $Tab4 = GUICtrlCreateTabItem('TAB4') GUICtrlCreateLabel("TAB 4", 250, 50, 300, 50) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetcolor(-1, 0x708090) GUICtrlSetFont(-1, 30, 400, 0, 'Calisto MT') $Tab5 = GUICtrlCreateTabItem('TAB5') GUICtrlCreateLabel("TAB 5", 250, 50, 300, 50) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetcolor(-1, 0x708090) GUICtrlSetFont(-1, 30, 400, 0, 'Calisto MT') EndFunc Func _Index($CtrlID) ;Belongs to Tab GUI For $i = 0 To UBound($Pic) - 1 If ($CtrlID = $Pic[$i]) Or ($CtrlID = $Pic[$i] + 1) Then Return $i EndIf Next Return -1 EndFunc ;==>_Index Link to comment Share on other sites More sharing options...
bourny Posted July 15, 2016 Author Share Posted July 15, 2016 Think I have resolved it. I switched the $pic handler to the GuiCtrlCreateLabel instead of the GuiCtrlCreatePic. clearly I can make the pictures used as the handler resundant. Modified function expandcollapse popupFunc BuildTabs() ;$Pic[0] = GUICtrlCreatePic("c:\WindowsMail.bmp", 100, 40, 1, 1) ;GUICtrlSetState(-1, $GUI_Disable) $Pic[0] = GUICtrlCreateLabel("", 80, 18, 42, 42, $SS_BLACKFRAME); ;$Pic[1] = GUICtrlCreatePic("c:\WindowsMail.bmp", 120, 90, 1, 1) ;GUICtrlSetState(-1, $GUI_Disable) $Pic[1] = GUICtrlCreateLabel("", 115, 85, 42, 42, $SS_BLACKFRAME) ;$Pic[2] = GUICtrlCreatePic("c:\WindowsMail.bmp", 160, 150, 1, 1) ;GUICtrlSetState(-1, $GUI_Disable) $Pic[2] = GUICtrlCreateLabel("", 150, 145, 42, 42, $SS_BLACKFRAME) ;$Pic[3] = GUICtrlCreatePic("c:\WindowsMail.bmp", 120, 280, 1, 1) ;GUICtrlSetState(-1, $GUI_Disable) $Pic[3] = GUICtrlCreateLabel("", 112, 210, 42, 42, $SS_BLACKFRAME) ;$Pic[4] = GUICtrlCreatePic("c:\WindowsMail.bmp", 120, 320, 1, 1) ;GUICtrlSetState(-1, $GUI_Disable) $Pic[4] = GUICtrlCreateLabel("", 111, 498, 42, 42, $SS_BLACKFRAME) $Tab = GUICtrlCreateTab(172 + 4, 10 + 4, 523 - 8, 149 - 8) $Tab1 = GUICtrlCreateTabItem('TAB1') GUICtrlCreateLabel("TAB 1", 250, 50, 300, 50) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetcolor(-1, 0x708090) GUICtrlSetFont(-1, 30, 400, 0, 'Calisto MT') $Tab2 = GUICtrlCreateTabItem('TAB2') GUICtrlCreateLabel("TAB 2", 250, 50, 300, 50) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetcolor(-1, 0x708090) GUICtrlSetFont(-1, 30, 400, 0, 'Calisto MT') $Tab3 = GUICtrlCreateTabItem('TAB3') GUICtrlCreateLabel("TAB 3", 250, 50, 300, 50) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetcolor(-1, 0x708090) GUICtrlSetFont(-1, 30, 400, 0, 'Calisto MT') $Tab4 = GUICtrlCreateTabItem('TAB4') GUICtrlCreateLabel("TAB 4", 250, 50, 300, 50) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetcolor(-1, 0x708090) GUICtrlSetFont(-1, 30, 400, 0, 'Calisto MT') $Tab5 = GUICtrlCreateTabItem('TAB5') GUICtrlCreateLabel("TAB 5", 250, 50, 300, 50) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetcolor(-1, 0x708090) GUICtrlSetFont(-1, 30, 400, 0, 'Calisto MT') EndFunc Link to comment Share on other sites More sharing options...
AoRaToS Posted July 19, 2016 Share Posted July 19, 2016 Have you checked the Windows DPI setting on the computers you're using? I've seen GUI issues when the setting is above 100%. Would you be able to check? I know you fixed this using a workaround but I'm curious regarding what may be causing it. The setting is in Display Settings, under "Customize your display" and says "Change the size of text, apps, and other items" s!mpL3 LAN Messenger Current version 2.9.9.1 [04/07/2019] s!mpL3 LAN Messenger.zip s!mpL3 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