#include <hbvm.h>
void __declspec(dllexport) RcvProcedure( char * szXML, LONG lSize )
{
hb_vmPushSymbol( hb_dynsymGetSymbol( "CALLBACK" ) ); // we push the symbol of the function to call
hb_vmPushNil(); // we push nil for a function, a codeblock for Eval, an object for a method
hb_vmPushString( szXML, strlen( szXML ) );
hb_vmPushLong( lSize );
hb_vmFunction( 2 ); // two parameters supplied to CallBack()
}
function CallBack( cXML, nSize )
MsgInfo( cXML, "It works!" )
return nil
procedure CalledBack(PC: PChar);
var
sDocType, sText :String;
iX :Integer;
XmlList :TXmlNodeList;
begin
with Form1 do
begin
Memo1.Text := Form1.Memo1.Text + String(PC);
Inc(Form1.FCount);
lblDLLStatus.Caption := IntToStr(Form1.FCount);
iX := Pos('Hello', String(PC));
if (iX > 40) AND (iX < 60) then
begin
xmlObject.ClearDocument;
xmlObject.LoadMemory(PC);
sDocType := Trim(xmlObject.Document.DocumentElement.TagName);
if sDocType = 'Hello' then
begin
XmlList :=
xmlObject.Document.DocumentElement.SelectNodes('Win32WindowHandle');
if XmlList.Length > 0 then //need to tranlate AAIA code
begin
sText := TXmlElement(XmlList.Item(0)).ElementText;
try
FServerHandle := StrToInt(sText);
lblSetFocus.Font.Color := clBlue;
except
FServerHandle := 0;
end;
XmlList.Free;
end;
end;
end;
end;
end; {CalledBack}
Sub CalledBack(ByVal lpszXMLDoc As Long)
Dim sXMLDoc As String
Dim iLen As Integer
iLen = lstrlen(lpszXMLDoc)
sXMLDoc = String$(iLen, 0)
Call lstrcpy(sXMLDoc, lpszXMLDoc)
Form1.Text1.Text = sXMLDoc
End Sub
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 56 guests