skip to Main Content

TextDynamic as Popup Editor (wptextCreateDialog)

Do you have a C++Program which you need a powerful Editor for?
Or do you sell a database application which needs an new editing popup dialog.
With TextDynamic You can add a powerful editor with only a few lines of code.
To do so, the DLL exports a single procedure to create a complete editor window.
There are still various possibilities to customize the editor. Only the DLL is used in this case, no ActiveX or .NET wrapper.
This method has been created to allow editing fast, with a minimum programming interface.

Editor – created with a few lines of code in VS C+
1) Initialisation – C++
Later, in
this code is executed:

1) Creation of editor
 3) Sizing of the editor
 4) Send commands to editor

Using the editor window handle, it is also possible to send commands to the editor using SendMessage.
Especially easy to use are the “wpa Action” names.
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

This pascal code will show the file open dialog:

SendMessage(EditorHwnd, 1051, Integer(PChar(‘diaOpen’)), 0);

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

This 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

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”));
You can also use the COM interface IWPMemo.
This commands are used to retrieve a reference to the respective interface:
WPDLL_COM_Memo1 = 145; // Result := IWPMemo of Editor 1
WPDLL_COM_Memo2 = 146; // Result := IWPMemo of Editor 2

The definition of the Interfaces (TLB) is included in the TextDynamic OCX. You can import this TLB into Your project and autogenerate a the definition code.
Other commands are available on request.

Back To Top