Jump to content
careca

Conflict with $WS_EX_CONTROLPARENT and GUICtrlCreateContextMenu

Recommended Posts

careca
Posted (edited)

Hi, not sure if this really a conflict or im doing something wrong, but what is happening is that if i have $WS_EX_CONTROLPARENT in place,

i can move the GUI around as expected, but there's no context menu, removing it the menu is back.

#include <WindowsConstants.au3>

$GUI = GUICreate('test', 300, 200, 150, 300, $WS_POPUP, $WS_EX_CONTROLPARENT)
GUISetState(@SW_SHOW)
Local $MainMenu = GUICtrlCreateContextMenu(-1)
$OptMenu = GUICtrlCreateMenu("Options", $MainMenu)
GUICtrlCreateMenuItem("111", $OptMenu, 0, 0)
GUICtrlCreateMenuItem("222", $OptMenu, 1, 0)
GUICtrlCreateMenuItem("333", $OptMenu, 2, 0)
GUICtrlCreateMenuItem("444", $OptMenu, 3, 0)

While 1
    Sleep(100)
WEnd

 

Edited by careca

Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

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.

Firefox Profile Backup - Backup/restore previously saved profile.

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

Share this post


Link to post
Share on other sites
FrancescoDiMuro
Posted (edited)

@careca
I ran your script, and I could't even see the Menu if I try to remove $WS_EX_CONTROLPARENT...

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

ALWAYS GOOD TO READ:

In case I am violating some pseudo Forum rule, or I am doing something wrong, I want let you know that I'm not doing this on purpose, and for this, I kindly ask you to send me a private message about the "bad content" I posted, in order to edit/remove it, and to not be warned wrongly.
Thanks in advance.

 

Share this post


Link to post
Share on other sites
careca

I don't know what to say.. can anyone else confirm this?


Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

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.

Firefox Profile Backup - Backup/restore previously saved profile.

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

Share this post


Link to post
Share on other sites
careca

Bump


Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

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.

Firefox Profile Backup - Backup/restore previously saved profile.

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

Share this post


Link to post
Share on other sites
careca

Bump


Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

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.

Firefox Profile Backup - Backup/restore previously saved profile.

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

Share this post


Link to post
Share on other sites
BrewManNH

Are you using the style for something specific? Because you seem to be using it wrong.

https://blogs.msdn.microsoft.com/oldnewthing/20120620-00/?p=7333


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 Gude
How 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

Share this post


Link to post
Share on other sites
careca

Hi, thanks for the reply.

What im searching for is a way to drag the gui around at "any" point and i read this at the GUICreate remarks, last line:

"You can enable window dragging for GUI without $WS_CAPTION by using $WS_EX_CONTROLPARENT in the exStyle parameter."

So i didn't think there would be a problem, what can i do to get around this, while enabling the context menu?

If it wasn't for the menu being turned off it would be fine, apparently.


Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

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.

Firefox Profile Backup - Backup/restore previously saved profile.

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

Share this post


Link to post
Share on other sites
BrewManNH
Posted (edited)

You can try these links for some ideas

https://www.autoitscript.com/wiki/Moving_and_Resizing_PopUp_GUIs

Or try some of the suggestions in this thread

 

 

Edited by BrewManNH
  • Like 1

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 Gude
How 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

Share this post


Link to post
Share on other sites
careca
Posted (edited)

Thanks i'll look into it.

Thanks to the link you posted i managed to use one of the methods and this was the result!

#include <SendMessage.au3>
#include <GuiconstantsEx.au3>
#include <WindowsConstants.au3>

Global Const $SC_DRAGMOVE = 0xF012

Opt("GUIOnEventMode", 1)

$GUI = GUICreate('test', 300, 200, 150, 300, $WS_POPUP)

GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "Drag")

Local $MainMenu = GUICtrlCreateContextMenu(-1)
$OptMenu = GUICtrlCreateMenu("Options", $MainMenu)
GUICtrlCreateMenuItem("111", $OptMenu, 0, 0)
GUICtrlCreateMenuItem("222", $OptMenu, 1, 0)
GUICtrlCreateMenuItem("333", $OptMenu, 2, 0)
GUICtrlCreateMenuItem("444", $OptMenu, 3, 0)
GUISetState(@SW_SHOW)

Func Drag()
_SendMessage($GUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0)
EndFunc

While 1
    Sleep(100)
WEnd

Thanks again.

Edited by careca

Spoiler

Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

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.

Firefox Profile Backup - Backup/restore previously saved profile.

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

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • Denik
      By Denik
      Hi, guys!  I'm trying to create a Tab control which has a Context Menu on each Tab Item.  But, since all Tab Items are part of the same Tab control, I will need to create only one Context Menu at time, deleting and creating a new one each time a new Tab Item is selected.  
      My problem is that I can delete the old Context Menu in fact, but I'm not being able to create a new one once the form is created.
      This is a simplified example that represents the script that I'm trying to create:
      #include <GUIConstantsEx.au3> ; Variables Dim $Tab, $SelectedTab, $MainForm, $TabItem Dim $TabContext, $TabContextTitle, $Separator1, $Separator2, $Separator3, $Separator4, $Separator5 Dim $TabEdit, $TabCopy, $TabPaste, $TabDelete, $TabUndo Dim $DefaultTab = 1 ; Tab Item number that will be shown in front ; Arrays Dim $TabCopy[4] Dim $TabPaste[4] Dim $TabDelete[4] Dim $TabContextTitle[4] Dim $TabEdit[4] Dim $TabUndo[4] Dim $TabItem[4] Func Example() ; GUI $MainForm = GUICreate("My GUI Tab", 220, 120) $Tab = GUICtrlCreateTab(10, 10, 200, 100) $TabItem[1] = GUICtrlCreateTabItem("Tab1") $TabItem[2] = GUICtrlCreateTabItem("Tab2") $TabItem[3] = GUICtrlCreateTabItem("Tab3") GUICtrlCreateTabItem("") $TabContext = GUICtrlCreateContextMenu(-1) $TabContextTitle[$DefaultTab] = GUICtrlCreateMenuItem("Tab" & $DefaultTab, $TabContext) GUICtrlSetState(-1, $GUI_DEFBUTTON) $Separator1 = GUICtrlCreateMenuItem("", $TabContext) ; separator $TabEdit[$DefaultTab] = GUICtrlCreateMenuItem("Edit", $TabContext) $Separator2 = GUICtrlCreateMenuItem("", $TabContext) ; separator $TabCopy[$DefaultTab] = GUICtrlCreateMenuItem("Copy", $TabContext) $Separator3 = GUICtrlCreateMenuItem("", $TabContext) ; separator $TabPaste[$DefaultTab] = GUICtrlCreateMenuItem("Paste", $TabContext) $Separator4 = GUICtrlCreateMenuItem("", $TabContext) ; separator $TabDelete[$DefaultTab] = GUICtrlCreateMenuItem("Delete", $TabContext) $Separator5 = GUICtrlCreateMenuItem("", $TabContext) ; separator $TabUndo[$DefaultTab] = GUICtrlCreateMenuItem("Undo", $TabContext) GUICtrlSetState($TabItem[$DefaultTab], $GUI_SHOW) GUISetState(@SW_SHOW, $MainForm) $LastTab = $DefaultTab $SelectedTab = $DefaultTab EndFunc Func TabContextDelete($lt) ; Deletes Tab Context Menu GUICtrlDelete($TabContext) GUICtrlDelete($TabContextTitle[$lt]) GUICtrlDelete($Separator1) GUICtrlDelete($TabEdit[$lt]) GUICtrlDelete($Separator2) GUICtrlDelete($TabCopy[$lt]) GUICtrlDelete($Separator3) GUICtrlDelete($TabPaste[$lt]) GUICtrlDelete($Separator4) GUICtrlDelete($TabDelete[$lt]) GUICtrlDelete($Separator5) GUICtrlDelete($TabUndo[$lt]) EndFunc Func TabContextUpdate($st) ; Should Create a New Tab Context Menu $TabContext = GUICtrlCreateContextMenu($MainForm) $TabContextTitle[$st] = GUICtrlCreateMenuItem("Tab" & $st, $TabContext) GUICtrlSetState(-1, $GUI_DEFBUTTON) $Separator1 = GUICtrlCreateMenuItem("", $TabContext) ; separator $TabEdit[$st] = GUICtrlCreateMenuItem("Edit", $TabContext) $Separator2 = GUICtrlCreateMenuItem("", $TabContext) ; separator $TabCopy[$st] = GUICtrlCreateMenuItem("Copy", $TabContext) $Separator3 = GUICtrlCreateMenuItem("", $TabContext) ; separator $TabPaste[$st] = GUICtrlCreateMenuItem("Paste", $TabContext) $Separator4 = GUICtrlCreateMenuItem("", $TabContext) ; separator $TabDelete[$st] = GUICtrlCreateMenuItem("Delete", $TabContext) $Separator5 = GUICtrlCreateMenuItem("", $TabContext) ; separator $TabUndo[$st] = GUICtrlCreateMenuItem("Undo", $TabContext) EndFunc Example() While 1 $GuiMsg = GUIGetMsg(1) Switch $GuiMsg[0] Case $Tab $LastTab = $SelectedTab $SelectedTab = GUICtrlRead($Tab) + 1 TabContextDelete($LastTab) TabContextUpdate($SelectedTab) Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Could you please explain me what I am doing wrong or give me an alternative solution?
      Thanks in advance.
    • lavascript
      By lavascript
      Screenshot attached!

      I have a background image where all the buildings are black. When the distribution switches in the buildings respond to a ping, the buildings turn green.



      Dim $hImgMain = GUICtrlCreatePic("img\fullmap-nologo.gif",0,0,768,635) Dim $hImgAud = GUICtrlCreatePic("",263,287,36,27) Dim $hImgBus = GUICtrlCreatePic("",181,321,97,28) Dim $hImgCtr = GUICtrlCreatePic("",181,239,97,82) ... If ping($sIpAud) Then GUICtrlSetImage($hImgAud,"img\Green-Aud.gif")
      I'd like each building to have a context menu:


      $hMenuAud = GUICtrlCreateContextMenu($hImgAud) $hMenuAud1 = GUICtrlCreateMenu("Switch1",$hMenuAud) $hMenuAud1Tel = GUICtrlCreateMenuItem("Telnet",$hMenuAud1) $hMenuAud1Web = GUICtrlCreateMenuItem("Web",$hMenuAud1) $hMenuAud2 = GUICtrlCreateMenu("Switch2",$hMenuAud) $hMenuAud2Tel = GUICtrlCreateMenuItem("Telnet",$hMenuAud2) $hMenuAud2Web = GUICtrlCreateMenuItem("Web",$hMenuAud2)
      but the menus don't show up. Neither do tooltips. I'm sure this is something simple, but I've never really done anything like this before.

      Thanks!

×