call Harbour from c++

call Harbour from c++

Postby don lowenstein » Tue Apr 02, 2013 10:40 pm

Is it possible to call a Harbour function from c++ source code?
I have syntax for c-style coding. I'm trying to code an event function to monitor a secure SSL socket.

i wish for my harbour program to use the callback function below, and it will happen with the precursor call here:
nResult = HttpRegisterEvent(hClient, 0xFFFF, MyEventHandler, 0);


Here is the actual event handler where I need to execute Harbour code, namely a function called SSL_EVENTS which is compiled with Harbour 3.2 and FWH 1302 and BCC.

VOID CALLBACK MyEventHandler(HCLIENT hClient, UINT nEventId, DWORD dwError, DWORD_PTR dwParam)
{
switch (nEventId)
{
case HTTP_EVENT_CONNECT:
// Connection has been established

CAN I CALL A HARBOUR EVENT HANDLER FROM HERE?
IF SO, HOW DO i CONSTRUCT THE .C SOURCE CODE TO COMPILE PROPERLY?
ALSO, HOW TO CODE THE CALL TO THE BELOW FUNCTION FROM WITHIN HARBOUR?

break;

// Additional case statements ...
}
}


Any ideas?
Don Lowenstein
www.laapc.com
User avatar
don lowenstein
 
Posts: 197
Joined: Mon Oct 17, 2005 9:09 pm

Re: call Harbour from c++

Postby Antonio Linares » Wed Apr 03, 2013 8:13 am

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42117
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: call Harbour from c++

Postby don lowenstein » Thu Apr 04, 2013 2:39 am

Hi Antonio.

I have completed my HTTPS-SSL secure connection posting data to/from a server on a secured connection using "odd" encoding requrements.

thank you so much for your help.

I used a library from Socket Tools and it worked like a charm.

if you wish I can share the basic flow. i think that your magical c++ and Harbour skills could incorporate an SSL class derived from tSocket. that's what I essentially did. only, I replaced your connect, senddata, recvdata methods with new ones. also, I used a synchronous connection and therefore did not need event notification and no requirement for an owner window to receive messages.

thanks again and thank you for 10 years of providing excellent products and support to me.

don
Don Lowenstein
www.laapc.com
User avatar
don lowenstein
 
Posts: 197
Joined: Mon Oct 17, 2005 9:09 pm

Re: call Harbour from c++

Postby Antonio Linares » Thu Apr 04, 2013 8:14 am

Don,

if you wish I can share the basic flow


yes, please. thanks :-)

i think that your magical c++ and Harbour skills could incorporate an SSL class derived from tSocket. that's what I essentially did. only, I replaced your connect, senddata, recvdata methods with new ones. also, I used a synchronous connection and therefore did not need event notification and no requirement for an owner window to receive messages.


I will review your code and will do my best to build such Class, thanks. Surely many users will benefit from it :-)

thanks again and thank you for 10 years of providing excellent products and support to me.


My pleasure. I feel honored having such great friends all around the world. A true blessing :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42117
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Silvio.Falconi and 45 guests

cron