Use Commands

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

Above we described how to use wpa Actions.

 

But You can also use one of the many commands which execute code directly.

 

These message IDs will be useful to send other commands

 

WMP_EDCOMMAND = 1040; // wparam=commandid, lparam=parameter for EDITOR A

WMP_EDbCOMMAND = 1041; // wparam=commandid, lparam=parameter for EDITOR B

WMP_EDCOMMANDSTR = 1042; // wparam=commandid, lparam=char* for EDITOR A

WMP_EDbCOMMANDSTR = 1043; // wparam=commandid, lparam=char* for EDITOR A

WMP_EDUCOMMANDSTR = 1044; // wparam=commandid, lparam=widechar* for EDITOR A

WMP_EDUbCOMMANDSTR = 1045; // wparam=commandid, lparam=widechar* for EDITOR B

 

For example You can use this command IDs to load and save directly to a file:

 

WPDLL_COM = 9000; 

WPDLL_COM_TEXT_LOADFILE     = WPDLL_COM + 26; // buffer1=filename, buffer2=format, param=1 for 'Insert'

WPDLL_COM_TEXT_SAVEFILE     = WPDLL_COM + 27; // buffer1=filename, buffer2=format, param=1 for SelectionOnly

WPDLL_COM_TEXT_LOADSTR      = WPDLL_COM + 28; // buffer1=str, buffer2=format, param=1 for 'Insert'

WPDLL_COM_TEXT_SAVESTR      = WPDLL_COM + 29; // out: datastring, buffer2=format, param=1 for SelectionOnly

 

Example - load the file c:\test.rtf into the editor.

 

SendMessage(edhwnd, 1042, 9026,(int)((char *)"c:\\TEST.RTF"));

 

To work with a unicode (wide char) parameter use

 

SendMessage(edhwnd, 1044, 9026,(int)((widechar *)"c:\\TEST.RTF"));

 

 

//Set the inital directory for text and graphic

SendMessage(edhwnd, 1042, WPDLL_COM_INITIALDIR, (int)((char *)"c:\\temp"));

 

SendMessage(edhwnd, 1042, WPDLL_COM_INITIALGRAPHICDIR, (int)((char *)"c:\\temp"));

 

 

// Retrieve the current "InitialDir"

SendMessage(edhwnd, 1042, WPDLL_COM_INITIALDIR, 0);


[use_commands.htm]    Copyright © 2007 by WPCubed GmbH