Rex Posted January 17, 2016 Share Posted January 17, 2016 (edited) Hi I have a odd problem with WM_NCHITTEST I have this code witch I wrote ages ago, but short time ago I updated it with a top bar that i could use to d'n'd to : expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <File.au3> Opt("GUIOnEventMode", 1) HotKeySet("!m", "_Minimize") #Region ### START Koda GUI section ### Form=GUI Forms\Install_Log_Generator.kxf $hInstall_Log_Generator = GUICreate("Install log Generator", 347, 201, 10, 10, BitOR($WS_CAPTION, $WS_SYSMENU, $WS_MINIMIZEBOX), BitOR($WS_EX_ACCEPTFILES,$WS_EX_TOPMOST,$WS_EX_WINDOWEDGE)) GUISetOnEvent($GUI_EVENT_CLOSE, "hInstall_Log_GeneratorClose") $hProg_Input = GUICtrlCreateInput("", 16, 24, 233, 21, $GUI_SS_DEFAULT_INPUT) GUICtrlSetState($hProg_Input, $GUI_DROPACCEPTED) $hComments = GUICtrlCreateEdit("", 16, 72, 313, 97, $ES_WANTRETURN) GUICtrlSetState($hComments, $GUI_DROPACCEPTED) $Label2 = GUICtrlCreateLabel("Kommentar", 16, 56, 57, 16) $hProg_Install_Button = GUICtrlCreateButton("&Installeret", 256, 24, 75, 21, BitOR($BS_DEFPUSHBUTTON,$BS_NOTIFY)) GUICtrlSetOnEvent($hProg_Install_Button, "hProg_Install_ButtonClick") $Label1 = GUICtrlCreateLabel("Program navn", 16, 8, 70, 16, 0) $hOpen_Log_CheckBox = GUICtrlCreateCheckbox("Åben logfil", 16, 176, 73, 17) GUICtrlSetOnEvent($hOpen_Log_CheckBox, "hOpen_Log_CheckBoxClick") $hStartWin_CheckBox = GUICtrlCreateCheckbox("Start med windows", 96, 176, 113, 17) GUICtrlSetOnEvent($hStartWin_CheckBox, "hStartWin_CheckBoxClick") $Label3 = GUICtrlCreateLabel("Minimere (ALT+M)", 240, 177, 90, 16) ;~ GUISetOnEvent($GUI_EVENT_DROPPED, "_Droppede") GUISetState(@SW_SHOW, $hInstall_Log_Generator) ;~ GUISetState(@SW_MINIMIZE, $hInstall_Log_Generator) #EndRegion ### END Koda GUI section ### $InstallLog_TopBar = GUICreate("Topbar", 548, 20, @DesktopWidth / 2 - 274, 1, $WS_POPUP, BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) $idLbl_Info = GUICtrlCreateLabel("Install Log generator topbar:", 4, 2, 500, 20) GUICtrlSetState($idLbl_Info, $GUI_DROPACCEPTED) GUISetOnEvent($GUI_EVENT_DROPPED, "_Droppede") GUISetState(@SW_SHOW) GUIRegisterMsg($WM_NCHITTEST, '_WM_NCHITTEST') ; Allows to move the bar, even there is no titlebar. $StarWith = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "InstallLog") If $StarWith <> "" Then GUICtrlSetState($hStartWin_CheckBox, $GUI_CHECKED) EndIf While 1 Sleep(100) WEnd Func hInstall_Log_GeneratorClose() Exit EndFunc Func hOpen_Log_CheckBoxClick() ShellExecute("C:\" & @ComputerName & "_Install.log") GUICtrlSetState($hOpen_Log_CheckBox, $GUI_UNCHECKED) EndFunc Func hProg_Install_ButtonClick() $sProg = GUICtrlRead($hProg_Input) If $sProg <> "" Then _FileWriteLog("C:\" & @ComputerName & "_Install.log", $sProg) _Comments() Else _Comments() Endif GUICtrlSetData($hProg_Input, "") _Minimize() EndFunc Func hStartWin_CheckBoxClick() $Start = GUICtrlRead($hStartWin_CheckBox) If $Start = $GUI_CHECKED Then RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "InstallLog", "REG_SZ", '"' & @ScriptFullPath & '"') Else RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "InstallLog") EndIf EndFunc Func _Comments() $comment = GUICtrlRead($hComments) If $comment <> "" Then ; Check if there is added a comment $sComRet = StringSplit($comment, @CR, 1) ; Splitting comments string by chr(32) (LINE SHIFT) $i = 1 $sDateNow = @YEAR & "-" & @MON & "-" & @MDAY $sTimeNow = @HOUR & ":" & @MIN & ":" & @SEC ;~ $Space = $sDateNow & " " & $sTimeNow & " » " $Space = " » " ; If whitespaces is preffered insted of date time Do FileWriteLine("C:\" & @ComputerName & "_Install.log", $Space & $sComRet[$i]) ;_FileWriteLog("C:\" & @ComputerName & "_Install.log", "» " & $ComRep[$i]) $i = $i + 1 Until $i = $sComRet[0] + 1 EndIf GUICtrlSetData($hComments, "") EndFunc Func _Droppede() GUISetState(@SW_RESTORE, $hInstall_Log_Generator) GUICtrlSetData($hProg_Input, @GUI_DragFile) GUICtrlSetData($hComments, "") EndFunc Func _Minimize() GUISetState(@SW_MINIMIZE, $hInstall_Log_Generator) EndFunc Func _Topbar() EndFunc Func _WM_NCHITTEST($hWnd, $iMsg, $wParam, $lParam) Return $HTCAPTION EndFunc ;==>_WM_NCHITTEST And it works on my laptop, and several other pc's - but in a fresh install at my workpc the minimize and close button at the titlebar don't work? And whats more odd is that at the same pc in an old install off windows 7, it works as it should. So at the same pc, with win7 it works and it doesn't - do I miss some extra in my fresh win7 install that i have in the old one? Cheers /Rex Edited January 17, 2016 by Rex Link to comment Share on other sites More sharing options...
Rex Posted January 19, 2016 Author Share Posted January 19, 2016 Doe's someone have a suggestion on what could be cursing the error ? /Rex Link to comment Share on other sites More sharing options...
careca Posted January 20, 2016 Share Posted January 20, 2016 (edited) I don't know what to say, except im on W10 64 and it works. What is the error? EDIT: in fact, i would add this to it: GUISetOnEvent($GUI_EVENT_MINIMIZE, "_Minimize") Edited January 20, 2016 by careca hmmm Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
kylomas Posted January 20, 2016 Share Posted January 20, 2016 (edited) Rexx, It did NOT work on my OS (Win7 Home x64, current maintenance levels) till I changed this... Return $gui_rundefmsg kylomas Edited January 20, 2016 by kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
BrewManNH Posted January 20, 2016 Share Posted January 20, 2016 The script above worked on my Win 10 x64 computer as well, no problems found with it. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Rex Posted January 20, 2016 Author Share Posted January 20, 2016 (edited) @careca Yeah on my win10 it also works, but in some win 7 it don't - and that's whats odd It don't give any errors, the prog works except for the minimize and close button :/ @kylomas Okay, I haven't tried to edit the code yet - course I was hoping that some on could give me an reason for why it did work on some windows but not on others. - But yes with your updated code IT works thx @BrewManNH Yeas again it also worked on my win 10, and my old win 7 installation - also on my laptop with win 7, but at my fresh installed win 7, it didn't And that's why I was thinking that I might miss some required files in the installation for the code to work properly. I also just tested it on a VP with a ½ updated win7 installation, and there it didn't work either. So I guess that for the above code to work, I need to install something else, but what?? Cheers /Rex Edited January 20, 2016 by Rex 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