English

Error: ArcPad is not running

Error Message

When clicking 'Send Script...' in ArcPad Studio, the following error message displays:
"ArcPad is not running".

Cause

The ArcPad Windows class name has changed in ArcPad 8.0.

Solution or Workaround

Follow the methods described here for communication between ArcPad and a third party application. The goal of each method is to obtain a window handle for one or both applications.

A window handle is a unique number that identifies each window on the Windows operating system and can be used by the Windows Messaging API to send events and data to any window.

Methods for obtaining window handles are outlined as follows:

Enumerating Windows
This is one of the most robust ways to obtain the window handle from another process. The general approach involves finding a process ID of interest and enumerating all top-level windows. The window handle is obtained by converting it to a process ID and matching this value to the known process ID. A developer sample on how to do this in C++ and MFC (Microsoft Foundation Class) can be found in ArcPad 8.0 hot fix (build number 8.0.1) under the <ArcPad Install Folder>/Developer/Samples/ArcPadFinder/ folder. In this folder, Readme.pdf contains instructions on how to build, run, and use the sample.

Windows Message Handshaking
Windows messaging is supported by the ArcPad object model and therefore can be used to achieve interprocess communication. A handshaking approach uses these steps:
1. The third party application sends out a broadcast message that all top-level windows receive but only ArcPad recognizes and knows how to process. ArcPad implements an ExEvent handler in an applet to catch this message. The broadcast message contains the third party application window handle which ArcPad stores.
2. ArcPad then acknowledges that it has received the broadcast message by sending an acknowledgement message back to the third party application. This message is sent only to the third party application using the specific third party application window handle and is not broadcast. The third party application stores the ArcPad handle sent in the acknowledgement message.
3. Both ArcPad and the third party application now have each other’s window handle and can communicate.

Windows API Function FindWindow
The Windows API function FindWindows can be used to find any window if the window's title name and/or class name is known. In MFC 9.0, the class name is intentionally mangled and is therefore difficult to use for finding a target window. This function will still find a window based on the window title name but cannot be used to find the ArcPad window because the ArcPad title changes according to the currently loaded map. The usefulness of this method is therefore restricted.

System.Diagnostics.Process Class in the .NET Framework
In the .NET Framework, the Process class provides a method of obtaining a window handle on the desktop platform. See documentation for this utility class in the Microsoft .NET Framework Developer Center. The process class is also supported on the .NET Compact Framework for mobile devices but can only be used to find the window handle of the calling process. Therefore, it cannot be used to achieve interprocess communication on mobile devices.

Window Handle Passed as a Command Line Parameter
A method of exchanging the ArcPad windows handle with a third party applications is to start the application from an ArcPad applet. The ArcPad handle can then be passed to the third party application as a command line parameter. Code in the DotNetIntegration sample project (<ArcPad Install Path>\Developer\Samples\DotNetIntegration) demonstrates this method. A disadvantage with the technique is that the third party application must be started from within ArcPad and requires a special applet configuration.

Window Handle Persistence to File
Another method of exchanging the ArcPad windows handle with a third party applications is to persist the window handle to file. ArcPad would be configured with a script that executes on start up and writes the ArcPad window handle to a known file. The third party application would then open this file to discover the ArcPad handle. The file would be deleted when ArcPad closes. This approach is likely to be error prone and is not a recommended method. Applications may attempt to open the file at the same time and data become out of sync with the state of an application.