V
TC I II III IV V

Adding Custom Commands to ACT!TM

with and

CONTENTS

Section V       Adding Custom Commands to ACT!

Chapter 1       Getting Started with Adding Custom Commands to ACT!...................... 463

Conventions used in this manual......................................................................... 463

Syntax conventions...................................................................................... 463

Overview........................................................................................................... 464

System requirements......................................................................................... 464

What’s new....................................................................................................... 464

Changes for ACT! 2000, version 5.0.2............................................................ 464

Chapter 2       Using the OLE Command Object for Adding Custom Commands........ 467

Understanding the Command Object................................................................... 467

Command object methods.................................................................................. 468

AddAuxCommand Method............................................................................ 469

AddAuxCommandEnabled Method (requires ACT! 2000 version 5.0.2 or later)... 471

AddAuxCommandToMenu Method (requires ACT! 2000 version 5.0.2 or later).... 472

AddAuxCommandToToolbar Method.............................................................. 474

AddAuxCommandToToolsMenu Method......................................................... 475

AddAuxSubMenu Method (requires ACT! 2000 version 5.0.2 or later)................ 476

AuxCommandExists Method........................................................................ 478

AuxCommandExistsInMenus Method (requires ACT! 2000 version 5.0.2 or later) 478

AuxCommandExistsInToolbar Method........................................................... 479

AuxCommandExistsInToolsMenu Method...................................................... 480

AuxSubMenuExists Method (requires ACT! 2000 version 5.0.2 or later)............. 480

DeleteAuxCommand Method........................................................................ 481

RemoveAuxCommandFromMenus Method (requires ACT! 2000 version 5.0.2 or later)          482

RemoveAuxCommandFromToolbar Method.................................................... 483

RemoveAuxCommandFromToolsMenu Method............................................... 484

RemoveAuxSubMenu Method (requires ACT! 2000 version 5.0.2 or later).......... 485

Chapter 3       Adding Custom Commands to ACT! Error Codes................................... 487

 



Text Box: 1

 

CHAPTER

Getting Started with Adding Custom Commands to ACT!

This section describes the ACT! TM OLE Command Object, which lets you add commands to ACT! that execute external programs.

This manual assumes that you are familiar with and using the following

·         ACT! 2000 or later for Windows

·         Microsoft Windows 95, Windows 98, Windows 2000, or Windows NT 4.0

Conventions used in this manual

Syntax conventions

bold                                   Command names, function names, properties, methods, and other text you need to type are shown in bold.

ALL CAPITALS                File names and messages are shown in all CAPITAL letters.

Courier                              Example code is shown in a monospaced Courier font. Comments in the code are preceded by an apostrophe ('Comment). If a line of code does not fit on a single line of the page, the remaining code is indented on the next line. Code examples are not case sensitive.

italic                                  Parameters, return variables, data structure names, and text that represent the type of text to be entered rather than a literal series of characters are shown in italic.

[brackets]                          Optional items in syntax statements are enclosed in brackets ([ ]). For example, [password] indicates that a password can be used with the command, but is not required. In commands, include the information within the brackets without the brackets.

Parameter1|Parameter2     Parameters are separated by a vertical bar (|) to indicate a mandatory choice between two items. Only one of the items can be specified.

...                                       Items that you can repeat are indicated by an ellipsis (… ) For example, devicename [...] indicates that you can optionally specify more than one device, separating the device names with a space.

Overview

The Command Object lets you add commands to the ACT! graphical user interface that run programs outside of ACT! This object provides methods for creating these types of commands, testing whether commands have been created, and adding their associated toolbar buttons and menu items. Also, this interface provides methods for deleting these commands, deleting their associated toolbar buttons and menu items, and determining whether commands exist in toolbars or menus.

Adding a command is a two-step process. First, you define the command. Then, you add the command to a menu or tool bar.

System requirements

To use the OLE Command Object, you must have ACT! 2000 or later.

What’s new

The ACT! OLE Command Object requires ACT! 2000 or later. This section lists changes to the OLE Command Object for ACT! 2000 version 5.0.2.

Changes for ACT! 2000 version 5.0.2

Added methods

The following methods have been added for ACT! 2000 version 5.0.2:

New Method

New Method

AddAuxCommandEnabled

AuxSubMenuExists

AddAuxCommandToMenu

RemoveAuxCommandFromMenus

AddAuxSubMenu

RemoveAuxSubMenu

AuxCommandExistsInMenus

 

 


Text Box: 2

 

CHAPTER

Using the OLE Command Object for Adding Custom Commands

This chapter describes the methods available in the OLE Command Object.

Understanding the Command Object

The Command Object is implemented as an OLE Automation Inproc server. It manages a file named ACTCMD.INI that contains the necessary information to define auxiliary commands that ACT! loads when it starts.

The ACTCMD.INI file is created when you run an application using this object. These commands do not appear in the Customize ACT! dialogs. The ACTCMD.INI file is created by the ACT! SDK and distributing it to other ACT! users is not recommended. The maximum size of the ACTCMD.INI file is 64 KB.

The object name of the AuxCmds interface is ACTOLE.AUXCMDS. It exports methods that can be used to create, delete, and check for the existence of commands that load external applications. These commands can be added to a toolbar or to the Tools menu for a specific view. This chapter defines these methods.

Command object methods

The Command Object contains information about the custom commands. The following methods apply only to the Command Object.

Methods

Method Name

Parameter(s)

Parameter
Type(s)

Return Type

AddAuxCommand

szCommandName,
szCommandLine,
szStartIn,
szToolTip,
szDescription,
szSmallIconPath,
szLargeIconPath,
iRunState

String,
String,
String,
String,
String,
String,
String,
Short Integer

Long Integer

AddAuxCommandEnabled

szCommandName,
szCommandLine,
szStartIn,

szToolTip,
szDescription,
szSmallIconPath,
szLargeIconPath,
iRunState,

String,
String,
String,
String,
String,
String,
String,
Short Integer

Long Integer

AddAuxCommandToMenu

lViewID,
szMenuName,
lPosition,
lSeparator,
szCommandName

Long Integer,
String,
Long Integer,
Long Integer,
String

Long Integer

AddAuxCommandToToolbar

lViewID,
szCommandName

Long Integer,
String

Long Integer

AddAuxCommandToToolsMenu

lViewID,
szCommandName

Long Integer,
String

Long Integer

AddAuxSubMenu

lViewID,
szMenuName,
lPosition,
lSeparator,
szSubMenuName

Long Integer,
String,
Long Integer,
Long Integer,
String

Long Integer

AuxCommandExists

szCommandName

String

Boolean

AuxCommandExistsInMenus

lViewID,
szCommandName

Long Integer,
String

Boolean

AuxCommandExistsInToolbar

lViewID,
szCommandName

Long Integer,
String

Boolean

AuxCommandExistsInToolsMenu

lViewID,
szCommandName

Long Integer,
String

Boolean

AddSubMenuExists

lViewID,
szMenuName,
szSubMenuName,
lItemCount

Long Integer,
String,
String,
Long Integer

Boolean

DeleteAuxCommand

szCommandName

String

Long Integer

RemoveAuxCommandFromMenus

lViewID,
szCommandName

Long Integer,
String

Long Integer

RemoveAuxCommandFromToolbar

lViewID,
szCommandName

Long Integer,
String

Long Integer

RemoveAuxCommandFromToolsMenu

lViewID,
szCommandName

Long Integer,
String

Long Integer

RemoveAuxSubMenu

lViewID,
szMenuName,
szSubMenuName

Long Integer,
String,
String

Long Integer

AddAuxCommand Method

Description    Creates an auxiliary command that can be added later to the Tools menu or the standard toolbar of a specified view to begin execution of a program outside of ACT! Use this method before you use the AddAuxCommandToToolsMenu method or the AddAuxCommandToToolbar method. This method returns one of the following: S_OK, S_INVALID_INPUT, or S_DUPLICATE.

Objects          Command

Syntax            object.AddAuxCommand (szCommandName, szCommandLine, szStartIn, szToolTip, szDescription, szSmallIconPath, szLargeIconPath, iRunState)

Parameters    szCommandName   String that uniquely identifies the command. The command name must be unique; two commands cannot have the same name.

szCommandLine     String that specifies the command to be executed.

szStartIn                String that specifies the folder containing the data files associated with the command.

szToolTip               String that specifies the tool tip text displayed for the command.

szDescription         String that describes the command.

szSmallIconPath    String specifying the path of an icon file that contains a 16 x 16 button image for the command when small buttons are used.

szLargeIconPath    String specifying the path of an icon file that contains a 32 x 32 button image for the command when large buttons are used.

iRunState               Short integer that specifies the initial state of the window.

                              The following table lists the value for each state:

Value

State

0

Run the window in the background

1

Normal

2

Maximize the window

 

Return type   Long Integer

Example        

'VB This example adds custom command CMDTEST

 

Dim objCommands As Object

Dim ret As Long

 

'Create the Commands object

Set objCommands = CreateObject("ACTOLE.AUXCMDS")

 

'Add custom command Test.exe to run in the normal state

ret = objCommands.AddAuxCommand("CMDTEST", "c:\SDKTest\Test.exe",

   "c:\SDKTest","MyTooltip", "Tests Description", "c\Test\small.ico",

   "c:\Test\large.ico", 1)

 

If ret <> 0 Then

   List1.AddItem "Error adding custom command "

Else: List1.AddItem "Custom command added successfully"

End If

 

'Clear the object

Set objCommands = Nothing

 

AddAuxCommandEnabled Method (requires ACT! 2000 version 5.0.2 or later)

Description    Creates an auxiliary command that can be added later to a menu or the standard toolbar of a specified view to begin execution of a program outside of ACT! Use this method before you use the AddAuxCommandToMenu, AddAuxCommandToToolsMenu, or the AddAuxCommandToToolbar method. This method returns one of the following: S_OK, S_INVALID_INPUT, or S_DUPLICATE.

Note: Use this method instead of AddAuxCommand when you need to set the enabled/disabled status of an added command. The AddAuxCommand command always enables an added command. Using AddAuxCommandEnabled, you can set the enabled status of an added command to that of a specified pre-defined ACT! command. For example, the pre-defined Copy command is enabled only if text is selected to copy. You could set the enabled status of a custom command to the status of the Copy command (Command ID 303).

Objects          Command

Syntax            object.AddAuxCommandEnabled (szCommandName, szCommandLine, szStartIn, szToolTip, szDescription, szSmallIconPath, szLargeIconPath, iRunState, iCommandID)

Parameters    szCommandName   String that uniquely identifies the command. The command name must be unique; two commands cannot have the same name.

szCommandLine     String that specifies the command to be executed.

szStartIn                String that specifies the folder containing the data files associated with the command.

szToolTip               String that specifies the tool tip text displayed for the command.

szDescription         String that describes the command.

szSmallIconPath    String specifying the path of an icon file that contains a 16 x 16 button image for the command when small buttons are used.

szLargeIconPath    String specifying the path of an icon file that contains a 32 x 32 button image for the command when large buttons are used.

iRunState               Short integer that specifies the initial state of the window.

The following table lists the value for each state:

Value

State

0

Run the window in the background

1

Normal

2

Maximize the window

 

iCommandID          Short integer that specifies the Command ID of a predefined command whose enabled status is used to set the status of the added command.

Note: Do not use Command ID 104 (File > Save) because the Save command is disabled before another command is executed.

                              For a list of values for this parameter, see the ACT! Command ID Reference appendix.

Return type   Long Integer

Example         'This example adds a command that is linked to Edit > Paste

 

Dim objAuxCmd As Object

Dim ret As Long

Set objAuxCmd = CreateObject("ACTOLE.AUXCMDS")

 

szCommandName = "Sample Command"

szCommandLine = "c:\SDKTest\Test.exe"

szStartIn = "c:\SDKTest"

szToolTip = "Tool Tip"

szDescription = "Description"

szSmallIconPath = "small.ico"

szLargeIconPath = "large.ico"

iRunState = 2       'Maximized

iCommandID = 304    'Edit > Paste

ret = objAuxCmd.AddAuxCommandEnabled(szCommandName, szCommandLine,

   szStartIn, szToolTip, szDescription, szSmallIconPath, szLargeIconPath,

   iRunState, iCommandID)

AddAuxCommandToMenu Method (requires ACT! 2000 version 5.0.2 or later)

Description    Adds the specified command to a menu or a submenu of a specific view. Before using this method you must have added the command using the AddAuxCommand method. You can use this method multiple times to insert a group of commands on a menu. This method returns one of the following: S_OK, S_INVALID_ID, S_INVALID_INPUT, S_NOT_FOUND, or S_DUPLICATE.

Objects          Command

Syntax            object.AddAuxCommandToMenu (lViewID, szMenuName, lPosition, lSeparator, szCommandName)

Parameters    lViewID                  Long integer specifying the view in which the specified command will be added to the specified menu.

                              The following table lists the value for each view:

Value

Target View

 

Value

Target View

0

Startup View (the view displayed when a database is not open)

 

4

Task List View

1

Contact View

 

5

All Calendar Views

2

Contact List View

 

6

Email View

3

Groups View

 

 

 

 

szMenuName         String that identifies the menu and optionally the submenu to contain the added command. The value must match the name of a menu in the specified view. Specify a menu name and submenu name in the following format:

                              MenuName\SubMenuName

lPosition                Long integer specifying the index number of the menu item before which to insert the added command, in the range from 0 to the total number of items in the menu. (Separators are not considered as items.) Specify 0 to insert the command at the top of the menu. Specify the value for the total number of items in the menu to insert the command at the bottom of the menu. You can specify ‑1 to always append the command to the bottom of a menu.

lSeparator             Long integer specifying the placement of separators around the added command(s).

                              The following table lists the values for this parameter:

Value

Placement

 

Value

Placement

0

No separator

 

3

Top and bottom separators

1

Top separator

 

-1

Adds separators at the top and bottom of a group of adjacent added commands

2

Bottom separator

 

 

 

Note: If you are adding a group of commands and submenus with separators at the top and bottom of the group, specify a value of –1 for this parameter when adding each command in the group.

szCommandName   String that uniquely identifies the command. The command name must be unique; two commands cannot have the same name. A command name can be used only once per view.

Return type   Long Integer

Example         'This example adds a command to a submenu

 

Dim objAuxCmd As Object

Dim ret As Long

Set objAuxCmd = CreateObject("ACTOLE.AUXCMDS")

 

szCommandName = "Sample Command"

If objAuxCmd.AuxCommandExists(szCommandName) Then

   lViewID = 1         'Contact view

   szMenuName = "Edit"

   lPosition = -1      'append submenu to bottom

   lSeparator = 1      'top separator

   szSubMenuName = "Sample Submenu"

   ret = objAuxCmd.AddAuxSubMenu(lViewID, szMenuName, lPosition, lSeparator,

       szSubMenuName)

   If objAuxCmd.AuxSubMenuExists(lViewID, szMenuName, szSubMenuName,

       lCmdCount) Then

       ret = objAuxCmd.AddAuxCommandToMenu(lViewID, szMenuName & "\" &

          szSubMenuName, lPosition, lSeparator, szCommandName)

   End If

End If

AddAuxCommandToToolbar Method

Description    Adds the specified command button to the standard toolbar of a specified view. Before using this method you must have added the command using the AddAuxCommand method. This method returns one of the following: S_OK, S_INVALID_ID, S_INVALID_INPUT, S_NOT_FOUND, or S_DUPLICATE.

Objects          Command

Syntax            object.AddAuxCommandToToolbar (lViewID, szCommandName)

Parameters    lViewID                  Long integer that specifies the view.

                              The following table lists the value for each view:

Value

Target View

 

Value

Target View

0

Startup View (the view displayed when a database is not open)

 

4

Task List View

1

Contact View

 

5

All Calendar Views

2

Contact List View

 

6

Email View

3

Groups View

 

 

 

 

szCommandName   Unique name that specifies the command to be added. The command name must be unique; two commands cannot have the same name. A command name can be used only once per view.

Return type   Long Integer

Example         'This example adds a command to the toolbar in the Contact view

 

Dim objCommands As Object

Dim ret As Long

 

'Create the Commands object

Set objCommands = CreateObject("ACTOLE.AUXCMDS")

 

'Check if the command exists, only then add it to the toolbar

If objCommands.AuxCommandExists("CMDTEST") Then

 

   ret = objCommands.AddAuxCommandToToolbar(1, "CMDTEST")

 

   If ret = 0 Then List1.AddItem "Command successfully added to toolbar "

   Else: List1.AddItem "Error adding the command to the toolbar"

Else

   List1.AddItem "The Command does not exist. Please use the method

       AddAuxCommand first!"

End If

 

Set objCommands = Nothing

AddAuxCommandToToolsMenu Method

Description    Adds the specified command to the Tools menu of a specific view. Before using this method you must have added the command using the AddAuxCommand method. This method returns one of the following: S_OK, S_INVALID_ID, S_INVALID_INPUT, S_NOT_FOUND, or S_DUPLICATE.

Objects          Command

Syntax            object.AddAuxCommandToToolsMenu (lViewID, szCommandName)

Parameters    lViewID                  Long integer specifying the view in which the specified command will be added to the Tools menu.

                              The following table lists the value for each view:

Value

Target View

 

Value

Target View

0

Startup View (the view displayed when a database is not open)

 

4

Task List View

1

Contact View

 

5

All Calendar Views

2

Contact List View

 

6

Email View

3

Groups View

 

 

 

 

szCommandName   String that uniquely identifies the command. The command name must be unique; two commands cannot have the same name.

Return type   Long Integer

Example         'This example adds custom command CMDTEST to the Tools menu in the

'Group view

 

Dim objCommands As Object

Dim ret As Long

 

'Create the Commands object

Set objCommands = CreateObject("ACTOLE.AUXCMDS")

 

'Check if the command exists, and only then add it to the Tools menu

If objCommands.AuxCommandExists("CMDTEST") Then

 

   ret = objCommands.AddAuxCommandToToolsMenu(3, "CMDTEST")

   If ret = 0 Then list1.AddItem "Command successfully added to Tools menu!

       Please restart ACT! to see the results"

   Else: List1.AddItem "Error adding the command to the Tools menu"

End If

'Clear the Commands object

Set objCommands = Nothing

AddAuxSubMenu Method (requires ACT! 2000 version 5.0.2 or later)

Description    Adds the specified menu or submenu (cascading menu) to a menu of a specific view. You can use this method multiple times to insert a group of submenus on a menu. This method returns one of the following: S_OK, S_INVALID_ID, S_INVALID_INPUT, S_NOT_FOUND, or S_DUPLICATE.

Objects          Command

Syntax            object.AddAuxSubMenu (lViewID, szMenuName, lPosition, lSeparator, szSubMenuName)

Parameters    lViewID                  Long integer specifying the view in which the specified menu or submenu will be added.

                              The following table lists the value for each view:

Value

Target View

 

Value

Target View

0

Startup View (the view displayed when a database is not open)

 

4

Task List View

1

Contact View

 

5

All Calendar Views

2

Contact List View

 

6

Email View

3

Groups View

 

 

 

 

szMenuName         String that identifies the menu to contain the added submenu. The value must match the name of a menu in the specified view. Specify a null value to add a menu to the menu bar.

lPosition                When adding a menu to the menu bar:
Long integer specifying the index number of the menu (left to right) before which to insert the menu, in the range from 0 to the total number of menus. Specify 0 to insert a menu to the left of existing menus. Specify the value for the total number of menus to insert the menu to the right of existing menus. You can specify ‑1 to always append the menu to the right of existing menus.

                              When adding a submenu to a menu:
Long integer specifying the index number of the menu item before which to insert the added submenu, in the range from 0 to the total number of items in the menu. (Separators are not considered as items.) Specify 0 to insert a submenu at the top of the menu. Specify the value for the total number of items in the menu to insert the submenu at the bottom of the menu. You can specify ‑1 to always append the submenu to the bottom of a menu.

lSeparator             Long integer specifying the placement of separators around the added submenu(s).

                              The following table lists the values for this parameter:

Value

Placement

 

Value

Placement

0

No separator

 

3

Top and bottom separators

1

Top separator

 

-1

Adds separators at the top and bottom of a group of adjacent added submenus

2

Bottom separator

 

 

 

Note: If you are adding a group of commands and submenus with separators at the top and bottom of the group, specify a value of –1 for this parameter when adding each submenu in the group.

szSubMenuName   String that uniquely identifies the menu or submenu. The menu or submenu name must be unique; two menus or submenus cannot have the same name.

Return type   Long Integer

Example         See AddAuxCommandToMenu

AuxCommandExists Method

Description    Determines if an auxiliary command with the specified name exists. Returns True (non-zero) if the command exists or False (zero) if the command does not exist.

Objects          Command

Syntax            object.AuxCommandExists (szCommandName)

Parameters    szCommandName   Unique name of the auxiliary command.

Return type   Boolean

AuxCommandExistsInMenus Method (requires ACT! 2000 version 5.0.2 or later)

Description    Determines if a command with the specified name exists in any menu of the specified view. Use this method to verify if a command exists before deleting it. This method returns True (non-zero) is the specified command exists or False (zero) if the command does not exist.

Objects          Command

Syntax            object.AuxCommandExistsInMenus (lViewID, szCommandName)

Parameters    lViewID                  Long integer specifying the view for the specified command.

                              The following table lists the value for each view:

Value

Target View

 

Value

Target View

0

Startup View (the view displayed when a database is not open)

 

4

Task List View

1

Contact View

 

5

All Calendar Views

2

Contact List View

 

6

Email View

3

Groups View

 

 

 

 

szCommandName   String that uniquely identifies a command to determine if it exists in any menu of the specified view.

Return type   Boolean

Example         See AddAuxCommandToMenu, RemoveAuxCommandFromMenus

AuxCommandExistsInToolbar Method

Description    Checks for the existence of the specified command in the toolbar for the specified view. Returns True (non-zero) if the command exists or False (zero) if the command does not exist.

Objects          Command

Syntax            object.AuxCommandExistsInToolbar(lViewID, szCommandName)

Parameters    lViewID                  Long integer indicating the view.

                              The following table lists the value for each view:

Value

Target View

 

Value

Target View

0

Startup View (the view displayed when a database is not open)

 

4

Task List View

1

Contact View

 

5

All Calendar Views

2

Contact List View

 

6

Email View

3

Groups View

 

 

 

 

szCommandName   Unique name that identifies the command to be found.

Return type   Boolean

AuxCommandExistsInToolsMenu Method

Description    Checks for existence of the specified command in the Tools drop-down menu of the specified view. Returns True (non-zero) if the command exists or False (zero) if the command does not exist.

Objects          Command

Syntax            object.AuxCommandExistsInToolsMenu (lViewID, szCommandName)

Parameters    lViewID                  Long integer specifying the view.

                              The following table lists the value for each view:

Value

Target View

 

Value

Target View

0

Startup View (the view displayed when a database is not open)

 

4

Task List View

1

Contact View

 

5

All Calendar Views

2

Contact List View

 

6

Email View

3

Groups View

 

 

 

 

szCommandName   Unique name that specifies the command to search for.

Return type   Boolean

AuxSubMenuExists Method (requires ACT! 2000 version 5.0.2 or later)

Description    Returns the number of menu items contained in a menu or submenu. Use this method to verify if a menu or submenu exists and the number of items it contains before deleting it. This method returns True is the specified menu or submenu exists or False if not.

Objects          Command

Syntax            object.AddSubMenuExists (lViewID, szMenuName, szSubMenuName, lItemCount)

Parameters    lViewID                  Long integer specifying the view for the specified menu or submenu.

                              The following table lists the value for each view:

Value

Target View

 

Value

Target View

0

Startup View (the view displayed when a database is not open)

 

4

Task List View

1

Contact View

 

5

All Calendar Views

2

Contact List View

 

6

Email View

3

Groups View

 

 

 

 

szMenuName         String that identifies the menu that contains the submenu. The value must match the name of a menu in the specified view. Specify a null value to check for a menu in the menu bar.

szSubMenuName   String that identifies the menu or submenu to check if it exists and the number of items it contains. The value must match the name of a menu or submenu in the specified menu in the specified view.

lItemCount             Reference to a variable that receives a long integer value representing the number of items contained in the specified menu or submenu. A value of 0 is received if the menu or submenu does not exist or if it contains no menu items.

Return type   Boolean

Example         See AddAuxCommandToMenu, RemoveAuxSubMenu

DeleteAuxCommand Method

Description    Deletes an existing auxiliary command and any associated toolbar and menu items. This method returns one of the following: S_OK, S_NOT_FOUND.

Objects          Command

Syntax            object.DeleteAuxCommand (szCommandName)

Parameters    szCommandName   Unique name of the auxiliary command to delete.

Return type   Long Integer

Example         'This example completely deletes the specified custom command

 

Dim objCommands As Object

Dim ret As Long

 

'Create the Commands object

Set objCommands = CreateObject("ACTOLE.AUXCMDS")

 

ret = objCommands.DeleteAuxCommand("CMDTEST")

If ret <>0 Then

   lstDisplay.AddItem sCommandName & " could not be deleted ."

End If

 

'Clear the Commands object

Set objCommands = Nothing

RemoveAuxCommandFromMenus Method (requires ACT! 2000 version 5.0.2 or later)

Description    Removes the specified command from a menu of a specified view. Use AuxCommandExistsInMenus before using this method to verify that the command to be removed exists. This method returns one of the following: S_OK, S_INVALID_ID, S_INVALID_INPUT, or S_NOT_FOUND.

Objects          Command

Syntax            object.RemoveAuxCommandFromMenus (lViewID, szCommandName)

Parameters    lViewID                  Long integer specifying the view in which the specified command will be removed.

                              The following table lists the value for each view:

Value

Target View

 

Value

Target View

0

Startup View (the view displayed when a database is not open)

 

4

Task List View

1

Contact View

 

5

All Calendar Views

2

Contact List View

 

6

Email View

3

Groups View

 

 

 

 

szCommandName   String that uniquely identifies the command to remove. The value must match the name of a command in a menu in the specified view.

Return type   Long Integer

Example         This example removes a command from a menu in the Contact view if it exists

Dim objAuxCmd As Object

Dim ret As Long

Set objAuxCmd = CreateObject("ACTOLE.AUXCMDS")

 

lViewID = 1     'Contact view

szCommandName = "Sample Command"

If objAuxCmd.AuxCommandExistsInMenus(lViewID, szCommandName) Then

   ret = objAuxCmd.RemoveAuxCommandFromMenus(lViewID, szCommandName)

End If

RemoveAuxCommandFromToolbar Method

Description    Removes the specified command button from the toolbar of a specified view. This method only deletes the specified command from the toolbar. Use the DeleteAuxCommand method to delete the command. This method returns one of the following: S_OK, S_INVALID_ID, S_INVALID_INPUT, or S_NOT_FOUND.

Objects          Command

Syntax            object.RemoveAuxCommandFromToolbar (lViewID, szCommandName)

Parameters    lViewID                  Long integer specifying the view.

                              The following table lists the value for each view:

Value

Target View

 

Value

Target View

0

Startup View (the view displayed when a database is not open)

 

4

Task List View

1

Contact View

 

5

All Calendar Views

2

Contact List View

 

6

Email View

3

Groups View

 

 

 

 

szCommandName   Unique name that identifies the command to be removed.

Return type   Long Integer

Example         'This example removes the CMDTEST command from the toolbar of the

'Contact view

 

Dim objCommands As Object

Dim ret As Long

 

'Create the Commands object

Set objCommands = CreateObject("ACTOLE.AUXCMDS")

 

'If the Command exists in the toolbar, then remove it from the toolbar

If (objCommands.AuxCommandExistsInToolbar(1, "CMDTEST")) Then

   ret = objCommands.RemoveAuxCommandFromToolbar(1, "CMDTEST")

Else

   lstDisplay.AddItem sCommandName & " does not exist in the toolbar in the

       view selected, please try again"

End If

 

'Clear the commands object

Set objCommands = Nothing

RemoveAuxCommandFromToolsMenu Method

Description    Removes the specified command name from the Tools menu of a specified view. This method only deletes the specified command from the Tools menu. Use the DeleteAuxCommand method to delete the command. This method returns one of the following: S_OK, S_INVALID_ID, S_INVALID_INPUT, or S_NOT_FOUND.

Objects          Command

Syntax            object.RemoveAuxCommandFromToolsMenu (lViewID, szCommandName)

Parameters    lViewID                  Long integer specifying the view.

                              The following table lists the value for each view:

Value

Target View

 

Value

Target View

0

Startup View (the view displayed when a database is not open)

 

4

Task List View

1

Contact View

 

5

All Calendar Views

2

Contact List View

 

6

Email View

3

Groups View

 

 

 

 

szCommandName   Unique name that identifies the command to be removed.

Return type   Long Integer

Example         'This example removes the requested command from the Tools menu of the

'selected view

 

Dim objCommands As Object

Dim ret As Long

 

'Create the Commands object

Set objCommands = CreateObject("ACTOLE.AUXCMDS")

 

'If the command exists in the toolbar, then remove it from the toolbar

If (objCommands.AuxCommandExistsInToolsMenu(3, "CMDTEST")) Then

   ret = objCommands.RemoveAuxCommandFromToolsMenu(3, "CMDTEST")

 

Else

   lstDisplay.AddItem sCommandName & " does not exist in the toolbar in the

       view selected, please try again"

End If

 

Set objCommands = Nothing

RemoveAuxSubMenu Method (requires ACT! 2000 version 5.0.2 or later)

Description    Removes the specified menu or submenu of a specific view. Use AuxSubMenuExists before using this method to verify the number of menu items in the menu or submenu to be removed. This method returns one of the following: S_OK, S_INVALID_ID, S_INVALID_INPUT, or S_NOT_FOUND.

Objects          Command

Syntax            object.RemoveAuxSubMenu (lViewID, szMenuName, szSubMenuName)

Parameters    lViewID                  Long integer specifying the view in which the specified menu or submenu will be removed.

                              The following table lists the value for each view:

Value

Target View

 

Value

Target View

0

Startup View (the view displayed when a database is not open)

 

4

Task List View

1

Contact View

 

5

All Calendar Views

2

Contact List View

 

6

Email View

3

Groups View

 

 

 

 

szMenuName         String that identifies the menu containing the submenu to remove. The value must match the name of a menu in the specified view. Specify a null value to remove a menu in the menu bar.

szSubMenuName   String that identifies the menu or submenu to remove. The value must match the name of a menu or submenu in the specified menu in the specified view.

Return type   Long Integer

Example         This example removes a submenu from the Contact view if it exists

Dim objAuxCmd As Object

Dim ret As Long

Set objAuxCmd = CreateObject("ACTOLE.AUXCMDS")

 

lViewID = 1         'Contact view

szMenuName = "Edit"

szSubMenuName = "Sample Submenu"

If objAuxCmd.AuxSubMenuExists(lViewID, szMenuName, szSubMenuName, lCmdCount)

   Then

   ret = objAuxCmd.RemoveAuxSubMenu(lViewID, szMenuName, szSubMenuName)

End If



CHAPTER

Adding Custom Commands to ACT! Error Codes

The following error codes apply only to the Adding Custom Commands to ACT! component of the ACT! SDK.

Value

Error code

Description

0

S_OK

Success

102

S_NOT_FOUND

Command or toolbar icon not defined

117

S_INVALID_INPUT

Required input parameter is 0 or null

134

S_MEM_ERROR

Limit of 300 added commands exceeded

157

S_DUPLICATE

Command being added already exists

163

S_INVALID_ID

Invalid View ID specified

 



ACT! Software Development Kit (SDK)
Technical Reference Guide

Adding Custom Commands to ACT! section

The software described in this book is furnished under a license agreement and may be used only in accordance with the terms of the agreement.

Copyright Notice

Portions of this publication copyright 2000 Interact Commerce Corporation. Portions of this publication copyright  1993 ‑ 2000 Symantec Corporation under exclusive license to Interact Commerce Corporation.

All Rights Reserved.

Released: 6/2000 for ACT! 2000

This document may not, in whole or in part, be copied, photocopied, reproduced, translated, or reduced to any electronic medium or machine-readable form without prior consent in writing from Interact Commerce Corporation, 8800 N. Gainey Center Dr. #200, Scottsdale, AZ 85258.

ALL EXAMPLES WITH NAMES, COMPANY NAMES, OR COMPANIES THAT APPEAR IN THIS MANUAL ARE IMAGINARY AND DO NOT REFER TO, OR PORTRAY, IN NAME OR SUBSTANCE, ANY ACTUAL NAMES, COMPANIES, ENTITIES, OR INSTITUTIONS. ANY RESEMBLANCE TO ANY REAL PERSON, COMPANY, ENTITY, OR INSTITUTION IS PURELY COINCIDENTAL.

Every effort has been made to ensure the accuracy of this manual. However, Interact Commerce makes no warranties with respect to this documentation and disclaims any implied warranties of merchantability and fitness for a particular purpose. Interact Commerce shall not be liable for any errors or for incidental or consequential damages in connection with the furnishing, performance, or use of this manual or the examples herein. The information in this document is subject to change without notice.

Trademarks

ACT! is a registered trademark and SideACT! is a trademark under exclusive license to Interact Commerce Corporation by their owner, Symantec Corporation, in the United States and other countries. Interact Commerce Corporation and not Symantec Corporation has produced this publication and is responsible for the contents hereof. Symantec and WinFax are U.S. registered trademarks of Symantec Corporation. WinFax PRO is a trademark of Symantec Corporation. Microsoft, MS, Windows, Windows CE, Windows NT, Word, Schedule+, ActiveX, FoxPro, Visual Basic, and Visual C++ are either registered trademarks or trademarks of Microsoft Corporation in the U.S. and/or other countries. Dale Carnegie Training is a registered trademark of Dale Carnegie and Associates, Inc. ECCO is a trademark of NetManage Inc. ExpensAble is a registered trademark of Managemark, Inc. Palm is a trademark of Palm, Inc. GoldMine is a trademark of Goldmine Software Corp. Janna Contact is the exclusive property of Janna Systems Inc. Maximizer is a registered trademark of Modatech Systems Inc. Lotus Organizer is a trademark of Lotus Development Corporation. Quicken is a registered trademark of Intuit, Inc. Sidekick is a trademark of Starfish Software. Sharkware is a trademark of CogniTech Corporation. Tracker is a trademark of Softcode Pty Ltd. Yahoo! is a registered trademark of Yahoo! Inc. WordPerfect is a registered trademark of Novell, Inc. CompuServe is a registered trademark of CompuServe, Inc., and its affiliates. cc:Mail and cc:Mail Mobile are trademarks of cc:Mail, Inc., a wholly owned subsidiary of Lotus Development Corporation. Day Runner is a registered trademark of Day Runner, Inc. Day-Timer is a registered trademark of Day-Timers, Inc. Netscape is a trademark of Netscape Communications Corporation. Portions of ACT! are Copyright 1995 by Streetwise Software. All rights reserved.

Other product names mentioned in this manual may be trademarks or registered trademarks of their respective companies and are the sole property of their respective manufacturers.

Printed in the United States of America.

10  9  8  7  6  5   4  3  2  1