Sign in to follow this  
Followers 0
ChrisL

_GUICtrlTreeView_Create and WM_CONTEXTMENU WM_COMMAND won't work together

3 posts in this topic

#1 ·  Posted

#include <GUIConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>
#include <GuiMenu.au3>

Global $g_hTreeView
Global Enum $e_idOpen = 1000, $e_idSave, $e_idInfo

Example()

Func Example()
    Local $hGUI, $hItem
    Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)
    $hGUI = GUICreate("(UDF Created) TreeView Create", 400, 300)

    $g_hTreeView = _GUICtrlTreeView_Create($hGUI, 2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
    GUISetState(@SW_SHOW)

    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
    GUIRegisterMsg($WM_CONTEXTMENU, "WM_CONTEXTMENU")
    GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

    _GUICtrlTreeView_BeginUpdate($g_hTreeView)
    For $x = 1 To Random(2, 10, 1)
        $hItem = _GUICtrlTreeView_Add($g_hTreeView, 0, StringFormat("[%02d] New Item", $x))
        For $y = 1 To Random(2, 10, 1)
            _GUICtrlTreeView_AddChild($g_hTreeView, $hItem, StringFormat("[%02d] New Child", $y))
        Next
    Next
    _GUICtrlTreeView_EndUpdate($g_hTreeView)

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example

Func WM_CONTEXTMENU($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $lParam

    ;ConsoleWrite($GUI_RUNDEFMSG & @CRLF)
    ;Switch $wParam

    ;   Case $hTreeView

            Local $hMenu

            $hMenu = _GUICtrlMenu_CreatePopup()
            _GUICtrlMenu_InsertMenuItem($hMenu, 0, "Open", $e_idOpen)
            _GUICtrlMenu_InsertMenuItem($hMenu, 1, "Save", $e_idSave)
            _GUICtrlMenu_InsertMenuItem($hMenu, 3, "", 0)
            _GUICtrlMenu_InsertMenuItem($hMenu, 3, "Info", $e_idInfo)
            _GUICtrlMenu_TrackPopupMenu($hMenu, $wParam)
            _GUICtrlMenu_DestroyMenu($hMenu)
            Return True

    ;EndSwitch

    Return $GUI_RUNDEFMSG

EndFunc   ;==>WM_CONTEXTMENU

Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $lParam
    Switch $wParam
        Case $e_idOpen
             _DebugPrint("WM_COMMAND " & $wParam & " Open")
        Case $e_idSave
             _DebugPrint("WM_COMMAND " & $wParam & " Save")
        Case $e_idInfo
             _DebugPrint("WM_COMMAND " & $wParam & " Info")
    EndSwitch

    Return $GUI_RUNDEFMSG

EndFunc   ;==>WM_COMMAND


Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $wParam
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndTreeview
    $hWndTreeview = $g_hTreeView
    If Not IsHWnd($g_hTreeView) Then $hWndTreeview = GUICtrlGetHandle($g_hTreeView)

    $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
        Case $hWndTreeview
            Switch $iCode
                Case $NM_CLICK ; The user has clicked the left mouse button within the control
                    _DebugPrint("$NM_CLICK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
                            "-->Code:" & @TAB & $iCode)
                    ; Return 1 ; nonzero to not allow the default processing
                    Return 0 ; zero to allow the default processing
                Case $NM_DBLCLK ; The user has double-clicked the left mouse button within the control
                    _DebugPrint("$NM_DBLCLK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
                            "-->Code:" & @TAB & $iCode)
                    ; Return 1 ; nonzero to not allow the default processing
                    Return 0 ; zero to allow the default processing
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY

Func _DebugPrint($s_Text, $sLine = @ScriptLineNumber)
    ConsoleWrite( _
            "!===========================================================" & @CRLF & _
            "+======================================================" & @CRLF & _
            "-->Line(" & StringFormat("%04d", $sLine) & "):" & @TAB & $s_Text & @CRLF & _
            "+======================================================" & @CRLF)
EndFunc   ;==>_DebugPrint

In the example code I have a treeview and a context/popup menu, I can't use a conventional context menu because I need to use the treeview UDF functions.

The WM_COMMAND never fires from the context/popup menu selection while there is a treeview using  _GuiCtrlTreeview_Create

If you comment out _GuiCtrlTreeview_Create line you will then see the right click selection works as expected and the debug is written to the console on selection.

Autoit Ver 3.3.14.2

Any ideas why this combination won't work together?

Thanks

 

Share this post


Link to post
Share on other sites



#2 ·  Posted

You may have noticed that WM_COMMAND messages are still handled correctly when you right-click in the small empty area below the TreeView. Only when you right-click in the TreeView area the messages are not handled correctly.

When you right-click in a window WM_COMMAND messages are always send to the same window. If you right-click in the GUI WM_COMMAND messages are send to the GUI. If you right-click in the TreeView WM_COMMAND messages are to send to the TreeView.

But GUIRegisterMsg is only able to catch messages which are send to the GUI. GUIRegisterMsg cannot catch messages which are send to the TreeView.

The solution is to subclass the TreeView. Details in the codebox. I've added 10 code lines.

#include <GUIConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>
#include <GuiMenu.au3>

#include <WinAPIShellEx.au3>

Global $g_hTreeView
Global Enum $e_idOpen = 1000, $e_idSave, $e_idInfo

Example()

Func Example()
    Local $hGUI, $hItem
    Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)
    $hGUI = GUICreate("(UDF Created) TreeView Create", 400, 300)

    $g_hTreeView = _GUICtrlTreeView_Create($hGUI, 2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
    GUISetState(@SW_SHOW)

    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
    GUIRegisterMsg($WM_CONTEXTMENU, "WM_CONTEXTMENU")
    GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

    Local $pTreeViewMsgHandler = DllCallbackGetPtr( DllCallbackRegister( "TreeViewMsgHandler", "lresult", "hwnd;uint;wparam;lparam;uint_ptr;dword_ptr" ) )
    _WinAPI_SetWindowSubclass( $g_hTreeView, $pTreeViewMsgHandler, 0, 0 ) ; $iSubclassId = 0, $pData = 0

    _GUICtrlTreeView_BeginUpdate($g_hTreeView)
    For $x = 1 To Random(2, 10, 1)
        $hItem = _GUICtrlTreeView_Add($g_hTreeView, 0, StringFormat("[%02d] New Item", $x))
        For $y = 1 To Random(2, 10, 1)
            _GUICtrlTreeView_AddChild($g_hTreeView, $hItem, StringFormat("[%02d] New Child", $y))
        Next
    Next
    _GUICtrlTreeView_EndUpdate($g_hTreeView)

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    _WinAPI_RemoveWindowSubclass( $g_hTreeView, $pTreeViewMsgHandler, 0 )
    GUIDelete()
EndFunc   ;==>Example

Func TreeViewMsgHandler( $hWnd, $iMsg, $wParam, $lParam, $iSubclassId, $pData )
  Switch $iMsg
    Case $WM_COMMAND
      Switch $wParam
          Case $e_idOpen
               _DebugPrint("WM_COMMAND " & $wParam & " Open")
          Case $e_idSave
               _DebugPrint("WM_COMMAND " & $wParam & " Save")
          Case $e_idInfo
               _DebugPrint("WM_COMMAND " & $wParam & " Info")
      EndSwitch
  EndSwitch
  ; Call next function in subclass chain (this forwards Windows messages to main GUI)
  Return DllCall( "comctl32.dll", "lresult", "DefSubclassProc", "hwnd", $hWnd, "uint", $iMsg, "wparam", $wParam, "lparam", $lParam )[0]
EndFunc

Func WM_CONTEXTMENU($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $lParam

    ;ConsoleWrite($GUI_RUNDEFMSG & @CRLF)
    ;Switch $wParam

    ;   Case $hTreeView

            Local $hMenu

            $hMenu = _GUICtrlMenu_CreatePopup()
            _GUICtrlMenu_InsertMenuItem($hMenu, 0, "Open", $e_idOpen)
            _GUICtrlMenu_InsertMenuItem($hMenu, 1, "Save", $e_idSave)
            _GUICtrlMenu_InsertMenuItem($hMenu, 3, "", 0)
            _GUICtrlMenu_InsertMenuItem($hMenu, 3, "Info", $e_idInfo)
            _GUICtrlMenu_TrackPopupMenu($hMenu, $wParam)
            _GUICtrlMenu_DestroyMenu($hMenu)
            Return True

    ;EndSwitch

    Return $GUI_RUNDEFMSG

EndFunc   ;==>WM_CONTEXTMENU

Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $lParam
    Switch $wParam
        Case $e_idOpen
             _DebugPrint("WM_COMMAND " & $wParam & " Open")
        Case $e_idSave
             _DebugPrint("WM_COMMAND " & $wParam & " Save")
        Case $e_idInfo
             _DebugPrint("WM_COMMAND " & $wParam & " Info")
    EndSwitch

    Return $GUI_RUNDEFMSG

EndFunc   ;==>WM_COMMAND


Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $wParam
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndTreeview
    $hWndTreeview = $g_hTreeView
    If Not IsHWnd($g_hTreeView) Then $hWndTreeview = GUICtrlGetHandle($g_hTreeView)

    $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
        Case $hWndTreeview
            Switch $iCode
                Case $NM_CLICK ; The user has clicked the left mouse button within the control
                    _DebugPrint("$NM_CLICK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
                            "-->Code:" & @TAB & $iCode)
                    ; Return 1 ; nonzero to not allow the default processing
                    Return 0 ; zero to allow the default processing
                Case $NM_DBLCLK ; The user has double-clicked the left mouse button within the control
                    _DebugPrint("$NM_DBLCLK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
                            "-->Code:" & @TAB & $iCode)
                    ; Return 1 ; nonzero to not allow the default processing
                    Return 0 ; zero to allow the default processing
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY

Func _DebugPrint($s_Text, $sLine = @ScriptLineNumber)
    ConsoleWrite( _
            "!===========================================================" & @CRLF & _
            "+======================================================" & @CRLF & _
            "-->Line(" & StringFormat("%04d", $sLine) & "):" & @TAB & $s_Text & @CRLF & _
            "+======================================================" & @CRLF)
EndFunc   ;==>_DebugPrint

 

1 person likes this

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
Sign in to follow this  
Followers 0

  • Similar Content

    • Luigi
      By Luigi
      Greetings,
      I try work with WM_CONTEXT, I take from help's example, and modify to generate a custom context menu to each control (ListView, TreeView or another control).
      If you leave with default/generic it work.
      If you custom for a specific control, does not work, what is my erro?
      When I say work, I want call the Switch...Case from WM_COMMAND.
      This is the code:
      #include <GUIConstantsEx.au3> #include <GuiMenu.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> OnAutoItExitRegister("OnExit") Opt("GUIOnEventMode", 1) Opt("GUIEventOptions", 1) Opt("MustDeclareVars", 1) Global Enum $eOPEN = 1000, $eSAVE, $eINFO Global $hGui = GUICreate("Menu", 400, 300) ConsoleWrite("$hGui........[" & $hGui & "]" & @LF) Global $iListView1 = GUICtrlCreateListView("", 10, 10, 80, 120) Global $hListView1 = GUICtrlGetHandle($iListView1) ConsoleWrite("$iTreeView1..[" & $iListView1 & "] $hListView1..[" & $hListView1 & "]" & @LF) Global $iListView2 = GUICtrlCreateListView("", 100, 10, 80, 120) Global $hListView2 = GUICtrlGetHandle($iListView2) ConsoleWrite("$iTreeView1..[" & $iListView2 & "] $hListView2..[" & $hListView2 & "]" & @LF) Global $iTreeView1 = GUICtrlCreateTreeView(190, 10, 80, 120) Global $hTreeView1 = GUICtrlGetHandle($iTreeView1) ConsoleWrite("$iTreeView1..[" & $iTreeView1 & "] $hTreeView1..[" & $hTreeView1 & "]" & @LF) GUISetOnEvent($GUI_EVENT_CLOSE, "Quit", $hGui) GUISetState(@SW_SHOW, $hGui) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUIRegisterMsg($WM_CONTEXTMENU, "WM_CONTEXTMENU") GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") While Sleep(25) WEnd Func Quit() Exit EndFunc ;==>Quit Func OnExit() GUIDelete($hGui) EndFunc ;==>OnExit ; Handle WM_COMMAND messages Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam ConsoleWrite("WM_CONTEXTMENU( $hWnd=" & $hWnd & ", $iMsg=" & $iMsg & ", $wParam=" & $wParam & ", $lParam=" & $lParam & " )" & @LF) Switch $wParam Case $eOPEN ConsoleWrite("Open" & @LF) Case $eSAVE ConsoleWrite("Save" & @LF) Case $eINFO ConsoleWrite("Info" & @LF) EndSwitch EndFunc ;==>WM_COMMAND ; Handle WM_CONTEXTMENU messages Func WM_CONTEXTMENU($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam ConsoleWrite("WM_CONTEXTMENU( $hWnd=" & $hWnd & ", $iMsg=" & $iMsg & ", $wParam=" & $wParam & ", $lParam=" & $lParam & " )" & @LF) Local $hMenu = _GUICtrlMenu_CreatePopup() _GUICtrlMenu_InsertMenuItem($hMenu, 0, "Generic Open", $eOPEN) _GUICtrlMenu_InsertMenuItem($hMenu, 1, "Generic Save", $eSAVE) _GUICtrlMenu_InsertMenuItem($hMenu, 2, "Generic Info", $eINFO) _GUICtrlMenu_TrackPopupMenu($hMenu, $wParam) _GUICtrlMenu_DestroyMenu($hMenu) Return True ; does not work #cs #forceref $hWnd, $iMsg, $wParam, $lParam ConsoleWrite("WM_CONTEXTMENU( $hWnd=" & $hWnd & ", $iMsg=" & $iMsg & ", $wParam=" & $wParam & ", $lParam=" & $lParam & " )" & @LF) Local $hMenu = _GUICtrlMenu_CreatePopup() Switch $wParam Case $hListView1 _GUICtrlMenu_InsertMenuItem($hMenu, 0, "$hListView1 Open", $eOPEN) _GUICtrlMenu_InsertMenuItem($hMenu, 1, "$hListView1 Save", $eSAVE) _GUICtrlMenu_InsertMenuItem($hMenu, 2, "$hListView1 Info", $eINFO) Case $hListView2 _GUICtrlMenu_InsertMenuItem($hMenu, 0, "$hListView2 Open", $eOPEN) _GUICtrlMenu_InsertMenuItem($hMenu, 1, "$hListView2 Save", $eSAVE) _GUICtrlMenu_InsertMenuItem($hMenu, 2, "$hListView2 Info", $eINFO) Case $hTreeView1 _GUICtrlMenu_InsertMenuItem($hMenu, 0, "$hTreeView1 Open", $eOPEN) _GUICtrlMenu_InsertMenuItem($hMenu, 1, "$hTreeView1 Save", $eSAVE) _GUICtrlMenu_InsertMenuItem($hMenu, 2, "$hTreeView1 Info", $eINFO) EndSwitch _GUICtrlMenu_TrackPopupMenu($hMenu, $wParam) _GUICtrlMenu_DestroyMenu($hMenu) Return True #ce EndFunc ;==>WM_CONTEXTMENU Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") EndFunc ;==>WM_NOTIFY  
    • r0ash
      By r0ash
      Hey guys, MattDiesel over Stackoverflow mentioned this beautiful piece of code 
      #include <WindowsConstants.au3> #include <WinAPI.au3> Local $IDM_FONT = 33 Local $hWindow = WinGetHandle("Untitled - Notepad") _WinAPI_PostMessage($hWindow, $WM_COMMAND, $IDM_FONT, 0) Local $hFontWin = WinWait("Font") $select = ControlCommand($hFontWin, "", "ComboBox1", "GetCurrentSelection", "") WinClose($hFontWin) MsgBox(0,"", $select) I realized that _WinAPI_PostMessage can trigger menu click event, even if Notepad is minimized.
      How do we know what is the decimal value of *any menu item or sub-menu item*? How we know "Format > Font" menu-item is 33 as wParam to _WinAPI_PostMessage()? Have a look at snapshot.
      Regards.

    • dubd83
      By dubd83
      I am working on an automation project and I am having issues finding documentation on selecting an item from a context menu, or a menu that appears upon a right click. I tried using the Send("{DOWN}") command as a workaround but it's not very redundant. Essentially I need to search the context menu for the string "Abort Text" and click that option. The class of the context menu is showing as CLASS:#32768. I have uploaded a portion of the context menu. If it helps I have the handle of the treeview where the first item is right clicked in order to make the treeview appear.
       
       

    • Skysnake
      By Skysnake
      Hi Everyone
      I have a very sexy Treeview that creates a "phonebook" type listing
      +Jones [an item]
      ---- Albert [a child]
      +Webster
      ---- David
      ---- John
      ---- Peter
      It uses these styles:
      Local $iStyle = BitOr ( $TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGANDDROP, $TVS_SHOWALWAYS, $TVS_CHECKBOXES ) It is created with GUICtrlCreateTreeview() and uses 
      _GUICtrlTreeView_Add() and 
      _GUICtrlTreeView_AddChild() I want checkboxes ONLY on the items (surnames above), not the children. And, preferably the user must be able to click (select) the line (child) for info, but that info must preferable point to the item, so when browsing and click "John" the checkbox for WEBSTER should get ticked and return the handle/control id for WEBSTER, which I can then use to manipulate the item (and children) further.
      Issue #1
      My first issue is to get the checkboxes away from the children.
      Issue #2
      The info from the children can probably gleaned from here:
      Thx @Melba23 
       Thx, skysnake
       
       
    • FrancescoDiMuro
      By FrancescoDiMuro
      Hi guys!
      First of all, I want to apologize with @Melba23, @JLogan3o13, and @Jos ( I don't know why the tag sometimes works and sometimes doesn't ), for my bad attitude I have had with
      them. I want to explain why I was so angry, but that's not an excuse to my bad attitude...
      I have health problem, and lastly, I am ever more angry because I'm fighting with these problems for 5 years and I feel worse than 5 years ago, even If I had a lot of investigations about with a lot of Doctors, and there's no cure for my pathology. I don't want to touch anyone with my "story", but I wanted to explain why, sometimes, you can feel my anger in my words.
      I promise I'll try to be as polite as my mom taught me, and to explain all I'd like to develop, posting all you need ( sample codes... ).

      Now, let's talk about my project.
      Let's start from 0! 
      I'd like to implement a database with AutoIt, for the warehouse management.
      First of all, I'd like to set some "goals" which I want to respect, developing my application:
      Efficiency: I'd like to develop an application that is fast as possible; Easy to make changes: I'd like to develop an application that is easy to modify, so, without too much complicated arguments; Noob-proof: As a noob as I am, my AutoIt knowledge starts from June 2016, so, I'm not a blade in this programming language. I studied C++, C, JavaScript, CSS, HTML and PHP, but, all of these programming language has a different approach comparing with AutoIt. I could be wrong in what I just estabilished! I want to tell you, again, that I'm here to listen to your suggestions, so, everything you say, it's something that I could learn, and I want to learn AutoIt, so, don't be scared to share your opinions, or your knowledge! I'm here to learn "How to AutoIt!"  Ok, so, after having set some goals I'd like to hit, I want to ask you some information:
      What's the best way to develop a database with AutoIt? With a .txt file? With an Excel workbook? 
      I was working on Excel workbook, but, I don't know, I could always be wrong in terms of efficiency and "easy to make changes"; I have to create a GUI, in order to let the user do things ( I think it was quite obvious ), so, I have been always used GUI functions like GUICreate and so on; anything about _GDI_Plus or something else. Most, I used _GUI* functions. What's the best way to manage different GUIs? OnEvent Mode or Message Loop "mode"? Now, I'd like to make a list of what I'd like my application would do:
      Reading stocks: I manage mainly 2 manufacturers, so, If I will work with an Excel workbook, I'd prefer to divide first manufacturer with the second; Add product: Simply, If a product does exist, the application prompt to the user an input box, with a sort of summary ( Product name, quantity ) of the product he's adding; ELSE, if the product does not exist, an "Add New Product" GUI should appers; Withdraw product: As a warehouse, I need to add and to withdraw product... This "function" should performs the simply task of reserach the product based on his ID and, prompt an InputBox to the user, with a little summary of the product he's withdrawing and, the quantity of the product after the withdraw; Search product: I'd like to develop a "product reserach", based on the ID of the product(s), or based on the Description of the product(s)... It'd be very nice!  Create DDT: Create a DDT with a pre-formatted Excel sheet. Just insert some information, and then all the products that have been withdrawn from the database ( maximum 14 per DDT ); I have already done some of work I described here, and you can find all files you need attached to this post. 
      I don't want you to do this. Just, don't post your code that I have been looking for, but let me try, with your help, to get an appropriate and efficient solution to what I'm asking.
      The last, but not the less important, the recognition I can give to you is publish your name ( or alias ) on the "developer section", more than a donation for everyone who has take part to this project.

      Please, if you want to know further information ( I think I've been exhaustive enough ), write here or on a PM. 

      Another time, a big thank you to this fantastic community and, a bigger one, to the developers of this amazing and powerful programming language.

      Enjoy your night.

      Francesco 

      PS: I will post the code tomorrow ( the most updated code ), so you can see where I have been arrived and, nothing Warehouse_Management.xlsx
      Gestione_Magazzino_SYS.au3