Online Book Reader

Home Category

Access Cookbook - Ken Getz [266]

By Root 2063 0

Required?

Used in sample?

Description

CmdLine

Yes

Yes

Command line to run the application. Must be at least the executable filename, but can also include parameters as necessary.

Name

No

Yes

Name that appears below the icon in the group.

IconPath

No

No

Name and path of the icon file to use. If an executable file is specified, use the first icon in that file. If left blank, use the first icon in the executable file specified in the CmdLine parameter.

IconIndex

No

No

Index of the icon in the specified IconPath file (or the specified executable). Otherwise, if missing, use the first icon specified.

Xpos

No

No

X-position of the icon within the group, as an integer. Both this and Ypos are required to set the specific position. If left blank, use the next available position.

Ypos

No

No

Y-position of the icon within the group, as an integer.

DefDir

No

Yes

Default (or working) directory for the application.

HotKey

No

No

Hot key for this application, stored as an integer.

fMinimize

No

Yes

Run Minimized (1 = True, 0 = False).

fSeparateMemSpace

No

No

In Windows NT only, run the application in a separate memory space (applies to 16-bit applications only).

SWITCHING FOCUS

Using the ShowGroup command sometimes moves the focus to the shell but usually does not. Whether the focus switches depends on the state you request for the program group and on its current state. Though you could make a matrix of options, comparing current states (minimized, normal, or maximized) against the new window state (1-8, as in Table 12-8), the rules are quite simple. If you change the state of a group that's currently minimized, the focus will switch to the shell. That means that if you choose actions 1, 3, or 4 for a group that is currently minimized, the shell will grab the focus. You can try this yourself, calling the acbPMShowGroup function and passing it the name of a group and a new window style.

Table 12-8. Window style command values for the ShowGroup function

Window style value

Action

1

Activate and display the group window. If it was minimized or maximized, restore it to its original position (normalized).

2

Activate the group window and display it as an icon.

3

Activate the group window and display it maximized.

4

Display the group window normalized and leave the current group selected.

5

Activate the group window and display it in its current placement.

6

Minimize the group window.

7

Minimize the group window and leave the current group selected.

8

Display the group window in its current placement and leave the current group selected.

Using the wrapper procedures


To make your DDE programming simpler, the module basShell includes wrapper procedures that handle all the details for you. (Table 12-4 provides a description of each of the wrapper procedures; Table 12-9 lists the parameters.) The module also provides functions that handle each of the commands described in Table 12-6. In some cases (AddItem, for example), the wrapper functions don't allow you to specify all the possible parameters for the command string. If you find these wrapper functions too limiting, you can modify them so they allow you to pass in whatever parameters you like.

All the wrapper procedures (except acbPMShowMessages) in Table 12-9 perform the same set of steps to communicate with the Windows shell. To simplify the code and centralize error handling, those steps have been pulled into a single private procedure in basShell, DDEExecutePM, which is shown in the following code example:

Private Function DDEExecutePM(strCommand As String) As Boolean

' DDEExecute with the passed-in command. If it succeeds,

' return True. If it fails, return False.

' At this point, this function handles error messages itself.

' You could move this out of here to a higher level, if you

' want, by setting the SHOW_MESSAGES constant to False.

Dim lngChannel As Long

On Error GoTo HandleErr

lngChannel = DDEInitiate("PROGMAN", "PROGMAN")

DDEExecute lngChannel, strCommand

Return Main Page Previous Page Next Page

®Online Book Reader