Visual Studio Integration Toolkit for Microsoft Dynamics GP (Product ID: 5986) =============================================================================== Written by David Musgrave of Winthrop Development Consultants Previously known as Menus for Visual Studio Tools. Created on : 30-May-2008 Last Modified: 01-Oct-2024 Version History =============== Version 18.07 build 19.2 (Released 01-Oct-2024) Installer: 18.07.0019.2 ----------------------------------------------------------------------- Initial RTM Build. Version 18.07 build 19.0 (Released 24-Aug-2024) Installer: 18.07.0019.0 ----------------------------------------------------------------------- Initial Beta Build. Version 18.06 build 19.2 (Released 15-May-2024) Installer: 18.06.0019.2 ----------------------------------------------------------------------- Updated all Maintenance and lookup windows to fix an issue where a table already locked error can occur if the user seeded a lookup with an ID value that already exists. Version 18.06 build 19.1 (Released 19-Jan-2024) Installer: 18.06.0019.1 ----------------------------------------------------------------------- Make sure Tables are closed when exiting Dynamics Process Server (DPS) to avoid logout errors. Version 18.06 build 19.1 (Released 19-Jan-2024) Installer: 18.06.0019.1 ----------------------------------------------------------------------- Updated copyright notices for the year 2024. Fixed installer complaining about DPM.EXE when Dell Peripheral Manager is installed and running. Added FormRegisterReserve and FormRegisterReserveMaint functions to Custom Forms to allow requesting a previously used form number. Updated GP Power Tools API for new FormRegisterReserve and FormRegisterReserveMaint commands. Changing to Build 19 will help avoid confusion between VSIT Build numbers and GP Version numbers. Version 18.06 build 18.2 (Released 04-Oct-2023) Installer: 18.06.0018.2 ----------------------------------------------------------------------- Initial RTM Build Fixed issue with Display_Existing_Record event on VSTM_Forms_Inquiry_01 and VSTM_Forms_Inquiry_Lines_01 forms. Version 18.06 build 18.0 (Released 08-Sep-2023) Installer: 18.06.0018.0 ----------------------------------------------------------------------- Added New Helper Functions FormCheckSecurity, FormGetNumber, and FormGetNames to Custom Forms API. Version 18.06 build 18.0 (Released 07-Sep-2023) Installer: 18.06.0018.0 ----------------------------------------------------------------------- Fixed issue with QLM Licenses duplicating after product name change. Version 18.06 build 18.0 (Released 31-Aug-2023) Installer: 18.06.0018.0 ----------------------------------------------------------------------- Initial Beta Build Version 18.05 build 18.1 (Released 21-Aug-2023) Installer: 18.05.0018.1 ----------------------------------------------------------------------- Added Menu Item and Area Page Usage information to the Module information window of the About Visual Studio Integration Toolkit window. Added ExecuteModified, ExecuteModifiedEx and ExecuteModifiedEx? series of Helper Functions to allow sanscript to be executed against Modified Forms. Added Custom Forms Module (codenamed Blankety Blanks) to allow for the creation of different types of Dexterity based Custom Forms. Added Activity Tracking to Custom Forms of type Maintenance with Lines and Setup. Expanded Custom Forms and Reports to 10 forms of each type. Added External API for Custom Forms to be used from GP Power Tools. Updated to Registration System to add Email Distribution List for additional emails to be included in renewal notes, invoices, update notices, etc. Added feature to open Update Check Window if new install older than published version. Version 18.05 build 17.3 (Released 10-Jan-2023) Installer: 18.05.0017.3 ----------------------------------------------------------------------- Updated copyright notice for the year 2023. Updated Registration System to restore previous registration keys if no new keys are available for all situations and not just when Grace Period is active. Version 18.05 build 17.2 (Released 03-Oct-2022) Installer: 18.05.0017.2 ----------------------------------------------------------------------- Added fix to remove duplicated Area Page Navigation Buttons. Updated Installer to allow Microsoft Dynamics GP to launched upon completion. Version 18.05 build 17.0 (Released 01-Sep-2022) Installer: 18.05.0017.0 ----------------------------------------------------------------------- Initial 18.5 Pre-release Build. Version 18.04 build 17.1 (Released 10-Aug-2022) Installer: 18.04.0017.1 ----------------------------------------------------------------------- Change http:// hyperlinks to https:// for void need for redirection. Updated copyright notice for the year 2022. Added Please Wait Dialogs when opening the Registration window when it is communicating with the registration server. Fixed possible Illegal Address error if Registration window is closed immediately after clicking OK on Proxy Settings window. Updated Table Upgrade system to confirm before upgrading version and table structures for a new build as this will force all workstations to be upgraded to match. Added WindowSetTitleByProduct Helper Function to set the title of a window in any product. Updated Installer Version 18.04 build 16.2 (Released 01-Oct-2021) Installer: 18.04.0016.2 ----------------------------------------------------------------------- Initial 18.4 RTM Build. Version 18.04 build 16.0 (Released 01-Sep-2021) Installer: 18.04.0016.0 ----------------------------------------------------------------------- Initial 18.4 Pre-release Build. Version 18.03 build 16.2 (Released 02-Jan-2021) Installer: 18.03.0016.2 ----------------------------------------------------------------------- Added Help Button to windows. Fixed code to prevent updated version check for Process Server and Service Mode. Prevent shortcut access to modal and internal windows. Updated About Window to require administrator privileges to Uninstall or Reinstall Winthrop products. Updated Installer Welcome window wording to reduce the chance of confusion about version numbers of Winthrop products vs Microsoft Dynamics GP. Updated copyright notice for the year 2021. Version 18.03 build 16.1 (Released 06-Oct-2020) Installer: 18.03.0016.1 ----------------------------------------------------------------------- Initial 18.3 Build. Version 18.02 build 16.1 (Released 11-Aug-2020) Installer: 18.02.0016.1 ----------------------------------------------------------------------- Remove previous deprecated registration system from product. Added workaround fix to issue where Visual Studio Addin Events for Functions and Procedures are disabled after importing a Customization Maintenance package. Added Visual Studio Integration Toolkit windows to the Administration >> System >> Cards menus. Added Additional Launch File Installer to install product into additional Launch Files for multiple Launch File configurations. Updated Additional Launch File Installer to exclude Wennsoft/Key2Act WSUTIL.SET file. Updated Additional Launch File Installer to remember Excluded Launch File Names in WDC_InstallExclude Dex.ini file setting. Enhancements to registration system to preserve invoicing data when automatically creating subscription records for new versions. Added extra warning on login if there is a dictionary version mismatch between version constants and dictionary version properties, usually caused by old custom forms dictionaries. Added RunMacroFast Helper Function to run macros without the UI flicker which can improve performance by about 30%. Added MkDateTime Helper Function to create datetime datatypes. Added ResourceGetPhysicalName Helper Function to get a Physical Name of a Field or Table from its Resource ID. Added FieldGetPhysicalName Function to get the Physical Name of a Field from its Technical Name. Added TableGetPhysicalName Function to get the Physical Name of a Table from its Technical Name. Updated Table installation system to be more robust and provide more information if there are problems creating a table. Further Updates for Web Client compatibility. Added optional warning or warning and exit feature to the Registration window, so you can prevent users accessing the system if the product is not registered. Version 18.02 build 15.8 (Released 15-Feb-2020) Installer: 18.02.0015.8 ----------------------------------------------------------------------- Fixes required for Web Client compatibility to the registration system when using a proxy server. Version 18.02 build 15.7 (Released 18-Dec-2019) Installer: 18.02.0015.7 ----------------------------------------------------------------------- Fixed registration logging bug when updating builds or hotfixes. Version 18.02 build 15.7 (Released 24-Oct-2019) Installer: 18.02.0015.7 ----------------------------------------------------------------------- Enhanced Registration support for trial keys. Version 18.02 build 15.7 (Released 07-Oct-2019) Installer: 18.02.0015.7 ----------------------------------------------------------------------- Initial Build for Modern Lifecycle 18.02 release. Updated for Microsoft Dynamics GP October 2019 RTM code. Version 18.00 build 15.7 (Released 30-Sep-2019) Installer: 18.00.0015.7 ----------------------------------------------------------------------- Added Support for Modern Lifecycle version numbering. Version 18.00 build 15.6 (Released 11-Jul-2019) Installer: 18.00.0015.6 ----------------------------------------------------------------------- Updated Registration system to ensure grace period stays active if Update Keys is clicked after subscription has already expired. Version 18.00 build 15.6 (Released 24-May-2019) Installer: 18.00.0015.6 ----------------------------------------------------------------------- Fixed minor bug in GetTag() function where the Form and Cmd parameters were reversed. Version 18.00 build 15.5 (Released 06-Mar-2019) Installer: 18.00.0015.5 ----------------------------------------------------------------------- Increase Registration Server Ping Timeout from 5 seconds to 10 seconds to avoid false activating of offline mode. Version 18.00 build 15.4 (Released 18-Feb-2019) Installer: 18.00.0015.4 ----------------------------------------------------------------------- Added improved logging of Registration system calls. Added improved handling for systems that are offline and cannot access the registration server. Added option to mark a system as not internet connected so that it stays offline. This can help with communication timeouts. Added improved handling for systems that are offline and cannot access the update check server. Added further changes to improve handling of systems that are offline and cannot access the registration server. Version 18.00 build 15.3 (Released 14-Jan-2019) Installer: 18.00.0015.3 ----------------------------------------------------------------------- Updated Copyright Notices for 2019. Enhancements to Automatic Update Check and Registration systems to include additional warnings and version check. Fixed minor issues with error messages in Registration system. Fixed issue with Registration Contact Details window where the list of countries disappears. Version 18.00 build 15.2 (Released 20-Dec-2018) Installer: 18.00.0015.2 ----------------------------------------------------------------------- Fixed Registration Expiry Warnings. Updated Offline Registration Request Report for compatibility with Registration system. Updated Country auto formatting to remove not found error when selecting countries with additional words in their name. Version 18.00 build 15.1 (Released 06-Dec-2018) Installer: 18.00.0015.1 ----------------------------------------------------------------------- Fixed Registration System to ensure new module is registered with same expiry date as existing base module. Version 18.00 build 15.1 (Released 30-Nov-2018) Installer: 18.00.0015.1 ----------------------------------------------------------------------- Updated Registration window to format contact details and standardize the country selection. Further updates to Registration Update Check systems to improve performance and functionality. Updated About window and registration window for better Web Client compatibility. Updated About window to simplify un-install with option for workstation only or full system un-install. Added support for adding menu entries as the first entry in a menu using a BelowTag value of -1. Added new SetNamedProperty command for storing additional string property data against a menu. Added new GetNamedProperty command for retrieving additional string property data against a menu. Added new SetAccelerator command for setting the keyboard shortcut/accelerator for a menu. Added new GetAccelerator command for getting the keyboard shortcut/accelerator for a menu. Added support for Area Pages with EventRegisterAreaPage event script to create Area Page. Added support for Area Pages with RegisterAreaPage command to create Area Page. Added support for Area Pages with EventHandlerAreaPage event script to display Area Page content. Added support for Area Pages with RegisterAreaPageContent command to display Area Page content. Area Page support means custom navigation added to the top level menus works on the Web Client. Added over 220 Visual Studio Helper Functions to MenusForVisualStudioTools.Forms.VstmHelper.Functions; Version 18.00 build 14.2 (Released 24-Jul-2018) Installer: 18.00.0014.2 ----------------------------------------------------------------------- Fixed issue with Addin DLL not loading in Web Client or Service Modes. Version 18.00 build 14.1 (Released 10-Jul-2018) Installer: 18.00.0014.1 ----------------------------------------------------------------------- Further updates to Registration Update Check systems to improve performance and functionality. Version 18.00 build 13 (Released 01-Jul-2018) Installer: 18.00.0013.3 --------------------------------------------------------------------- Updates to Registration systems for better performance and Sub Site Support. Version 18.00 build 13 (Released 27-Jun-2018) Installer: 18.00.0013.2 --------------------------------------------------------------------- Updates to Registration systems for better error reporting and Sub Site Support. Version 18.00 build 13 (Released 09-May-2018) Installer: 18.00.0013.1 --------------------------------------------------------------------- Updates to Registration and Update Check systems. Version 18.00 build 12 (Released 05-Apr-2018) Installer: 18.00.0012.10 ---------------------------------------------------------------------- Added visual indicator of when registration window is running in offline mode. Fixed auto renewal code for free products to renew annual subscriptions from 45 days before expiry. Version 18.00 build 12 (Released 17-Mar-2018) Installer: 18.00.0012.9 --------------------------------------------------------------------- Added additional exception handling to ensure the Communicating with Registration Server window gets closed. Added automatic updating of registration when Microsoft Dynamics GP Registration keys are entered or updated. Version 18.00 build 12 (Released 16-Feb-2018) Installer: 18.00.0012.8 --------------------------------------------------------------------- Added additional handling to registration system to prevent users entering incorrect data. Version 18.00 build 12 (Released 09-Feb-2018) Installer: 18.00.0012.7 --------------------------------------------------------------------- Added additional handling to registration system when unable to access registration servers. Version 18.00 build 12 (Released 24-Jan-2018) Installer: 18.00.0012.6 --------------------------------------------------------------------- Updated Registration System to include optional logging facility. Version 18.00 build 12 (Released 08-Dec-2017) Installer: 18.00.0012.5 --------------------------------------------------------------------- Automatically remove Application.MenusForVisualStudioTools.dll from Addins folder if present. Fixed Automatic Update Check displaying error messages if unable to contact web service. Added Retry option to Update Check window to allow error messages to be displayed if needed. Added warning when Addin DLL is not installed when opening Registration window. Added additional warnings when Addin DLL is not installed when trying to register. Added additional instructions to Registration Contact Details window. Added Access to Registration window from Additional Menu of Dynamics GP Registration window. Added version information to Registration and Registration Contact Details windows. Version 18.00 build 12 (Released 02-Dec-2017) Installer: 18.00.0012.4 --------------------------------------------------------------------- Update Installer Help Links. Version 18.00 build 12 (Released 17-Nov-2017) Installer: 18.00.0012.3 --------------------------------------------------------------------- Initial Microsoft Dynamics GP 2018 release. Version 16.00 build 12 (Released 17-Nov-2017) Installer: 16.00.0012.3 --------------------------------------------------------------------- Fixed Issue where menus were duplicating when switching companies. Version 16.00 build 12 (Released 15-Nov-2017) Installer: 16.00.0012.2 --------------------------------------------------------------------- Fixed timing issue with menu registration sometimes occurring before product registration and generating error code -17. Version 16.00 build 12 (Released 14-Nov-2017) Installer: 16.00.0012.1 --------------------------------------------------------------------- Added automatic table creation and update code. Fixed Do Not Remind Again not working for Registration dialogs. Added Automatic Check for Updates feature. Added internal Registration System and Mekorma Product Manager removal and cleanup. Version 16.00 build 11 (Released 14-Jun-2017) Installer: 16.00.0011.9 --------------------------------------------------------------------- Added Check for Updates to Options menu of About Visual Studio Integration Toolkit window. Updated Code Signing Certificate. Added Visual Studio Tools Addin Assembly. Version 16.00 build 11 (Released 14-Mar-2017) Installer: 16.00.0011.8 --------------------------------------------------------------------- Updated Registration Handling code to handle when it is called before it is fully initialised. Version 16.00 build 11 (Released 23-Feb-2017) Installer: 16.00.0011.7 --------------------------------------------------------------------- Fixed Upgrade registration message by re-enabling Dynamics.set launch file re-ordering to ensure product manager is above Visual Studio Integration Toolkit. Updated Mekorma Product Manager support files. Version 16.00 build 11 (Released 29-Oct-2016) Installer: 16.00.0011.6 --------------------------------------------------------------------- Updated Installer to force re-install of Mekorma Product Manager when dictionary has been deleted. Version 16.00 build 11 (Released 24-Oct-2016) Installer: 16.00.0011.5 --------------------------------------------------------------------- Updated SQL Permission Checks to use 'SQLLoginID' of globals instead of 'User ID' of globals to support Web client only users. Updated Subscription Expiry dialogs to allow them to be dismissed for longer periods and only show to Administrators. Version 16.00 build 11 (Released 01-Jun-2016) Installer: 16.00.0011.4 --------------------------------------------------------------------- Updated Mekorma Product Manager support files. Version 16.00 build 11 (Released 01-Jun-2016) Installer: 16.00.0011.3 --------------------------------------------------------------------- Remove custom forms and reports dictionaries (VSTM_FRM.DIC and VSTM_RPT.DIC) during install to avoid corruption issues. Version 16.00 build 11 (Released 01-Jun-2016) Installer: 16.00.0011.2 --------------------------------------------------------------------- Updated Mekorma Product Manager to build 2. Version 16.00 build 11 (Released 01-Jun-2016) Installer: 16.00.0011.1 --------------------------------------------------------------------- Added Registration System to track usage of Visual Studio Integration Toolkit. Added Full Installer for Visual Studio Integration Toolkit. Version 16.00 build 10 ---------------------- Initial build for Microsoft Dynamics GP 2016 Version 14.00 build 10 ---------------------- Initial Build for Microsoft Dynamics GP 2015. Version 12.00 build 10 ---------------------- First Build of Winthrop Development Consultants Visual Studio Integration Toolkit for Microsoft Dynamics GP. Version 12.00 build 9 --------------------- Initial Build for Microsoft Dynamics GP 2013. Version 11.00 build 9 --------------------- Initial Build for Microsoft Dynamics GP 2010. Added workaround for Dexterity Bug 52846: Where Command_GetTag() does not work correctly when in different dictionary context. Added Simple Menu interface using functions RegisterSimple() and GetTagSimple(). Added form Security Check functions using functions CheckSecurity() and CheckSecurityByName(). Added Security Error Message Dialog using function DisplaySecurityError(). Added Functions which can be used to register Events against EventRegister() & EventHandler() (for GP 2010 onwards). Added support for Project, Field Service, Manufacturing and Human Resources Commands to GetTagSimple() function. Version 10.00 build 8 --------------------- Added SetProtectedMode function to protect accessing of menus from other products. Added ValidateTag, ValidateForm, ValidateFormByName,ValidateCmd, ValidateCmdByName functions. Improved API Parameter Validation using new Validate series of functions. Added Unregister function. Version 10.00 build 7 --------------------- Added GetVersion and DisplayAbout functions. Changed Product Name to Menus for Visual Studio Tools for Microsoft Dynamics GP 10.0. Version 10.00 build 6 --------------------- Support for up to 100 Menu Entries, Command Lists and Separators. Internally numbered from 00 to 99. API Function Calls shift to global functions. Version 10.00 build 5 --------------------- Updated Documentation. Changed Product ID to 5986. Version 10.00 build 4 --------------------- Support to link menu item to a form in any dictionary for Security control. Menu items without security access will be disabled. Added GetFormResID, RegisterWithSecurity, ApplySecurity, RemoveSecurity functions. Added version checking to ensure correct version of dictionary is being used. Version 10.00 build 3 --------------------- Added GetCaption, GetTooltip, SetCaption, SetTooltip functions. Support for up to 99 Menu Entries, Command Lists and Separators, used a macro to add additional entries. Version 10.00 build 2 --------------------- New Command Tag based API, no longer uses Temporary staging table in Dexterity code. Support for up to 30 Menu Entries, Command Lists and Separators. Version 10.00 build 1 --------------------- Initial Build with support for 20 Menu Entries or Command Lists and Separators. Usage Examples ============== Below are the code examples for using the Menus for Visual Studio Tools for Microsoft Dynamics GP with C# and VB.Net: Example C# Code after adding Reference to Application.MenusForVisualStudioTools.dll =================================================================================== // Visual Studio Integration Toolkit for Microsoft Dynamics GP // // Developed by David Musgrave of Winthrop Development Consultants // // C# Demonstration example code // // For Build 18 or Later, Last Modified 14-Jul-2023. // using System; using System.Windows.Forms; using Microsoft.Dexterity.Bridge; using Microsoft.Dexterity.Applications; using Microsoft.Dexterity.Applications.MenusForVisualStudioToolsDictionary; namespace VSTMenusCSharp { [SupportedDexPlatforms(DexPlatforms.DesktopClient | DexPlatforms.WebClient | DexPlatforms.Service)] public class GPAddIn : IDexterityAddIn { // Application Name const string APPNAME = "VSTMenusCSharp"; // Dictionary ID Constants const short DYNAMICS = 0; // Shortcut Key Modifier Constants const int COMMAND_SHORTCUT_CTRL = 65536; const int COMMAND_SHORTCUT_CTRLSHIFT = 327680; const int COMMAND_SHORTCUT_CTRLALT = 196608; const int COMMAND_SHORTCUT_ALT = 131072; const int COMMAND_SHORTCUT_ALTSHIFT = 393216; const int COMMAND_SHORTCUT_CTRLALTSHIFT = 458752; // Shortcut Key Function Key Constants, can be used instead of ASCII value const short COMMAND_SHORTCUT_KEY_F1 = 112; const short COMMAND_SHORTCUT_KEY_F2 = 113; const short COMMAND_SHORTCUT_KEY_F3 = 114; const short COMMAND_SHORTCUT_KEY_F4 = 115; const short COMMAND_SHORTCUT_KEY_F5 = 116; const short COMMAND_SHORTCUT_KEY_F6 = 117; const short COMMAND_SHORTCUT_KEY_F7 = 118; const short COMMAND_SHORTCUT_KEY_F8 = 119; const short COMMAND_SHORTCUT_KEY_F9 = 120; const short COMMAND_SHORTCUT_KEY_F10 = 121; const short COMMAND_SHORTCUT_KEY_F11 = 122; const short COMMAND_SHORTCUT_KEY_F12 = 123; // Menu Example Variables short MenuListTag1; short MenuTag1; short MenuTag2; short MenuTag3; short MenuTag4; // Area Page Example Variables short AreaPageTag; short AreaPageTag1; short AreaPageTag2; short AreaPageTag3; short AreaPageTag4; short AreaPageTag5; short AreaPageTag6; short AreaPageTag7; short AreaPageListTag1; short AreaPageListTag2; short AreaPageListTag3; short AreaPageListTag4; short AreaPageListTag5; short AreaPageListTag6; short AreaPageListTag7; // IDexterityAddIn interface public void Initialize() { // Register Event to add menu entries MenusForVisualStudioTools.Functions.EventRegister.InvokeAfterOriginal += new EventRegisterFunction.InvokeEventHandler(VSTMEventRegister); // Register Event to handle callbacks from menu entries MenusForVisualStudioTools.Functions.EventHandler.InvokeAfterOriginal += new EventHandlerFunction.InvokeEventHandler(VSTMEventHandler); // Register Event to add Area Page Button MenusForVisualStudioTools.Functions.EventRegisterAreaPage.InvokeAfterOriginal += new EventRegisterAreaPageFunction.InvokeEventHandler(VSTMEventRegisterAreaPage); // Register Event to add Area Page Content MenusForVisualStudioTools.Functions.EventHandlerAreaPage.InvokeAfterOriginal += new EventHandlerAreaPageFunction.InvokeEventHandler(VSTMEventHandlerAreaPage); // Register Event to Register Custom Forms MenusForVisualStudioTools.Functions.EventRegisterForm.InvokeAfterOriginal += new EventRegisterFormFunction.InvokeEventHandler(VSTMEventRegisterForm); // Register Event to handle Custom Forms Events MenusForVisualStudioTools.Functions.EventHandlerForm.InvokeAfterOriginal += new EventHandlerFormFunction.InvokeEventHandler(VSTMEventHandlerForm); } // Script to Register menu entries void VSTMEventRegister(object sender, EventRegisterFunction.InvokeEventArgs e) { short ParentTag = 0; short BelowTag = 0; short ResID = 0; short Err = 0; // Menu Example try { // Get Parent Tag for command list to add menu to ParentTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_Sales", "CL_Sales_Cards"); // Dictionary ID, Form Name, Command Name if (ParentTag <= 0) { throw new Exception("Parent GetTagByName, error code: " + Convert.ToString(ParentTag)); } // Get Below Tag for command/command list to add menu below BelowTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_Sales", "RM_Customer_Maintenance"); // Dictionary ID, Form Name, Command Name if (BelowTag <= 0) { throw new Exception("Below GetTagByName, error code: " + Convert.ToString(BelowTag)); } // Get Security Form Resource ID for menus to inherit security access from ResID = MenusForVisualStudioTools.Functions.GetFormResId.Invoke( DYNAMICS, "RM_Customer_Maintenance"); // Get Form Resource ID for Security if (ResID <= 0) { throw new Exception("GetFormResId, error code: " + Convert.ToString(ResID)); } // Add Menu entry using API Function call to create parent for sub menu MenuListTag1 = MenusForVisualStudioTools.Functions.Register.Invoke( ParentTag, // Parent Command Tag "VS C\\# Test", // Menu Caption "", // Menu Tooltip 0, 0, // Menu Shortcut Key, Shortcut Modifier false, false, false, // Checked, Disabled, Hidden BelowTag, // Add Below Command Tag false, true); // Add Separator, Add Command List if (MenuListTag1 <= 0) { throw new Exception("Command List Register, error code: " + Convert.ToString(MenuListTag1)); } // Add Menu entry using API Function call to create first sub menu entry with security MenuTag1 = MenusForVisualStudioTools.Functions.RegisterWithSecurity.Invoke( MenuListTag1, // Parent Command Tag "VS C\\# Test 1", // Menu Caption "Click for VS C# Test 1", // Menu Tooltip (int)'A', COMMAND_SHORTCUT_CTRLALT, // Menu Shortcut Key, Shortcut Modifier true, false, false, // Checked, Disabled, Hidden 0, // Add Below Command Tag false, false, // Add Separator, Add Command List DYNAMICS, ResID); // Security Dictionary and Form Resource ID if (MenuTag1 <= 0) { throw new Exception("Command 1 RegisterWithSecurity, error code: " + Convert.ToString(MenuTag1)); } // Add Menu entry using API Function call to create second sub menu entry without security MenuTag2 = MenusForVisualStudioTools.Functions.Register.Invoke( MenuListTag1, // Parent Command Tag "VS C\\# Test 2", // Menu Caption "Click for VS C# Test 2", // Menu Tooltip (int)'B', COMMAND_SHORTCUT_CTRLALT, // Menu Shortcut Key, Shortcut Modifier false, false, false, // Checked, Disabled, Hidden 0, // Add Below Command Tag false, false); // Add Separator, Add Command List if (MenuTag2 <= 0) { throw new Exception("Command 2 Register, error code: " + Convert.ToString(MenuTag2)); } else { // And then add security as a separate step Err = MenusForVisualStudioTools.Functions.ApplySecurity.Invoke( MenuTag2, // Command Tag DYNAMICS, ResID); // Security Dictionary and Form Resource ID if (Err < 0) { throw new Exception("Command 2 ApplySecurity, error code: " + Convert.ToString(Err)); } } // Add Menu entry using API Function call to create a third menu entry MenuTag3 = MenusForVisualStudioTools.Functions.Register.Invoke( ParentTag, // Parent Command Tag "VS C\\# Test 3", // Menu Caption "Click for VS C# Test 3", // Menu Tooltip (int)'C', COMMAND_SHORTCUT_CTRLALT, // Menu Shortcut Key, Shortcut Modifier false, false, false, // Checked, Disabled, Hidden 0, // Add Below Command Tag true, false); // Add Separator, Add Command List if (MenuTag3 <= 0) { throw new Exception("Command 3 Register, error code: " + Convert.ToString(MenuTag3)); } // Add Menu entry using API Function call to create a fourth menu entry MenuTag4 = MenusForVisualStudioTools.Functions.RegisterSimple.Invoke( "CL_Sales_Cards", // Parent Command List Name "VS C\\# Test 4"); // Menu Caption if (MenuTag4 <= 0) { throw new Exception("Command 4 Register, error code: " + Convert.ToString(MenuTag4)); } // Change Tooltip on Customer Maintenance Menu Item, need to toggle Protected Mode MenusForVisualStudioTools.Functions.SetProtectedMode.Invoke(false); Err = MenusForVisualStudioTools.Functions.SetTooltip.Invoke( BelowTag, // Menu Tag "VS C# Test Tooltip"); // Tooltip MenusForVisualStudioTools.Functions.SetProtectedMode.Invoke(true); if (Err < 0) { throw new Exception("SetTooltip, error code: " + Convert.ToString(Err)); } } catch (Exception ex) { MessageBox.Show(ex.Message, APPNAME); // Unregister fourth menu entry if (MenuTag4 > 0) { Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( ParentTag, // Parent Command Tag MenuTag4); // Menu Tag if (Err < 0) { MessageBox.Show("Command 4 Unregister, error code: " + Convert.ToString(Err), APPNAME); } } // Unregister third menu entry if (MenuTag3 > 0) { Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( ParentTag, // Parent Command Tag MenuTag3); // Menu Tag if (Err < 0) { MessageBox.Show("Command 3 Unregister, error code: " + Convert.ToString(Err), APPNAME); } } // Unregister second menu entry if (MenuTag2 > 0) { Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( MenuListTag1, // Parent Command Tag MenuTag2); // Menu Tag if (Err < 0) { MessageBox.Show("Command 2 Unregister, error code: " + Convert.ToString(Err), APPNAME); } } // Unregister first menu entry if (MenuTag1 > 0) { Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( MenuListTag1, // Parent Command Tag MenuTag1); // Menu Tag if (Err < 0) { MessageBox.Show("Command 1 Unregister, error code: " + Convert.ToString(Err), APPNAME); } } // Unregister Menu List entry if (MenuListTag1 > 0) { Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( ParentTag, // Parent Command Tag MenuListTag1); // Menu Tag if (Err < 0) { MessageBox.Show("Command List Unregister, error code: " + Convert.ToString(Err), APPNAME); } } } // Area Page Example try { // Get Parent Tag for command list to add menu to ParentTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_System", "CL_Transactions"); // Dictionary ID, Form Name, Command Name if (ParentTag <= 0) { throw new Exception("Parent GetTagByName, error code: " + Convert.ToString(ParentTag)); } // Get Below Tag for command/command list to add menu below BelowTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_Sales", "CL_Sales_Transactions"); // Dictionary ID, Form Name, Command Name if (BelowTag <= 0) { throw new Exception("Below GetTagByName, error code: " + Convert.ToString(BelowTag)); } // Add Menu entry using API Function call to create parent for sub menu AreaPageListTag1 = MenusForVisualStudioTools.Functions.Register.Invoke( ParentTag, // Parent Command Tag "VS C\\# Area Page Test", // Menu Caption "", // Menu Tooltip 0, 0, // Menu Shortcut Key, Shortcut Modifier false, false, false, // Checked, Disabled, Hidden BelowTag, // Add Below Command Tag false, true); // Add Separator, Add Command List if (AreaPageListTag1 <= 0) { throw new Exception("Area Page Command List 1 Register, error code: " + Convert.ToString(AreaPageListTag1)); } // Add Menu entry using API Function call to create sub menu entry AreaPageTag1 = MenusForVisualStudioTools.Functions.Register.Invoke( AreaPageListTag1, // Parent Command Tag "VS C\\# Transactions Test", // Menu Caption "", // Menu Tooltip 0, 0, // Menu Shortcut Key, Shortcut Modifier false, false, false, // Checked, Disabled, Hidden 0, // Add Below Command Tag false, false); // Add Separator, Add Command List if (AreaPageTag1 <= 0) { throw new Exception("Area Page Command 1 Register, error code: " + Convert.ToString(AreaPageTag1)); } // Get Parent Tag for command list to add menu to ParentTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_System", "CL_Inquiry"); // Dictionary ID, Form Name, Command Name if (ParentTag <= 0) { throw new Exception("Parent GetTagByName, error code: " + Convert.ToString(ParentTag)); } // Get Below Tag for command/command list to add menu below BelowTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_Sales", "CL_Sales_Inquiry"); // Dictionary ID, Form Name, Command Name if (BelowTag <= 0) { throw new Exception("Below GetTagByName, error code: " + Convert.ToString(BelowTag)); } // Add Menu entry using API Function call to create parent for sub menu AreaPageListTag2 = MenusForVisualStudioTools.Functions.Register.Invoke( ParentTag, // Parent Command Tag "VS C\\# Area Page Test", // Menu Caption "", // Menu Tooltip 0, 0, // Menu Shortcut Key, Shortcut Modifier false, false, false, // Checked, Disabled, Hidden BelowTag, // Add Below Command Tag false, true); // Add Separator, Add Command List if (AreaPageListTag2 <= 0) { throw new Exception("Area Page Command List 2 Register, error code: " + Convert.ToString(AreaPageListTag2)); } // Add Menu entry using API Function call to create sub menu entry AreaPageTag2 = MenusForVisualStudioTools.Functions.Register.Invoke( AreaPageListTag2, // Parent Command Tag "VS C\\# Inquiry Test", // Menu Caption "", // Menu Tooltip 0, 0, // Menu Shortcut Key, Shortcut Modifier false, false, false, // Checked, Disabled, Hidden 0, // Add Below Command Tag false, false); // Add Separator, Add Command List if (AreaPageTag2 <= 0) { throw new Exception("Area Page Command 2 Register, error code: " + Convert.ToString(AreaPageTag2)); } // Get Parent Tag for command list to add menu to ParentTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_System", "CL_Reports"); // Dictionary ID, Form Name, Command Name if (ParentTag <= 0) { throw new Exception("Parent GetTagByName, error code: " + Convert.ToString(ParentTag)); } // Get Below Tag for command/command list to add menu below BelowTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_Sales", "CL_Sales_Reports"); // Dictionary ID, Form Name, Command Name if (BelowTag <= 0) { throw new Exception("Below GetTagByName, error code: " + Convert.ToString(BelowTag)); } // Add Menu entry using API Function call to create parent for sub menu AreaPageListTag3 = MenusForVisualStudioTools.Functions.Register.Invoke( ParentTag, // Parent Command Tag "VS C\\# Area Page Test", // Menu Caption "", // Menu Tooltip 0, 0, // Menu Shortcut Key, Shortcut Modifier false, false, false, // Checked, Disabled, Hidden BelowTag, // Add Below Command Tag false, true); // Add Separator, Add Command List if (AreaPageListTag3 <= 0) { throw new Exception("Area Page Command List 3 Register, error code: " + Convert.ToString(AreaPageListTag3)); } // Add Menu entry using API Function call to create sub menu entry AreaPageTag3 = MenusForVisualStudioTools.Functions.Register.Invoke( AreaPageListTag3, // Parent Command Tag "VS C\\# Reports Test", // Menu Caption "", // Menu Tooltip 0, 0, // Menu Shortcut Key, Shortcut Modifier false, false, false, // Checked, Disabled, Hidden 0, // Add Below Command Tag false, false); // Add Separator, Add Command List if (AreaPageTag3 <= 0) { throw new Exception("Area Page Command 3 Register, error code: " + Convert.ToString(AreaPageTag3)); } // Get Parent Tag for command list to add menu to ParentTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_System", "CL_Cards"); // Dictionary ID, Form Name, Command Name if (ParentTag <= 0) { throw new Exception("Parent GetTagByName, error code: " + Convert.ToString(ParentTag)); } // Get Below Tag for command/command list to add menu below BelowTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_Sales", "CL_Sales_Cards"); // Dictionary ID, Form Name, Command Name if (BelowTag <= 0) { throw new Exception("Below GetTagByName, error code: " + Convert.ToString(BelowTag)); } // Add Menu entry using API Function call to create parent for sub menu AreaPageListTag4 = MenusForVisualStudioTools.Functions.Register.Invoke( ParentTag, // Parent Command Tag "VS C\\# Area Page Test", // Menu Caption "", // Menu Tooltip 0, 0, // Menu Shortcut Key, Shortcut Modifier false, false, false, // Checked, Disabled, Hidden BelowTag, // Add Below Command Tag false, true); // Add Separator, Add Command List if (AreaPageListTag4 <= 0) { throw new Exception("Area Page Command List 4 Register, error code: " + Convert.ToString(AreaPageListTag4)); } // Add Menu entry using API Function call to create sub menu entry AreaPageTag4 = MenusForVisualStudioTools.Functions.Register.Invoke( AreaPageListTag4, // Parent Command Tag "VS C\\# Cards Test", // Menu Caption "", // Menu Tooltip 0, 0, // Menu Shortcut Key, Shortcut Modifier false, false, false, // Checked, Disabled, Hidden 0, // Add Below Command Tag false, false); // Add Separator, Add Command List if (AreaPageTag4 <= 0) { throw new Exception("Area Page Command 4 Register, error code: " + Convert.ToString(AreaPageTag4)); } // Get Parent Tag for command list to add menu to ParentTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_System", "CL_Setup"); // Dictionary ID, Form Name, Command Name if (ParentTag <= 0) { throw new Exception("Parent GetTagByName, error code: " + Convert.ToString(ParentTag)); } // Get Below Tag for command/command list to add menu below BelowTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_Sales", "CL_Sales_Setup"); // Dictionary ID, Form Name, Command Name if (BelowTag <= 0) { throw new Exception("Below GetTagByName, error code: " + Convert.ToString(BelowTag)); } // Add Menu entry using API Function call to create parent for sub menu AreaPageListTag5 = MenusForVisualStudioTools.Functions.Register.Invoke( ParentTag, // Parent Command Tag "VS C\\# Area Page Test", // Menu Caption "", // Menu Tooltip 0, 0, // Menu Shortcut Key, Shortcut Modifier false, false, false, // Checked, Disabled, Hidden BelowTag, // Add Below Command Tag false, true); // Add Separator, Add Command List if (AreaPageListTag5 <= 0) { throw new Exception("Area Page Command List 5 Register, error code: " + Convert.ToString(AreaPageListTag5)); } // Add Menu entry using API Function call to create sub menu entry AreaPageTag5 = MenusForVisualStudioTools.Functions.Register.Invoke( AreaPageListTag5, // Parent Command Tag "VS C\\# Setup Test", // Menu Caption "", // Menu Tooltip 0, 0, // Menu Shortcut Key, Shortcut Modifier false, false, false, // Checked, Disabled, Hidden 0, // Add Below Command Tag false, false); // Add Separator, Add Command List if (AreaPageTag5 <= 0) { throw new Exception("Area Page Command 5 Register, error code: " + Convert.ToString(AreaPageTag5)); } // Get Parent Tag for command list to add menu to ParentTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_System", "CL_Routines"); // Dictionary ID, Form Name, Command Name if (ParentTag <= 0) { throw new Exception("Parent GetTagByName, error code: " + Convert.ToString(ParentTag)); } // Get Below Tag for command/command list to add menu below BelowTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_Sales", "CL_Sales_Routines"); // Dictionary ID, Form Name, Command Name if (BelowTag <= 0) { throw new Exception("Below GetTagByName, error code: " + Convert.ToString(BelowTag)); } // Add Menu entry using API Function call to create parent for sub menu AreaPageListTag6 = MenusForVisualStudioTools.Functions.Register.Invoke( ParentTag, // Parent Command Tag "VS C\\# Area Page Test", // Menu Caption "", // Menu Tooltip 0, 0, // Menu Shortcut Key, Shortcut Modifier false, false, false, // Checked, Disabled, Hidden BelowTag, // Add Below Command Tag false, true); // Add Separator, Add Command List if (AreaPageListTag6 <= 0) { throw new Exception("Area Page Command List 6 Register, error code: " + Convert.ToString(AreaPageListTag6)); } // Add Menu entry using API Function call to create sub menu entry AreaPageTag6 = MenusForVisualStudioTools.Functions.Register.Invoke( AreaPageListTag6, // Parent Command Tag "VS C\\# Routines Test", // Menu Caption "", // Menu Tooltip 0, 0, // Menu Shortcut Key, Shortcut Modifier false, false, false, // Checked, Disabled, Hidden 0, // Add Below Command Tag false, false); // Add Separator, Add Command List if (AreaPageTag6 <= 0) { throw new Exception("Area Page Command 6 Register, error code: " + Convert.ToString(AreaPageTag6)); } // Get Parent Tag for command list to add menu to ParentTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_System", "CL_Utilities"); // Dictionary ID, Form Name, Command Name if (ParentTag <= 0) { throw new Exception("Parent GetTagByName, error code: " + Convert.ToString(ParentTag)); } // Get Below Tag for command/command list to add menu below BelowTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_Sales", "CL_Sales_Utilities"); // Dictionary ID, Form Name, Command Name if (BelowTag <= 0) { throw new Exception("Below GetTagByName, error code: " + Convert.ToString(BelowTag)); } // Add Menu entry using API Function call to create parent for sub menu AreaPageListTag7 = MenusForVisualStudioTools.Functions.Register.Invoke( ParentTag, // Parent Command Tag "VS C\\# Area Page Test", // Menu Caption "", // Menu Tooltip 0, 0, // Menu Shortcut Key, Shortcut Modifier false, false, false, // Checked, Disabled, Hidden BelowTag, // Add Below Command Tag false, true); // Add Separator, Add Command List if (AreaPageListTag7 <= 0) { throw new Exception("Area Page Command List 7 Register, error code: " + Convert.ToString(AreaPageListTag7)); } // Add Menu entry using API Function call to create sub menu entry AreaPageTag7 = MenusForVisualStudioTools.Functions.Register.Invoke( AreaPageListTag7, // Parent Command Tag "VS C\\# Utilities Test", // Menu Caption "", // Menu Tooltip 0, 0, // Menu Shortcut Key, Shortcut Modifier false, false, false, // Checked, Disabled, Hidden 0, // Add Below Command Tag false, false); // Add Separator, Add Command List if (AreaPageTag7 <= 0) { throw new Exception("Area Page Command 7 Register, error code: " + Convert.ToString(AreaPageTag7)); } } catch (Exception ex) { MessageBox.Show(ex.Message, APPNAME); // Unregister seventh menu entry if (AreaPageTag7 > 0) { Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( AreaPageListTag7, // Parent Command Tag AreaPageTag7); // Menu Tag if (Err < 0) { MessageBox.Show("Area Page Command 7 Unregister, error code: " + Convert.ToString(Err), APPNAME); } } ParentTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_System", "CL_Utilities"); // Dictionary ID, Form Name, Command Name if (ParentTag <= 0) { MessageBox.Show("Parent GetTagByName, error code: " + Convert.ToString(ParentTag)); } // Unregister Menu List entry if (AreaPageListTag7 > 0) { Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( ParentTag, // Parent Command Tag AreaPageListTag7); // Menu Tag if (Err < 0) { MessageBox.Show("Area Page Command List 7 Unregister, error code: " + Convert.ToString(Err), APPNAME); } } // Unregister sixth menu entry if (AreaPageTag6 > 0) { Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( AreaPageListTag6, // Parent Command Tag AreaPageTag6); // Menu Tag if (Err < 0) { MessageBox.Show("Area Page Command 6 Unregister, error code: " + Convert.ToString(Err), APPNAME); } } ParentTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_System", "CL_Routines"); // Dictionary ID, Form Name, Command Name if (ParentTag <= 0) { MessageBox.Show("Parent GetTagByName, error code: " + Convert.ToString(ParentTag)); } // Unregister Menu List entry if (AreaPageListTag6 > 0) { Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( ParentTag, // Parent Command Tag AreaPageListTag6); // Menu Tag if (Err < 0) { MessageBox.Show("Area Page Command List 6 Unregister, error code: " + Convert.ToString(Err), APPNAME); } } // Unregister fifth menu entry if (AreaPageTag5 > 0) { Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( AreaPageListTag5, // Parent Command Tag AreaPageTag5); // Menu Tag if (Err < 0) { MessageBox.Show("Area Page Command 5 Unregister, error code: " + Convert.ToString(Err), APPNAME); } } ParentTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_System", "CL_Setup"); // Dictionary ID, Form Name, Command Name if (ParentTag <= 0) { MessageBox.Show("Parent GetTagByName, error code: " + Convert.ToString(ParentTag)); } // Unregister Menu List entry if (AreaPageListTag5 > 0) { Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( ParentTag, // Parent Command Tag AreaPageListTag5); // Menu Tag if (Err < 0) { MessageBox.Show("Area Page Command List 5 Unregister, error code: " + Convert.ToString(Err), APPNAME); } } // Unregister fourth menu entry if (AreaPageTag4 > 0) { Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( AreaPageListTag4, // Parent Command Tag AreaPageTag4); // Menu Tag if (Err < 0) { MessageBox.Show("Area Page Command 4 Unregister, error code: " + Convert.ToString(Err), APPNAME); } } ParentTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_System", "CL_Cards"); // Dictionary ID, Form Name, Command Name if (ParentTag <= 0) { MessageBox.Show("Parent GetTagByName, error code: " + Convert.ToString(ParentTag)); } // Unregister Menu List entry if (AreaPageListTag4 > 0) { Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( ParentTag, // Parent Command Tag AreaPageListTag4); // Menu Tag if (Err < 0) { MessageBox.Show("Area Page Command List 4 Unregister, error code: " + Convert.ToString(Err), APPNAME); } } // Unregister third menu entry if (AreaPageTag3 > 0) { Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( AreaPageListTag3, // Parent Command Tag AreaPageTag3); // Menu Tag if (Err < 0) { MessageBox.Show("Area Page Command 3 Unregister, error code: " + Convert.ToString(Err), APPNAME); } } ParentTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_System", "CL_Reports"); // Dictionary ID, Form Name, Command Name if (ParentTag <= 0) { MessageBox.Show("Parent GetTagByName, error code: " + Convert.ToString(ParentTag)); } // Unregister Menu List entry if (AreaPageListTag3 > 0) { Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( ParentTag, // Parent Command Tag AreaPageListTag3); // Menu Tag if (Err < 0) { MessageBox.Show("Area Page Command List 3 Unregister, error code: " + Convert.ToString(Err), APPNAME); } } // Unregister second menu entry if (AreaPageTag2 > 0) { Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( AreaPageListTag2, // Parent Command Tag AreaPageTag2); // Menu Tag if (Err < 0) { MessageBox.Show("Area Page Command 2 Unregister, error code: " + Convert.ToString(Err), APPNAME); } } ParentTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_System", "CL_Inquiry"); // Dictionary ID, Form Name, Command Name if (ParentTag <= 0) { MessageBox.Show("Parent GetTagByName, error code: " + Convert.ToString(ParentTag)); } // Unregister Menu List entry if (AreaPageListTag2 > 0) { Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( ParentTag, // Parent Command Tag AreaPageListTag2); // Menu Tag if (Err < 0) { MessageBox.Show("Area Page Command List 2 Unregister, error code: " + Convert.ToString(Err), APPNAME); } } // Unregister first menu entry if (AreaPageTag1 > 0) { Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( AreaPageListTag1, // Parent Command Tag AreaPageTag1); // Menu Tag if (Err < 0) { MessageBox.Show("Area Page Command 1 Unregister, error code: " + Convert.ToString(Err), APPNAME); } } ParentTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_System", "CL_Transactions"); // Dictionary ID, Form Name, Command Name if (ParentTag <= 0) { MessageBox.Show("Parent GetTagByName, error code: " + Convert.ToString(ParentTag)); } // Unregister Menu List entry if (AreaPageListTag1 > 0) { Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( ParentTag, // Parent Command Tag AreaPageListTag1); // Menu Tag if (Err < 0) { MessageBox.Show("Area Page Command List 1 Unregister, error code: " + Convert.ToString(Err), APPNAME); } } } } // Script to handle menu entry callbacks void VSTMEventHandler(object sender, EventHandlerFunction.InvokeEventArgs e) { short Checked = 0; short Tag = 0; string Caption = ""; // Get Callback Tag Number for menu entry Tag = e.inParam1; // Compare Tag Sequence Number with Menu Sequence obtained during registration if (Tag == MenuTag1) { // Display Menu Caption MenusForVisualStudioTools.Functions.GetCaption.Invoke(MenuTag1, out Caption); //MessageBox.Show(Caption, APPNAME); MenusForVisualStudioTools.Forms.VstmHelper.Functions.Warning.Invoke(Caption); // Toggle Menu Check mark on first menu entry Checked = MenusForVisualStudioTools.Functions.Checked.Invoke(MenuTag1); if (Checked >= 0) { MenusForVisualStudioTools.Functions.Check.Invoke(MenuTag1, !(Checked == 1)); } // Enable second menu entry and show third menu entry MenusForVisualStudioTools.Functions.Disable.Invoke(MenuTag2, false); MenusForVisualStudioTools.Functions.Hide.Invoke(MenuTag3, false); } else if (Tag == MenuTag2) { // Display Menu Caption MenusForVisualStudioTools.Functions.GetCaption.Invoke(MenuTag2, out Caption); //MessageBox.Show(Caption, APPNAME); MenusForVisualStudioTools.Forms.VstmHelper.Functions.Warning.Invoke(Caption); // Disable second menu entry MenusForVisualStudioTools.Functions.Disable.Invoke(MenuTag2, true); } else if (Tag == MenuTag3) { // Display Menu Caption MenusForVisualStudioTools.Functions.GetCaption.Invoke(MenuTag3, out Caption); //MessageBox.Show(Caption, APPNAME); MenusForVisualStudioTools.Forms.VstmHelper.Functions.Warning.Invoke(Caption); // Hide third menu entry MenusForVisualStudioTools.Functions.Hide.Invoke(MenuTag3, true); } else if (Tag == MenuTag4) { // Display Menu Caption MenusForVisualStudioTools.Functions.GetCaption.Invoke(MenuTag4, out Caption); //MessageBox.Show(Caption, APPNAME); MenusForVisualStudioTools.Forms.VstmHelper.Functions.Warning.Invoke(Caption); } else { // Not one of this application's menu entries } // Compare Tag Sequence Number with Menu Sequence obtained during registration if (Tag == AreaPageTag1) { // Display Menu Caption MenusForVisualStudioTools.Functions.GetCaption.Invoke(AreaPageTag1, out Caption); //MessageBox.Show(Caption, APPNAME); MenusForVisualStudioTools.Forms.VstmHelper.Functions.Warning.Invoke(Caption); } else if (Tag == AreaPageTag2) { // Display Menu Caption MenusForVisualStudioTools.Functions.GetCaption.Invoke(AreaPageTag2, out Caption); //MessageBox.Show(Caption, APPNAME); MenusForVisualStudioTools.Forms.VstmForms.Functions.FormOpen.Invoke("WDC", "TEST LINES", 2); } else if (Tag == AreaPageTag3) { // Display Menu Caption MenusForVisualStudioTools.Functions.GetCaption.Invoke(AreaPageTag3, out Caption); //MessageBox.Show(Caption, APPNAME); MenusForVisualStudioTools.Forms.VstmForms.Functions.FormOpen.Invoke("WDC", "TEST BLANK", 0); } else if (Tag == AreaPageTag4) { // Display Menu Caption MenusForVisualStudioTools.Functions.GetCaption.Invoke(AreaPageTag4, out Caption); //MessageBox.Show(Caption, APPNAME); MenusForVisualStudioTools.Forms.VstmForms.Functions.FormOpen.Invoke("WDC", "TEST LINES", 0); } else if (Tag == AreaPageTag5) { // Display Menu Caption MenusForVisualStudioTools.Functions.GetCaption.Invoke(AreaPageTag5, out Caption); //MessageBox.Show(Caption, APPNAME); MenusForVisualStudioTools.Forms.VstmForms.Functions.FormOpen.Invoke("WDC", "TEST SETUP", 0); } else if (Tag == AreaPageTag6) { // Display Menu Caption MenusForVisualStudioTools.Functions.GetCaption.Invoke(AreaPageTag6, out Caption); //MessageBox.Show(Caption, APPNAME); MenusForVisualStudioTools.Forms.VstmHelper.Functions.Warning.Invoke(Caption); } else if (Tag == AreaPageTag7) { // Display Menu Caption MenusForVisualStudioTools.Functions.GetCaption.Invoke(AreaPageTag7, out Caption); //MessageBox.Show(Caption, APPNAME); MenusForVisualStudioTools.Forms.VstmHelper.Functions.Warning.Invoke(Caption); } else { // Not one of this application's menu entries } } // Script to Register Area Page entries void VSTMEventRegisterAreaPage(object sender, EventRegisterAreaPageFunction.InvokeEventArgs e) { AreaPageTag = MenusForVisualStudioTools.Functions.RegisterAreaPage.Invoke("VS C\\# Area Page Test", // Name ""); // Tooltip if (AreaPageTag <= 0) { throw new Exception("Area Page Command Register, error code: " + Convert.ToString(AreaPageTag)); } } // Script to handle Area Page callbacks void VSTMEventHandlerAreaPage(object sender, EventHandlerAreaPageFunction.InvokeEventArgs e) { short Tag = 0; short Err = 0; // Get Callback Tag Number for Area Page Tag = e.inParam1; // Compare Tag Sequence Number with Menu Sequence obtained during registration if (Tag == AreaPageTag) { Err = MenusForVisualStudioTools.Functions.RegisterAreaPageContent.Invoke(Tag, "VS C\\# Area Page Test", // Tag, Name AreaPageListTag1, 0, // Transaction Tag, Column AreaPageListTag2, 0, // Inquiry Tag, Column AreaPageListTag3, 0, // Reports Tag, Column AreaPageListTag4, 0, // Cards Tag, Column AreaPageListTag5, 0, // Setup Tag, Column AreaPageListTag6, 0, // Routines Tag, Column AreaPageListTag7, 0); // Utilities Tag, Column if (Err < 0) { MessageBox.Show("Area Page Command Display Content, error code: " + Convert.ToString(Err), APPNAME); } } else { // Not one of this application's menu entries } } // Script to Register Custom Forms void VSTMEventRegisterForm(object sender, EventRegisterFormFunction.InvokeEventArgs e) { short FormNumber = 0; short Err = 0; // Register Developer Err = MenusForVisualStudioTools.Forms.VstmForms.Functions.DeveloperRegister.Invoke("WDC", "Winthrop Development Consultants"); if (Err < 0) { MessageBox.Show("Custom Forms Register Developer, error code: " + Convert.ToString(Err), APPNAME); } // Register Forms Err = MenusForVisualStudioTools.Forms.VstmForms.Functions.FormRegister.Invoke("WDC", "TEST BLANK", // Developer ID, Form ID "Test of Blank Form", // Form Description 1 /* CF_TYPE_BLANK */, // Form Type "Test Blank Form", // Form Name out FormNumber); // Form Number Returned if (Err < 0) { MessageBox.Show("Custom Forms Register Blank Form, error code: " + Convert.ToString(Err), APPNAME); } Err = MenusForVisualStudioTools.Forms.VstmForms.Functions.FormRegister.Invoke("WDC", "TEST SETUP", // Developer ID, Form ID "Test of Setup Form", // Form Description 3 /* CF_TYPE_SETUP */, // Form Type "Test Setup Form", // Form Name out FormNumber); // Form Number Returned if (Err < 0) { MessageBox.Show("Custom Forms Register Setup Form, error code: " + Convert.ToString(Err), APPNAME); } Err = MenusForVisualStudioTools.Forms.VstmForms.Functions.FormRegisterMaint.Invoke("WDC", "TEST LINES", // Developer ID, Form ID "Test of Maint Form", // Form Description 5 /* CF_TYPE_MAINT_LINES */, // Form Type "Test Maint Form", // Maint Form Name "Test Lookup Form", // Lookup Form Name "Test Inquiry Form", // Inquiry Form Name "Test ID", // ID Field Name "Test Name", // Description Field Name "Test Report", // Report Name out FormNumber); // Form Number Returned if (Err < 0) { MessageBox.Show("Custom Forms Register Maint Form, error code: " + Convert.ToString(Err), APPNAME); } } // Script to handle Custom Form callbacks void VSTMEventHandlerForm(object sender, EventHandlerFormFunction.InvokeEventArgs e) { string IN_DeveloperID = e.inParam1; string IN_FormID = e.inParam2; short IN_SubForm = e.inParam3; short IN_Mode = e.inParam4; string IN_FieldID = e.inParam5; short IN_Event = e.inParam6; string tableID = string.Empty; int tableSequence = 0; string reportNumber = string.Empty; short reportType = 0; short reportControl = 0; decimal reportSequenceOne = 0.0m; decimal reportSequenceTwo = 0.0m; string reportString = string.Empty; decimal reportCurrency = 0.0m; if (IN_DeveloperID == "WDC") { switch (IN_FormID) { case "TEST BLANK": switch (IN_Mode) { case 1: // Form // code block break; case 2: // Window // code block break; case 4: // Field // code block break; default: break; } break; case "TEST SETUP": switch (IN_Mode) { case 1: // Form // code block break; case 2: // Window switch (IN_Event) { case 0: // TRIGGER_FOCUS_PRE // code block - Read Setup Table Data break; case 2: // TRIGGER_FOCUS_POST // code block - Option to Abort Close //MenusForVisualStudioTools.Forms.VstmForms.Functions.FormAbortClose.Invoke(); break; case 3: // TRIGGER_FOCUS_PRINT // code block break; case 4: // TRIGGER_FOCUS_ACTIVATE // code block break; default: break; } break; case 4: // Field switch (IN_FieldID) { case "OK": switch (IN_Event) { case 0: // TRIGGER_FOCUS_PRE // code block break; case 1: // TRIGGER_FOCUS_CHANGE // code block - Option to Reject Script //MenusForVisualStudioTools.Forms.VstmForms.Functions.FormRejectScript.Invoke(); break; case 2: //TRIGGER_FOCUS_POST // code block break; default: break; } break; case "Cancel": switch (IN_Event) { case 0: // TRIGGER_FOCUS_PRE // code block break; case 1: // TRIGGER_FOCUS_CHANGE // code block - Option to Reject Script //MenusForVisualStudioTools.Forms.VstmForms.Functions.FormRejectScript.Invoke(); break; case 2: //TRIGGER_FOCUS_POST // code block break; default: break; } break; default: break; } break; case 6: // Table switch (IN_Event) { case 4: case 8:// TRIGGER_ON_DB_ADD, TRIGGER_ON_DB_UPDATE // code block - Save Setup Table Data break; default: break; } break; default: break; } break; case "TEST LINES": switch (IN_SubForm) { case 0: // Maint Form switch (IN_Mode) { case 1: // Form switch (IN_Event) { case 0: // TRIGGER_FOCUS_PRE // code block - Set Navigation Defaults break; case 2: // TRIGGER_FOCUS_POST // code block break; default: break; } break; case 2: // Window switch (IN_Event) { case 0: // TRIGGER_FOCUS_PRE // code block - Set Table Record Defaults break; case 2: // TRIGGER_FOCUS_POST // code block - Option to Abort Close //MenusForVisualStudioTools.Forms.VstmForms.Functions.FormAbortClose.Invoke(); break; case 3: // TRIGGER_FOCUS_PRINT // code block break; case 4: // TRIGGER_FOCUS_ACTIVATE // code block break; default: break; } break; case 3: // Scrolling Window switch (IN_Event) { case 0: // TRIGGER_FOCUS_PRE // code block break; case 1: // TRIGGER_FOCUS_CHANGE // code block - Option to Reject Script //MenusForVisualStudioTools.Forms.VstmForms.Functions.FormRejectScript.Invoke(); break; case 2: // TRIGGER_FOCUS_POST // code block break; case 5: // TRIGGER_FOCUS_FILL // code block - Display Extra Line Table Data, Option to Reject Record //MenusForVisualStudioTools.Forms.VstmForms.Functions.FormRejectRecord.Invoke(); break; case 6: // TRIGGER_FOCUS_INSERT // code block break; case 7: // TRIGGER_FOCUS_DELETE // code block - Option to Reject Script //MenusForVisualStudioTools.Forms.VstmForms.Functions.FormRejectScript.Invoke(); break; default: break; } break; case 4: // Field switch (IN_FieldID) { case "Display Existing Record": switch (IN_Event) { case 1: // TRIGGER_FOCUS_CHANGE // code block - Read Extra Header Table Data break; default: break; } break; default: break; } break; case 5: // Scrolling Window Field // code block break; case 6: // Table tableID = IN_FieldID; switch (IN_Event) { case 4: case 8:// TRIGGER_ON_DB_ADD, TRIGGER_ON_DB_UPDATE // code block - Add Extra Header Table Data break; case 16: // TRIGGER_ON_DB_DELETE // code block - Delete Extra Header Table Data break; default: break; } break; case 7: // Scrolling Window Table MenusForVisualStudioTools.Forms.VstmForms.Functions.KeySplitLine.Invoke(IN_FieldID, out tableID, out tableSequence); switch (IN_Event) { case 4: case 8:// TRIGGER_ON_DB_ADD, TRIGGER_ON_DB_UPDATE // code block - Save Extra Line Table Data break; case 16: // TRIGGER_ON_DB_DELETE // code block - Delete Extra Line Table Data break; default: break; } break; case 8: // Report Writer Functions switch (IN_Event) { case 1: // rw_ReportStart reportString = string.Empty; // code block MenusForVisualStudioTools.Forms.VstmForms.Functions.ReportSetString.Invoke(reportString); break; case 2: // rw_ReportEnd reportString = string.Empty; // code block MenusForVisualStudioTools.Forms.VstmForms.Functions.ReportSetString.Invoke(reportString); break; case 3: // rw_TableHeaderString MenusForVisualStudioTools.Forms.VstmForms.Functions.ReportGetTableHeader.Invoke(out reportNumber, out reportType, out reportControl); reportString = string.Empty; // code block MenusForVisualStudioTools.Forms.VstmForms.Functions.ReportSetString.Invoke(reportString); break; case 4: // rw_TableHeaderCurrency MenusForVisualStudioTools.Forms.VstmForms.Functions.ReportGetTableHeader.Invoke(out reportNumber, out reportType, out reportControl); reportCurrency = 0.0m; // code block MenusForVisualStudioTools.Forms.VstmForms.Functions.ReportSetCurrency.Invoke(reportCurrency); break; case 5: // rw_TableLineString MenusForVisualStudioTools.Forms.VstmForms.Functions.ReportGetTableLine.Invoke(out reportNumber, out reportType, out reportSequenceOne, out reportSequenceTwo, out reportControl); reportString = string.Empty; // code block MenusForVisualStudioTools.Forms.VstmForms.Functions.ReportSetString.Invoke(reportString); break; case 6: // rw_TableLineCurrency MenusForVisualStudioTools.Forms.VstmForms.Functions.ReportGetTableLine.Invoke(out reportNumber, out reportType, out reportSequenceOne, out reportSequenceTwo, out reportControl); reportCurrency = 0.0m; // code block MenusForVisualStudioTools.Forms.VstmForms.Functions.ReportSetCurrency.Invoke(reportCurrency); break; default: break; } break; default: break; } break; case 1: // Lookup Form switch (IN_Mode) { case 1: // Form // code block break; case 2: // Window // code block break; case 3: // Scrolling Window // code block break; case 4: // Field // code block break; case 5: // Scrolling Window Field // code block break; case 6: // Table // code block break; case 7: // Scrolling Window Table // code block break; default: break; } break; case 2: // Inquiry Form switch (IN_Mode) { case 1: // Form // code block break; case 2: // Window // code block break; case 3: // Scrolling Window switch (IN_Event) { case 5: // TRIGGER_FOCUS_FILL // code block - Display Extra Line Table Data, Option to Reject Record //MenusForVisualStudioTools.Forms.VstmForms.Functions.FormRejectRecord.Invoke(); break; default: break; } break; case 4: // Field switch (IN_FieldID) { case "Display Existing Record": switch (IN_Event) { case 1: // TRIGGER_FOCUS_CHANGE // code block - Read Extra Header Table Data break; default: break; } break; default: break; } break; case 5: // Scrolling Window Field // code block break; case 6: // Table // code block break; case 7: // Scrolling Window Table // code block break; default: break; } break; default: break; } break; default: break; } } } } } Example VB Code after adding Reference to Application.MenusForVisualStudioTools.dll =================================================================================== ' Visual Studio Integration Toolkit for Microsoft Dynamics GP ' ' Developed by David Musgrave of Winthrop Development Consultants ' ' VB Demonstration example code ' ' For Build 18 or Later, Last Modified 14-Jul-2023. ' Imports System Imports System.Windows.Forms Imports Microsoft.Dexterity.Bridge Imports Microsoft.Dexterity.Applications Imports Microsoft.Dexterity.Applications.MenusForVisualStudioToolsDictionary Public Class GPAddIn Implements IDexterityAddIn ' Application Name Const APPNAME As String = "VSTMenusVB" ' Dictionary ID Constants Const DYNAMICS As Short = 0 ' Shortcut Key Modifier Constants Const COMMAND_SHORTCUT_CTRL As Integer = 65536 Const COMMAND_SHORTCUT_CTRLSHIFT As Integer = 327680 Const COMMAND_SHORTCUT_CTRLALT As Integer = 196608 Const COMMAND_SHORTCUT_ALT As Integer = 131072 Const COMMAND_SHORTCUT_ALTSHIFT As Integer = 393216 Const COMMAND_SHORTCUT_CTRLALTSHIFT As Integer = 458752 ' Shortcut Key Function Key Constants, can be used instead of ASCII value Const COMMAND_SHORTCUT_KEY_F1 As Short = 112 Const COMMAND_SHORTCUT_KEY_F2 As Short = 113 Const COMMAND_SHORTCUT_KEY_F3 As Short = 114 Const COMMAND_SHORTCUT_KEY_F4 As Short = 115 Const COMMAND_SHORTCUT_KEY_F5 As Short = 116 Const COMMAND_SHORTCUT_KEY_F6 As Short = 117 Const COMMAND_SHORTCUT_KEY_F7 As Short = 118 Const COMMAND_SHORTCUT_KEY_F8 As Short = 119 Const COMMAND_SHORTCUT_KEY_F9 As Short = 120 Const COMMAND_SHORTCUT_KEY_F10 As Short = 121 Const COMMAND_SHORTCUT_KEY_F11 As Short = 122 Const COMMAND_SHORTCUT_KEY_F12 As Short = 123 ' Menu Example Variables Dim MenuListTag1 As Short Dim MenuTag1 As Short Dim MenuTag2 As Short Dim MenuTag3 As Short Dim MenuTag4 As Short 'Area Page Example Variables Dim AreaPageTag As Short Dim AreaPageTag1 As Short Dim AreaPageTag2 As Short Dim AreaPageTag3 As Short Dim AreaPageTag4 As Short Dim AreaPageTag5 As Short Dim AreaPageTag6 As Short Dim AreaPageTag7 As Short Dim AreaPageListTag1 As Short Dim AreaPageListTag2 As Short Dim AreaPageListTag3 As Short Dim AreaPageListTag4 As Short Dim AreaPageListTag5 As Short Dim AreaPageListTag6 As Short Dim AreaPageListTag7 As Short ' IDexterityAddIn interface Sub Initialize() Implements IDexterityAddIn.Initialize ' Register Event to add menu entries AddHandler MenusForVisualStudioTools.Functions.EventRegister.InvokeAfterOriginal, AddressOf VSTMEventRegister ' Register Event to handle callbacks from menu entries AddHandler MenusForVisualStudioTools.Functions.EventHandler.InvokeAfterOriginal, AddressOf VSTMEventHandler ' Register Event to add Area Page Button AddHandler MenusForVisualStudioTools.Functions.EventRegisterAreaPage.InvokeAfterOriginal, AddressOf VSTMEventRegisterAreaPage ' Register Event to add Area Page Content AddHandler MenusForVisualStudioTools.Functions.EventHandlerAreaPage.InvokeAfterOriginal, AddressOf VSTMEventHandlerAreaPage ' Register Event to Register Custom Forms AddHandler MenusForVisualStudioTools.Functions.EventRegisterForm.InvokeAfterOriginal, AddressOf VSTMEventRegisterForm ' Register Event to handle Custom Forms Events AddHandler MenusForVisualStudioTools.Functions.EventHandlerForm.InvokeAfterOriginal, AddressOf VSTMEventHandlerForm End Sub ' Script to Register menu entries Private Sub VSTMEventRegister(ByVal sender As Object, ByVal e As EventRegisterFunction.InvokeEventArgs) Dim ParentTag As Short = 0 Dim BelowTag As Short = 0 Dim ResID As Short = 0 Dim Err As Short = 0 ' Menu Example Try ' Get Parent Tag for command list to add menu to ParentTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_Purchasing", "CL_Purchasing_Cards") If ParentTag <= 0 Then Throw New Exception("Parent GetTagByName, error code: " & Str(ParentTag)) End If ' Get Below Tag for command/command list to add menu below BelowTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_Purchasing", "PM_Vendor_Maintenance") If BelowTag <= 0 Then Throw New Exception("Below GetTagByName, error code: " & Str(BelowTag)) End If ' Get Security Form Resource ID for menus to inherit security access from ResID = MenusForVisualStudioTools.Functions.GetFormResId.Invoke( DYNAMICS, "PM_Vendor_Maintenance") If ResID <= 0 Then Throw New Exception("GetFormResId, error code: " & Str(ResID)) End If ' Add Menu entry using API Function call to create parent for sub menu MenuListTag1 = MenusForVisualStudioTools.Functions.Register.Invoke( ParentTag, "VS VB Test", "", 0, 0, False, False, False, BelowTag, False, True) If MenuListTag1 <= 0 Then Throw New Exception("Command List Register, error code: " & Str(MenuListTag1)) End If ' Add Menu entry using API Function call to create first sub menu entry with security MenuTag1 = MenusForVisualStudioTools.Functions.RegisterWithSecurity.Invoke( MenuListTag1, "VS VB Test 1", "Click for VS VB Test 1", Asc("A"), COMMAND_SHORTCUT_CTRLSHIFT, True, False, False, 0, False, False, DYNAMICS, ResID) If MenuTag1 <= 0 Then Throw New Exception("Command 1 RegisterWithSecurity, error code: " & Str(MenuTag1)) End If ' Add Menu entry using API Function call to create second sub menu entry without security MenuTag2 = MenusForVisualStudioTools.Functions.Register.Invoke( MenuListTag1, "VS VB Test 2", "Click for VS VB Test 2", Asc("B"), COMMAND_SHORTCUT_CTRLSHIFT, False, False, False, 0, False, False) If MenuTag2 <= 0 Then Throw New Exception("Command 2 Register, error code: " & Str(MenuTag2)) Else ' And then add security as a separate step Err = MenusForVisualStudioTools.Functions.ApplySecurity.Invoke( MenuTag2, DYNAMICS, ResID) If Err < 0 Then Throw New Exception("Command 2 ApplySecurity, error code: " & Str(Err)) End If End If ' Add Menu entry using API Function call to create a third menu entry MenuTag3 = MenusForVisualStudioTools.Functions.Register.Invoke( ParentTag, "VS VB Test 3", "Click for VS VB Test 3", Asc("C"), COMMAND_SHORTCUT_CTRLSHIFT, False, False, False, 0, True, False) If MenuTag3 <= 0 Then Throw New Exception("Command 3 Register, error code: " & Str(MenuTag3)) End If ' Add Menu entry using API Function call to create a fourth menu entry MenuTag4 = MenusForVisualStudioTools.Functions.RegisterSimple.Invoke( "CL_Purchasing_Cards", "VS VB Test 4") If MenuTag4 <= 0 Then Throw New Exception("Command 4 Register, error code: " & Str(MenuTag4)) End If ' Change Tooltip on Vendor Maintenance Menu Item, need to toggle Protected Mode MenusForVisualStudioTools.Functions.SetProtectedMode.Invoke(False) Err = MenusForVisualStudioTools.Functions.SetTooltip.Invoke( BelowTag, "VS VB Test Tooltip") MenusForVisualStudioTools.Functions.SetProtectedMode.Invoke(True) If Err < 0 Then Throw New Exception("SetTooltip, error code: " & Str(Err)) End If Catch ex As Exception MessageBox.Show(ex.Message, APPNAME) ' Unregister fourth menu entry If MenuTag4 > 0 Then Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( ParentTag, MenuTag4) If Err < 0 Then MessageBox.Show("Command 4 Unregister, error code: " & Str(Err), APPNAME) End If End If ' Unregister third menu entry If MenuTag3 > 0 Then Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( ParentTag, MenuTag3) If Err < 0 Then MessageBox.Show("Command 3 Unregister, error code: " & Str(Err), APPNAME) End If End If ' Unregister second menu entry If MenuTag2 > 0 Then Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( MenuListTag1, MenuTag2) If Err < 0 Then MessageBox.Show("Command 2 Unregister, error code: " & Str(Err), APPNAME) End If End If ' Unregister first menu entry If MenuTag1 > 0 Then Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( MenuListTag1, MenuTag1) If Err < 0 Then MessageBox.Show("Command 1 Unregister, error code: " & Str(Err), APPNAME) End If End If ' Unregister Menu List entry If MenuListTag1 > 0 Then Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( ParentTag, MenuListTag1) If Err < 0 Then MessageBox.Show("Command List Unregister, error code: " & Str(Err), APPNAME) End If End If End Try ' Area Page Example Try ' Get Parent Tag for command list to add menu to ParentTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_System", "CL_Transactions") If ParentTag <= 0 Then Throw New Exception("Parent GetTagByName, error code: " & Str(ParentTag)) End If ' Get Below Tag for command/command list to add menu below BelowTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_Purchasing", "CL_Purchasing_Transactions") If BelowTag <= 0 Then Throw New Exception("Below GetTagByName, error code: " & Str(BelowTag)) End If ' Add Menu entry using API Function call to create parent for sub menu AreaPageListTag1 = MenusForVisualStudioTools.Functions.Register.Invoke( ParentTag, "VS VB Area Page Test", "", 0, 0, False, False, False, BelowTag, False, True) If AreaPageListTag1 <= 0 Then Throw New Exception("Area Page Command List 1 Register, error code: " & Str(AreaPageListTag1)) End If ' Add Menu entry using API Function call to create sub menu entry AreaPageTag1 = MenusForVisualStudioTools.Functions.Register.Invoke( AreaPageListTag1, "VS VB Transactions Test", "", 0, 0, False, False, False, 0, False, False) If AreaPageTag1 <= 0 Then Throw New Exception("Area Page Command 1 Register, error code: " & Str(AreaPageTag1)) End If ' Get Parent Tag for command list to add menu to ParentTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_System", "CL_Inquiry") If ParentTag <= 0 Then Throw New Exception("Parent GetTagByName, error code: " & Str(ParentTag)) End If ' Get Below Tag for command/command list to add menu below BelowTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_Purchasing", "CL_Purchasing_Inquiry") If BelowTag <= 0 Then Throw New Exception("Below GetTagByName, error code: " & Str(BelowTag)) End If ' Add Menu entry using API Function call to create parent for sub menu AreaPageListTag2 = MenusForVisualStudioTools.Functions.Register.Invoke( ParentTag, "VS VB Area Page Test", "", 0, 0, False, False, False, BelowTag, False, True) If AreaPageListTag2 <= 0 Then Throw New Exception("Area Page Command List 2 Register, error code: " & Str(AreaPageListTag2)) End If ' Add Menu entry using API Function call to create sub menu entry AreaPageTag2 = MenusForVisualStudioTools.Functions.Register.Invoke( AreaPageListTag2, "VS VB Inquiry Test", "", 0, 0, False, False, False, 0, False, False) If AreaPageTag2 <= 0 Then Throw New Exception("Area Page Command 2 Register, error code: " & Str(AreaPageTag2)) End If ' Get Parent Tag for command list to add menu to ParentTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_System", "CL_Reports") If ParentTag <= 0 Then Throw New Exception("Parent GetTagByName, error code: " & Str(ParentTag)) End If ' Get Below Tag for command/command list to add menu below BelowTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_Purchasing", "CL_Purchasing_Reports") If BelowTag <= 0 Then Throw New Exception("Below GetTagByName, error code: " & Str(BelowTag)) End If ' Add Menu entry using API Function call to create parent for sub menu AreaPageListTag3 = MenusForVisualStudioTools.Functions.Register.Invoke( ParentTag, "VS VB Area Page Test", "", 0, 0, False, False, False, BelowTag, False, True) If AreaPageListTag3 <= 0 Then Throw New Exception("Area Page Command List 3 Register, error code: " & Str(AreaPageListTag3)) End If ' Add Menu entry using API Function call to create sub menu entry AreaPageTag3 = MenusForVisualStudioTools.Functions.Register.Invoke( AreaPageListTag3, "VS VB Reports Test", "", 0, 0, False, False, False, 0, False, False) If AreaPageTag3 <= 0 Then Throw New Exception("Area Page Command 3 Register, error code: " & Str(AreaPageTag3)) End If ' Get Parent Tag for command list to add menu to ParentTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_System", "CL_Cards") If ParentTag <= 0 Then Throw New Exception("Parent GetTagByName, error code: " & Str(ParentTag)) End If ' Get Below Tag for command/command list to add menu below BelowTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_Purchasing", "CL_Purchasing_Cards") If BelowTag <= 0 Then Throw New Exception("Below GetTagByName, error code: " & Str(BelowTag)) End If ' Add Menu entry using API Function call to create parent for sub menu AreaPageListTag4 = MenusForVisualStudioTools.Functions.Register.Invoke( ParentTag, "VS VB Area Page Test", "", 0, 0, False, False, False, BelowTag, False, True) If AreaPageListTag4 <= 0 Then Throw New Exception("Area Page Command List 4 Register, error code: " & Str(AreaPageListTag4)) End If ' Add Menu entry using API Function call to create sub menu entry AreaPageTag4 = MenusForVisualStudioTools.Functions.Register.Invoke( AreaPageListTag4, "VS VB Cards Test", "", 0, 0, False, False, False, 0, False, False) If AreaPageTag4 <= 0 Then Throw New Exception("Area Page Command 4 Register, error code: " & Str(AreaPageTag4)) End If ' Get Parent Tag for command list to add menu to ParentTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_System", "CL_Setup") If ParentTag <= 0 Then Throw New Exception("Parent GetTagByName, error code: " & Str(ParentTag)) End If ' Get Below Tag for command/command list to add menu below BelowTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_Purchasing", "CL_Purchasing_Setup") If BelowTag <= 0 Then Throw New Exception("Below GetTagByName, error code: " & Str(BelowTag)) End If ' Add Menu entry using API Function call to create parent for sub menu AreaPageListTag5 = MenusForVisualStudioTools.Functions.Register.Invoke( ParentTag, "VS VB Area Page Test", "", 0, 0, False, False, False, BelowTag, False, True) If AreaPageListTag5 <= 0 Then Throw New Exception("Area Page Command List 5 Register, error code: " & Str(AreaPageListTag5)) End If ' Add Menu entry using API Function call to create sub menu entry AreaPageTag5 = MenusForVisualStudioTools.Functions.Register.Invoke( AreaPageListTag5, "VS VB Setup Test", "", 0, 0, False, False, False, 0, False, False) If AreaPageTag5 <= 0 Then Throw New Exception("Area Page Command 5 Register, error code: " & Str(AreaPageTag5)) End If ' Get Parent Tag for command list to add menu to ParentTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_System", "CL_Routines") If ParentTag <= 0 Then Throw New Exception("Parent GetTagByName, error code: " & Str(ParentTag)) End If ' Get Below Tag for command/command list to add menu below BelowTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_Purchasing", "CL_Purchasing_Routines") If BelowTag <= 0 Then Throw New Exception("Below GetTagByName, error code: " & Str(BelowTag)) End If ' Add Menu entry using API Function call to create parent for sub menu AreaPageListTag6 = MenusForVisualStudioTools.Functions.Register.Invoke( ParentTag, "VS VB Area Page Test", "", 0, 0, False, False, False, BelowTag, False, True) If AreaPageListTag6 <= 0 Then Throw New Exception("Area Page Command List 6 Register, error code: " & Str(AreaPageListTag6)) End If ' Add Menu entry using API Function call to create sub menu entry AreaPageTag6 = MenusForVisualStudioTools.Functions.Register.Invoke( AreaPageListTag6, "VS VB Routines Test", "", 0, 0, False, False, False, 0, False, False) If AreaPageTag6 <= 0 Then Throw New Exception("Area Page Command 6 Register, error code: " & Str(AreaPageTag6)) End If ' Get Parent Tag for command list to add menu to ParentTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_System", "CL_Utilities") If ParentTag <= 0 Then Throw New Exception("Parent GetTagByName, error code: " & Str(ParentTag)) End If ' Get Below Tag for command/command list to add menu below BelowTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_Purchasing", "CL_Purchasing_Utilities") If BelowTag <= 0 Then Throw New Exception("Below GetTagByName, error code: " & Str(BelowTag)) End If ' Add Menu entry using API Function call to create parent for sub menu AreaPageListTag7 = MenusForVisualStudioTools.Functions.Register.Invoke( ParentTag, "VS VB Area Page Test", "", 0, 0, False, False, False, BelowTag, False, True) If AreaPageListTag7 <= 0 Then Throw New Exception("Area Page Command List 7 Register, error code: " & Str(AreaPageListTag7)) End If ' Add Menu entry using API Function call to create sub menu entry AreaPageTag7 = MenusForVisualStudioTools.Functions.Register.Invoke( AreaPageListTag7, "VS VB Utilities Test", "", 0, 0, False, False, False, 0, False, False) If AreaPageTag7 <= 0 Then Throw New Exception("Area Page Command 7 Register, error code: " & Str(AreaPageTag7)) End If Catch ex As Exception MessageBox.Show(ex.Message, APPNAME) ' Unregister seventh menu entry If AreaPageTag7 > 0 Then Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( AreaPageListTag7, AreaPageTag7) If Err < 0 Then MessageBox.Show("Area Page Command 7 Unregister, error code: " & Str(Err), APPNAME) End If End If ParentTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_System", "CL_Utilities") If ParentTag <= 0 Then MessageBox.Show("Parent GetTagByName, error code: " & Str(ParentTag)) End If ' Unregister Menu List entry If AreaPageListTag7 > 0 Then Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( ParentTag, AreaPageListTag7) If Err < 0 Then MessageBox.Show("Area Page Command List 7 Unregister, error code: " & Str(Err), APPNAME) End If End If ' Unregister sixth menu entry If AreaPageTag6 > 0 Then Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( AreaPageListTag6, AreaPageTag6) If Err < 0 Then MessageBox.Show("Area Page Command 6 Unregister, error code: " & Str(Err), APPNAME) End If End If ParentTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_System", "CL_Routines") If ParentTag <= 0 Then MessageBox.Show("Parent GetTagByName, error code: " & Str(ParentTag)) End If ' Unregister Menu List entry If AreaPageListTag6 > 0 Then Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( ParentTag, AreaPageListTag6) If Err < 0 Then MessageBox.Show("Area Page Command List 6 Unregister, error code: " & Str(Err), APPNAME) End If End If ' Unregister fifth menu entry If AreaPageTag5 > 0 Then Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( AreaPageListTag5, AreaPageTag5) If Err < 0 Then MessageBox.Show("Area Page Command 5 Unregister, error code: " & Str(Err), APPNAME) End If End If ParentTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_System", "CL_Setup") If ParentTag <= 0 Then MessageBox.Show("Parent GetTagByName, error code: " & Str(ParentTag)) End If ' Unregister Menu List entry If AreaPageListTag5 > 0 Then Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( ParentTag, AreaPageListTag5) If Err < 0 Then MessageBox.Show("Area Page Command List 5 Unregister, error code: " & Str(Err), APPNAME) End If End If ' Unregister fourth menu entry If AreaPageTag4 > 0 Then Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( AreaPageListTag4, AreaPageTag4) If Err < 0 Then MessageBox.Show("Area Page Command 4 Unregister, error code: " & Str(Err), APPNAME) End If End If ParentTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_System", "CL_Cards") If ParentTag <= 0 Then MessageBox.Show("Parent GetTagByName, error code: " & Str(ParentTag)) End If ' Unregister Menu List entry If AreaPageListTag4 > 0 Then Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( ParentTag, AreaPageListTag4) If Err < 0 Then MessageBox.Show("Area Page Command List 4 Unregister, error code: " & Str(Err), APPNAME) End If End If ' Unregister third menu entry If AreaPageTag3 > 0 Then Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( AreaPageListTag3, AreaPageTag3) If Err < 0 Then MessageBox.Show("Area Page Command 3 Unregister, error code: " & Str(Err), APPNAME) End If End If ParentTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_System", "CL_Reports") If ParentTag <= 0 Then MessageBox.Show("Parent GetTagByName, error code: " & Str(ParentTag)) End If ' Unregister Menu List entry If AreaPageListTag3 > 0 Then Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( ParentTag, AreaPageListTag3) If Err < 0 Then MessageBox.Show("Area Page Command List 3 Unregister, error code: " & Str(Err), APPNAME) End If End If ' Unregister second menu entry If AreaPageTag2 > 0 Then Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( AreaPageListTag2, AreaPageTag2) If Err < 0 Then MessageBox.Show("Area Page Command 2 Unregister, error code: " & Str(Err), APPNAME) End If End If ParentTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_System", "CL_Inquiry") If ParentTag <= 0 Then MessageBox.Show("Parent GetTagByName, error code: " & Str(ParentTag)) End If ' Unregister Menu List entry If AreaPageListTag2 > 0 Then Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( ParentTag, AreaPageListTag2) If Err < 0 Then MessageBox.Show("Area Page Command List 2 Unregister, error code: " & Str(Err), APPNAME) End If End If ' Unregister first menu entry If AreaPageTag1 > 0 Then Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( AreaPageListTag1, AreaPageTag1) If Err < 0 Then MessageBox.Show("Area Page Command 1 Unregister, error code: " & Str(Err), APPNAME) End If End If ParentTag = MenusForVisualStudioTools.Functions.GetTagByName.Invoke( DYNAMICS, "Command_System", "CL_Transactions") If ParentTag <= 0 Then MessageBox.Show("Parent GetTagByName, error code: " & Str(ParentTag)) End If ' Unregister Menu List entry If AreaPageListTag1 > 0 Then Err = MenusForVisualStudioTools.Functions.Unregister.Invoke( ParentTag, AreaPageListTag1) If Err < 0 Then MessageBox.Show("Area Page Command List 1 Unregister, error code: " & Str(Err), APPNAME) End If End If End Try End Sub ' Script to handle menu entry callbacks Private Sub VSTMEventHandler(ByVal sender As Object, ByVal e As EventHandlerFunction.InvokeEventArgs) Dim Checked As Short = 0 Dim Tag As Short = 0 Dim Caption As String = "" ' Get Callback Tag Number for menu entry Tag = e.inParam1 ' Compare Callback Tag Number with Menu Sequence obtained during registration Select Case Tag Case MenuTag1 ' Display Menu Caption MenusForVisualStudioTools.Functions.GetCaption.Invoke(MenuTag1, Caption) ' MessageBox.Show(Caption, APPNAME) MenusForVisualStudioTools.Forms.VstmHelper.Functions.Warning.Invoke(Caption) ' Toggle Menu Check mark on first menu entry Checked = MenusForVisualStudioTools.Functions.Checked.Invoke(MenuTag1) If Checked >= 0 Then MenusForVisualStudioTools.Functions.Check.Invoke(MenuTag1, Not (Checked = 1)) End If ' Enable second menu entry and show third menu entry MenusForVisualStudioTools.Functions.Disable.Invoke(MenuTag2, False) MenusForVisualStudioTools.Functions.Hide.Invoke(MenuTag3, False) Case MenuTag2 ' Display Menu Caption MenusForVisualStudioTools.Functions.GetCaption.Invoke(MenuTag2, Caption) ' MessageBox.Show(Caption, APPNAME) MenusForVisualStudioTools.Forms.VstmHelper.Functions.Warning.Invoke(Caption) ' Disable second menu entry MenusForVisualStudioTools.Functions.Disable.Invoke(MenuTag2, True) Case MenuTag3 ' Display Menu Caption MenusForVisualStudioTools.Functions.GetCaption.Invoke(MenuTag3, Caption) ' MessageBox.Show(Caption, APPNAME) MenusForVisualStudioTools.Forms.VstmHelper.Functions.Warning.Invoke(Caption) ' Hide third menu entry MenusForVisualStudioTools.Functions.Hide.Invoke(MenuTag3, True) Case MenuTag4 ' Display Menu Caption MenusForVisualStudioTools.Functions.GetCaption.Invoke(MenuTag4, Caption) ' MessageBox.Show(Caption, APPNAME) MenusForVisualStudioTools.Forms.VstmHelper.Functions.Warning.Invoke(Caption) Case Else ' Not one of this application's menu entries End Select ' Compare Callback Tag Number with Menu Sequence obtained during registration Select Case Tag Case AreaPageTag1 ' Display Menu Caption MenusForVisualStudioTools.Functions.GetCaption.Invoke(AreaPageTag1, Caption) ' MessageBox.Show(Caption, APPNAME) MenusForVisualStudioTools.Forms.VstmHelper.Functions.Warning.Invoke(Caption) Case AreaPageTag2 ' Display Menu Caption MenusForVisualStudioTools.Functions.GetCaption.Invoke(AreaPageTag2, Caption) ' MessageBox.Show(Caption, APPNAME) MenusForVisualStudioTools.Forms.VstmForms.Functions.FormOpen.Invoke("WDC", "TEST LINES", 2) Case AreaPageTag3 ' Display Menu Caption MenusForVisualStudioTools.Functions.GetCaption.Invoke(AreaPageTag3, Caption) ' MessageBox.Show(Caption, APPNAME) MenusForVisualStudioTools.Forms.VstmForms.Functions.FormOpen.Invoke("WDC", "TEST BLANK", 0) Case AreaPageTag4 ' Display Menu Caption MenusForVisualStudioTools.Functions.GetCaption.Invoke(AreaPageTag4, Caption) ' MessageBox.Show(Caption, APPNAME) MenusForVisualStudioTools.Forms.VstmForms.Functions.FormOpen.Invoke("WDC", "TEST LINES", 0) Case AreaPageTag5 ' Display Menu Caption MenusForVisualStudioTools.Functions.GetCaption.Invoke(AreaPageTag5, Caption) ' MessageBox.Show(Caption, APPNAME) MenusForVisualStudioTools.Forms.VstmForms.Functions.FormOpen.Invoke("WDC", "TEST SETUP", 0) Case AreaPageTag6 ' Display Menu Caption MenusForVisualStudioTools.Functions.GetCaption.Invoke(AreaPageTag6, Caption) ' MessageBox.Show(Caption, APPNAME) MenusForVisualStudioTools.Forms.VstmHelper.Functions.Warning.Invoke(Caption) Case AreaPageTag7 ' Display Menu Caption MenusForVisualStudioTools.Functions.GetCaption.Invoke(AreaPageTag7, Caption) 'MessageBox.Show(Caption, APPNAME) MenusForVisualStudioTools.Forms.VstmHelper.Functions.Warning.Invoke(Caption) Case Else ' Not one of this application's menu entries End Select End Sub 'Script to Register Area Page entries Private Sub VSTMEventRegisterAreaPage(ByVal sender As Object, ByVal e As EventRegisterAreaPageFunction.InvokeEventArgs) AreaPageTag = MenusForVisualStudioTools.Functions.RegisterAreaPage.Invoke("VS VB Area Page Test", "") If AreaPageTag <= 0 Then Throw New Exception("Area Page Command Register, error code: " & Str(AreaPageTag)) End If End Sub ' Script to handle Area Page callbacks Private Sub VSTMEventHandlerAreaPage(ByVal sender As Object, ByVal e As EventHandlerAreaPageFunction.InvokeEventArgs) Dim Tag As Short = 0 Dim Err As Short = 0 ' Get Callback Tag Number for Area Page Tag = e.inParam1 ' Compare Callback Tag Number with Area Page Sequence obtained during registration Select Case Tag Case AreaPageTag Err = MenusForVisualStudioTools.Functions.RegisterAreaPageContent.Invoke(Tag, "VS VB Area Page Test", AreaPageListTag1, 0, AreaPageListTag2, 0, AreaPageListTag3, 0, AreaPageListTag4, 0, AreaPageListTag5, 0, AreaPageListTag6, 0, AreaPageListTag7, 0) If Err < 0 Then MessageBox.Show("Area Page Command Display Content, error code: " & Str(Err), APPNAME) End If Case Else ' Not one of this application's Area Pages End Select End Sub 'Script to Register Custom Forms Private Sub VSTMEventRegisterForm(ByVal sender As Object, ByVal e As EventRegisterFormFunction.InvokeEventArgs) Dim FormNumber As Short = 0 Dim Err As Short = 0 ' Register Developer Err = MenusForVisualStudioTools.Forms.VstmForms.Functions.DeveloperRegister.Invoke("WDC", "Winthrop Development Consultants") If Err < 0 Then MessageBox.Show("Custom Forms Register Developer, error code: " + Convert.ToString(Err), APPNAME) End If ' Register Forms Err = MenusForVisualStudioTools.Forms.VstmForms.Functions.FormRegister.Invoke("WDC", "TEST BLANK", "Test of Blank Form", 1, "Test Blank Form", FormNumber) If Err < 0 Then MessageBox.Show("Custom Forms Register Blank Form, error code: " + Convert.ToString(Err), APPNAME) End If Err = MenusForVisualStudioTools.Forms.VstmForms.Functions.FormRegister.Invoke("WDC", "TEST SETUP", "Test of Setup Form", 3, "Test Setup Form", FormNumber) If Err < 0 Then MessageBox.Show("Custom Forms Register Setup Form, error code: " + Convert.ToString(Err), APPNAME) End If Err = MenusForVisualStudioTools.Forms.VstmForms.Functions.FormRegisterMaint.Invoke("WDC", "TEST LINES", "Test of Maint Form", 5, "Test Maint Form", "Test Lookup Form", "Test Inquiry Form", "Test ID", "Test Name", "Test Report", FormNumber) If Err < 0 Then MessageBox.Show("Custom Forms Register Maint Form, error code: " + Convert.ToString(Err), APPNAME) End If End Sub ' Script to handle Custom Form callbacks Private Sub VSTMEventHandlerForm(ByVal sender As Object, ByVal e As EventHandlerFormFunction.InvokeEventArgs) Dim IN_DeveloperID As String = e.inParam1 Dim IN_FormID As String = e.inParam2 Dim IN_SubForm As Short = e.inParam3 Dim IN_Mode As Short = e.inParam4 Dim IN_FieldID As String = e.inParam5 Dim IN_Event As Short = e.inParam6 Dim TableID As String = "" Dim TableSequence As Integer = 0 Dim ReportNumber As String = "" Dim ReportType As Short = 0 Dim ReportControl As Short = 0 Dim ReportSequenceOne As Decimal = 0.0 Dim ReportSequenceTwo As Decimal = 0.0 Dim ReportString As String = "" Dim ReportCurrency As Decimal = 0.0 If IN_DeveloperID = "WDC" Then Select Case IN_FormID Case "TEST BLANK" Select Case IN_Mode Case 1 ' Form ' Code Block Case 2 ' Window ' Code Block Case 4 ' Field ' Code Block Case Else End Select Case "TEST SETUP" Select Case IN_Mode Case 1 ' Form ' Code Block Case 2 ' Window Select Case IN_Event Case 0 ' TRIGGER_FOCUS_PRE ' Code Block - Read Setup Table Data Case 2 ' TRIGGER_FOCUS_POST ' Code Block - Option to Abort Close 'MenusForVisualStudioTools.Forms.VstmForms.Functions.FormAbortClose.Invoke() Case 3 ' TRIGGER_FOCUS_PRINT ' Code Block Case 4 ' TRIGGER_FOCUS_ACTIVATE ' Code Block Case Else End Select Case 4 ' Field Select Case IN_FieldID Case "OK" Select Case IN_Event Case 0 ' TRIGGER_FOCUS_PRE ' Code Block Case 1 ' TRIGGER_FOCUS_CHANGE ' Code Block - Option to Reject Script 'MenusForVisualStudioTools.Forms.VstmForms.Functions.FormRejectScript.Invoke() Case 2 'TRIGGER_FOCUS_POST ' Code Block Case Else End Select Case "Cancel" Select Case IN_Event Case 0 ' TRIGGER_FOCUS_PRE ' Code Block Case 1 ' TRIGGER_FOCUS_CHANGE ' Code Block - Option to Reject Script 'MenusForVisualStudioTools.Forms.VstmForms.Functions.FormRejectScript.Invoke() Case 2 'TRIGGER_FOCUS_POST ' Code Block Case Else End Select Case Else End Select Case 6 ' Table Select Case IN_Event Case 4, 8 ' TRIGGER_ON_DB_ADD, TRIGGER_ON_DB_UPDATE ' Code Block - Save Setup Table Data Case Else End Select Case Else End Select Case "TEST LINES" Select Case IN_SubForm Case 0 ' Maint Form Select Case IN_Mode Case 1 ' Form Select Case IN_Event Case 0 ' TRIGGER_FOCUS_PRE ' Code Block - Set Navigation Case Elses Case 2 ' TRIGGER_FOCUS_POST ' Code Block Case Else End Select Case 2 ' Window Select Case IN_Event Case 0 ' TRIGGER_FOCUS_PRE ' Code Block - Set Table Record Defaults Case 2 ' TRIGGER_FOCUS_POST ' Code Block - Option to Abort Close 'MenusForVisualStudioTools.Forms.VstmForms.Functions.FormAbortClose.Invoke() Case 3 ' TRIGGER_FOCUS_PRINT ' Code Block Case 4 ' TRIGGER_FOCUS_ACTIVATE ' Code Block Case Else End Select Case 3 ' Scrolling Window Select Case IN_Event Case 0 ' TRIGGER_FOCUS_PRE ' Code Block Case 1 ' TRIGGER_FOCUS_CHANGE ' Code Block - Option to Reject Script 'MenusForVisualStudioTools.Forms.VstmForms.Functions.FormRejectScript.Invoke() Case 2 ' TRIGGER_FOCUS_POST ' Code Block Case 5 ' TRIGGER_FOCUS_FILL ' Code Block - Display Extra Line Table Data, Option to Reject Record 'MenusForVisualStudioTools.Forms.VstmForms.Functions.FormRejectRecord.Invoke() Case 6 ' TRIGGER_FOCUS_INSERT ' Code Block Case 7 ' TRIGGER_FOCUS_DELETE ' Code Block - Option to Reject Script 'MenusForVisualStudioTools.Forms.VstmForms.Functions.FormRejectScript.Invoke() Case Else End Select Case 4 ' Field Select Case IN_FieldID Case "Display Existing Record" Select Case IN_Event Case 1 ' TRIGGER_FOCUS_CHANGE ' Code Block - Read Extra Header Table Data Case Else End Select Case Else End Select Case 5 ' Scrolling Window Field ' Code Block Case 6 ' Table TableID = IN_FieldID Select Case IN_Event Case 4, 8 ' TRIGGER_ON_DB_ADD, TRIGGER_ON_DB_UPDATE ' Code Block - Save Extra Header Table Data Case 16 ' TRIGGER_ON_DB_DELETE ' Code Block - Delete Extra Header Table Data Case Else End Select Case 7 ' Scrolling Window Table MenusForVisualStudioTools.Forms.VstmForms.Functions.KeySplitLine.Invoke(IN_FieldID, TableID, TableSequence) Select Case IN_Event Case 4, 8 ' TRIGGER_ON_DB_ADD, TRIGGER_ON_DB_UPDATE ' Code Block - Save Extra Line Table Data Case 16 ' TRIGGER_ON_DB_DELETE ' Code Block - Delete Extra Line Table Data Case Else End Select Case 8 ' Report Writer Functions Select Case IN_Event Case 1 ' rw_ReportStart ReportString = "" ' Code Block MenusForVisualStudioTools.Forms.VstmForms.Functions.ReportSetString.Invoke(ReportString) Case 2 ' rw_ReportEnd ReportString = "" ' Code Block MenusForVisualStudioTools.Forms.VstmForms.Functions.ReportSetString.Invoke(ReportString) Case 3 ' rw_TableHeaderString MenusForVisualStudioTools.Forms.VstmForms.Functions.ReportGetTableHeader.Invoke(ReportNumber, ReportType, ReportControl) ReportString = "" ' Code Block MenusForVisualStudioTools.Forms.VstmForms.Functions.ReportSetString.Invoke(ReportString) Case 4 ' rw_TableHeaderCurrency MenusForVisualStudioTools.Forms.VstmForms.Functions.ReportGetTableHeader.Invoke(ReportNumber, ReportType, ReportControl) ReportCurrency = 0.0 ' Code Block MenusForVisualStudioTools.Forms.VstmForms.Functions.ReportSetCurrency.Invoke(ReportCurrency) Case 5 ' rw_TableLineString MenusForVisualStudioTools.Forms.VstmForms.Functions.ReportGetTableLine.Invoke(ReportNumber, ReportType, ReportSequenceOne, ReportSequenceTwo, ReportControl) ReportString = "" ' Code Block MenusForVisualStudioTools.Forms.VstmForms.Functions.ReportSetString.Invoke(ReportString) Case 6 ' rw_TableLineCurrency MenusForVisualStudioTools.Forms.VstmForms.Functions.ReportGetTableLine.Invoke(ReportNumber, ReportType, ReportSequenceOne, ReportSequenceTwo, ReportControl) ReportCurrency = 0.0 ' Code Block MenusForVisualStudioTools.Forms.VstmForms.Functions.ReportSetCurrency.Invoke(ReportCurrency) Case Else End Select Case Else End Select Case 1 ' Lookup Form Select Case IN_Mode Case 1 ' Form ' Code Block Case 2 ' Window ' Code Block Case 3 ' Scrolling Window ' Code Block Case 4 ' Field ' Code Block Case 5 ' Scrolling Window Field ' Code Block Case 6 ' Table ' Code Block Case 7 ' Scrolling Window Table ' Code Block Case Else End Select Case 2 ' Inquiry Form Select Case IN_Mode Case 1 ' Form ' Code Block Case 2 ' Window ' Code Block Case 3 ' Scrolling Window Select Case IN_Event Case 5 ' TRIGGER_FOCUS_FILL ' Code Block - Display Extra Line Table Data, Option to Reject Record 'MenusForVisualStudioTools.Forms.VstmForms.Functions.FormRejectRecord.Invoke() Case Else End Select Case 4 ' Field Select Case IN_FieldID Case "Display Existing Record" Select Case IN_Event Case 1 ' TRIGGER_FOCUS_CHANGE ' Code Block - Read Extra Header Table Data Case Else End Select Case Else End Select Case 5 ' Scrolling Window Field ' Code Block Case 6 ' Table ' Code Block Case 7 ' Scrolling Window Table ' Code Block Case Else End Select Case Else End Select Case Else End Select End If End Sub End Class ** End of File **