Share this post

Link to post

Share on other sites

pluto41 11

pluto41 11

#include <MsgBoxConstants.au3>Local$iPadding=20Local$mainUiHeight=420Local$mainUiWidth=800Local$hGUI=GUICreate("GUI",$mainUiWidth,$mainUiHeight,-1,-1)GUISetState(@SW_SHOW); Retrieve the position x, y and size (width and height) of the controlLocal$aPos=WinGetPos($hGUI); Display the position and size of the edit control.MsgBox($MB_SYSTEMMODAL,"Parent $hGUI","Position: "&$aPos[0]&", "&$aPos[1]&@CRLF&"Size: "&$aPos[2]&", "&$aPos[3]); Test Input box within Parent Window ( $iPadding 20 )Local$sAnswer=InputBox("Question","Where were you born?","Planet Earth","",Default,Default,$aPos[0]+$iPadding,$aPos[1]+$iPadding,0)Exit0

I have not very much experience with this. (i never had any use for it). But the question sounds interesting and i think the answer can be useful for others too. Anyway i tried some things and the above code comes close to what you want. a bit weird is that $mainUiHeight / $mainUiWidth is not exactly the values represented by $aPos[]

#include <WinAPI.au3>#include <WinAPIDiag.au3>#include <WinAPISys.au3>$HCBT_ACTIVATE=5Opt("GuiOnEventMode",1)$hWnd=GUICreate("",700,320)GUISetOnEvent(-3,"_MyExit",$hWnd)GUICtrlCreateButton("TaskDialog",10,70)GUICtrlSetOnEvent(-1,"_TaskDialog")GUISetState()While1Sleep(10)WEndFunc_MyExit()ExitEndFuncFunc_TaskDialog()Local$TDF_POSITION_RELATIVE_TO_WINDOW=0x1000;vista and above, see: https://msdn.microsoft.com/en-us/library/gg157196.aspxLocal$TDCBF_OK_BUTTON=0x0001Local$TDCBF_YES_BUTTON=0x0002Local$TDCBF_NO_BUTTON=0x0004Local$TDCBF_CANCEL_BUTTON=0x0008Local$TDCBF_RETRY_BUTTON=0x0010Local$TDCBF_CLOSE_BUTTON=0x0020Local$tagTASKDIALOGCONFIG="uint cbSize;hwnd hwndParent;handle hInstance;int dwFlags;int dwCommonButtons;ptr pszWindowTitle; ptr hMainIcon_pszMainIcon;ptr pszMainInstruction;ptr pszContent;uint cButtons;ptr pButtons;int nDefaultButton;uint cRadioButtons;ptr pRadioButtons;int nDefaultRadioButton;ptr pszVerificationText;ptr pszExpandedInformation;ptr pszExpandedControlText;ptr pszCollapsedControlText;ptr hFooterIcon_pszFooterIcon;ptr pszFooter;ptr pfCallback;LONG_PTR lpCallbackData;uint cxWidth;"Local$tagTASKDIALOG_BUTTON="int nButtonID;ptr pszButtonText"Local$tTASKDIALOGCONFIG=DllStructCreate($tagTASKDIALOGCONFIG)$tTASKDIALOGCONFIG.cbSize=DllStructGetSize($tTASKDIALOGCONFIG)$tTASKDIALOGCONFIG.hwndParent=$hWnd$tTASKDIALOGCONFIG.hInstance=Null$tTASKDIALOGCONFIG.dwFlags=$TDF_POSITION_RELATIVE_TO_WINDOW$tTASKDIALOGCONFIG.dwCommonButtons=$TDCBF_OK_BUTTON$tTASKDIALOGCONFIG.pszWindowTitle=Null$tTASKDIALOGCONFIG.hMainIcon_pszMainIcon=Null$tTASKDIALOGCONFIG.pszMainInstruction=_WinAPI_CreateString("string to be used for the main instruction")$tTASKDIALOGCONFIG.pszContent=_WinAPI_CreateString("the dialog's primary content")$tTASKDIALOGCONFIG.cButtons=0$tTASKDIALOGCONFIG.pButtons=0; change ptr in type to STRUCT*$tTASKDIALOGCONFIG.nDefaultButton=$IDOK$tTASKDIALOGCONFIG.cRadioButtons=0$tTASKDIALOGCONFIG.pRadioButtons=0; change ptr in type to STRUCT*$tTASKDIALOGCONFIG.nDefaultRadioButton=0$tTASKDIALOGCONFIG.pszVerificationText=_WinAPI_CreateString("string to be used to label the verification checkbox")$tTASKDIALOGCONFIG.pszExpandedInformation=_WinAPI_CreateString("string to be used for displaying additional information")$tTASKDIALOGCONFIG.pszExpandedControlText=_WinAPI_CreateString("string to be used to label the button for collapsing the expandable information")$tTASKDIALOGCONFIG.pszCollapsedControlText=_WinAPI_CreateString("string to be used to label the button for expanding the expandable information")$tTASKDIALOGCONFIG.hFooterIcon_pszFooterIcon=Null$tTASKDIALOGCONFIG.pszFooter=_WinAPI_CreateString("string to be used in the footer area of the task dialog");<A HREF="executablestring">Hyperlink Text</A> Warning Enabling hyperlinks when using content from an unsafe source may cause security vulnerabilities.$tTASKDIALOGCONFIG.pfCallback=0;Pointer to an application-defined callback function. For more information see TaskDialogCallbackProc$tTASKDIALOGCONFIG.lpCallbackData=0;A pointer to application-defined reference data. This value is defined by the caller.$tTASKDIALOGCONFIG.cxWidth=0;The width of the task dialog's client area, in dialog units. If 0, the task dialog manager will calculate the ideal width.Local$aReutn=DllCall("Comctl32.dll","LONG","TaskDialogIndirect","STRUCT*",$tTASKDIALOGCONFIG,"INT*",0,"INT*",0,"BOOL*",0)EndFunc