Use WPA Actions with Editor

[Top]  [Chapter]  [Previous]  [Next]

Using the editor window handle, it is also possible to send commands to the editor using the window API SendMessage.

 

Very easy to use are the "wpa Actions".

 

Simply use this message IDs to send the action names to the current, the first or the second editor.

 

WMP_WPA_PROCESS       = 1051; // wparam= char *wpaAction, lparam=parama  - for current editor

WMP_WPA_PROCESS_1     = 1052; // wparam= char *wpaAction, lparam=parama  - for editor #1

WMP_WPA_PROCESS_2     = 1053; // wparam= char *wpaAction, lparam=parama  - for editor #2

 

You can use all "wpa" action names, such as "diaOpen", "diaSave" etc. See complete List.

 

This pascal code will show the file open dialog:

 

SendMessage(EditorHwnd, 1051,  Integer(PChar('diaOpen')), 0); 

 

the same in C++:

 

SendMessage(edhwnd, 1051, (int)((char *)"diaOpen"), 0); 

 

In c++ You can add this code into the message loop to attach load and save menu items.

 

  clip0202

 

 case WM_COMMAND:

         wmId    = LOWORD(wParam);

         wmEvent = HIWORD(wParam);

         switch (wmId)

         {

         case ID_FILE_LOAD:

                 SendMessage(edhwnd, 1051, (int)((char *)"diaOpen"), 0);

                 break;

          case ID_FILE_SAVE:

                 SendMessage(edhwnd, 1051, (int)((char *)"diaSaveAs"), 0);

                 break;

 


[send_commands_to_editor.htm]    Copyright © 2007 by WPCubed GmbH