• Welcome to Theos PowerBasic Museum 2017.

External function sendmessage to a callback function...

Started by David Marco, November 04, 2008, 06:45:50 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

David Marco

Hi José,

I'm trying to do a special kind of dll using your TB_DHTMLED headers and samples, in order to create a NeoBook plugin.

At this moment, I can create the dialogs within a rectangle, and close them.

Now, I'm working to recreate the callback cases as external functions, for example, the "Open" button  as independient function...

Following this sample I created this function:

FUNCTION AE_HTML_Open (a AS ASCIIZ) EXPORT as LONG
 sendmessage hDlgMain ,%WM_COMMAND, %IDM_OPEN, %True
END FUNCTION

But nothing works.

Could you tell me what is wrong ?

Thanks in advance,
David de Argentina

Paul Squires

You are not sending the WM_COMMAND message correctly. Try this:


SendMessage hDlgmain, %WM_COMMAND, MakLng(%IDM_OPEN, 0), %Null


...or if you know the hWnd of the Open button (I assume that %IDM_OPEN is the control identifier for the open button).


hWndControl = GetDlgItem( hDlgMain, %IDM_OPEN)
SendMessage hDlgmain, %WM_COMMAND, MakLng(%IDM_OPEN, 0), hWndControl

Paul Squires
FireFly Visual Designer SQLitening Database System JellyFish Pro Editor
http://www.planetsquires.com

Paul Squires

The previous post also assumes that "hDlgMain" is a global variable that holds the main dialog's window handle. It does, right?

Paul Squires
FireFly Visual Designer SQLitening Database System JellyFish Pro Editor
http://www.planetsquires.com

José Roca

 
Also, to use COM in a DLL, the COM library must be initialized using CoInitialize BYVAL %NULL before doing any COM call (a good place could be before creating the dialog), and uninitialize it calling CoUninitialize when done, e.g. when closing the dialog.

David Marco

Thanks José and Paul, is working now..

By the way...

I'm trying to add the tables services, based on your TB_HTMLED11 sample.
I put this lines of code:

FUNCTION AE_HTML_AddTable (a AS ASCIIZ) EXPORT AS STRING
IDEInsertTableParam_SetNumRows pEdHtml, 3
IDEInsertTableParam_SetNumRows pEdHtml, 4
IDEInsertTableParam_SetTableAttrs pEdHtml, "width=100%"
IDEInsertTableParam_SetCellAttrs pEdHtml, "nowrap"
IDHTMLEdit_ExecCommand pEdHtml, %DECMD_INSERTTABLE, %OLECMDEXECOPT_DODEFAULT
UpdateWindow hEdHtml
...
END FUNCTION

But doesn't work...
Any ideas ?

Thanks in advance,
David de Argentina

José Roca

 
You need to create an instance of the InsertTableParam interface.


   LOCAL pInsertTableParam AS DWORD
   LOCAL vInsertTableParam AS VARIANT
   LOCAL pv AS VARIANTAPI PTR

   pInsertTableParam = DHTMLEditCreateObject("{47B0DFC7-B7A3-11D1-ADC5-006008A5848C}"))
   IF ISFALSE pInsertTableParam THEN EXIT FUNCTION
   pv = VARPTR(vInsertTableParam)
   @pv.vt = %VT_DISPATCH
   @pv.vd.pdispVal = pInsertTableParam
   DHTMLEditAddRef pInsertTableParam

   IDEInsertTableParam_SetNumRows pInsertTableParam, 4
   IDEInsertTableParam_SetNumCols pInsertTableParam, 3
   IDEInsertTableParam_SetTableAttrs pInsertTableParam, "width=100%"
   IDEInsertTableParam_SetCellAttrs pInsertTableParam, " bgcolor=" & $DQ & "blue" & $DQ & " noWrap"

   IDHTMLEdit_ExecCommand pEdHtml, %DECMD_INSERTTABLE, %OLECMDEXECOPT_DODEFAULT, vInsertTableParam

   vInsertTableParam = EMPTY
   DHTMLEditRelease pInsertTableParam