Przemysław Czerpak wrote:
> 
> I have no idea what exactly IsExportedSymbol() and OleServerSymbols()
> does in xHarbour. I can guess but I do not know the exact syntax.
> If you want then I can implement in Harbour compatibility layer but
> I would have to know xHarbour COM server user API.
> Now all I know about OLE in xHarbour.com comes from this page:
>    http://xharbour.com/index.asp?page=add_on_oleserver&show_sub=7&show_i=1
> 

No, we must not replicate it.

It was described as such to build an ole object and I just copied 
it and pasted. This server was last compiled somewhere in 2006.
Then I could never compile it with later xhb.com distros.
So I never tried it again.

I just showed you the code.




> So in xHarbour DllMain() PRG function is executed just like in C.
> In the code I committed it's executed only when DLL is loaded and
> it should set at least server ID and name:
> 
>    WIN_OleServerInit( CLS_ID, CLS_Name )
> 
> Please note that CLS_ID and CLS_Name are PRG level #define values.
> 

Yep, I got it.



>> FUNCTION CreateInstance()
>>    LOCAL oOleServer := Vouch32ActiveX()
>>    ErrorBlock( {|e| Break( e ) } )
>>    Return oOleServer
> 
> Next interesting extension. I guess that xHarbour checks if
> public function CreateInstance() exists and if yes the call
> it to create new OLE object. Has xHarbour other "special"
> functions which are used by OLE server code?
> 

No other functions. All is there in this code.



> In harbour you can reach the same functionality by passing
> pointer to Vouch32ActiveX object to WIN_OleServerInit(), i.e.:
>    WIN_OleServerInit( CLS_ID, CLS_Name, Vouch32ActiveX() )
> Vouch32ActiveX object does not use any instance variables
> so you can share the same object between many OLE objects.
> If you want to create new Vouch32ActiveX object for each
> OLE object then you should use codeblock as 3-rd
> WIN_OleServerInit() parameter which creates and returns such
> object, i.e.:
>    WIN_OleServerInit( CLS_ID, CLS_Name, {|| Vouch32ActiveX() } )
> 

Codeblock approach is better always, so I will call it like this always.




> It's not clear for me why you set errorBlock() inside this
> function and not in DllMain().
> 

I do not remember now. Infact I am looking at this prg after about 
3 years if I can remember correctly.



>> CLASS Vouch32ActiveX
>>    METHOD Vouch32Miscll()
>>    METHOD Vouch32SetClientConsole()
>>    METHOD Vouch32ServerPath()
>>    METHOD Vouch32SetLicenseKey()
> [...]
>>    ENDCLASS
>> METHOD Vouch32SetClientConsole CLASS Vouch32ActiveX
>>    Return V32SetClient( .t. )
>> METHOD Vouch32ServerPath() CLASS Vouch32ActiveX
>>    Local c
>>    c := Vwn_GetModuleFileName( Vwn_GetModuleHandle() )
>>    c := substr( c,1,rat( '\',c )-1 )
>>    Return c
>> METHOD Vouch32SetLicenseKey( cKey ) CLASS Vouch32ActiveX
>>    VouchSetLicKey( cKey )
>>    Return Self
>> METHOD Vouch32PrintServer() CLASS Vouch32ActiveX
>>    Return V32PrintPreview()
>> METHOD Vouch32CommServer() CLASS Vouch32ActiveX
>>    Return V32CommServer()
>> METHOD Vouch32GraphicsServer() CLASS Vouch32ActiveX
>>    Return V32Charts()
> [...]
> 
> I guess that functions like V32PrintPreview() or V32CommServer()
> returns object and this objects are then used by other code as
> OLE objects. If V32PrintPreview() returns regular HVM object
> (is it true?) then xHb automatically translates it to OLE object.
> I haven't added such functionality but I can easy implement it.
> It seems to be interesting extension. Anyhow I would like to know
> if I guessed correctly.
> 

V32PrintPreview() returns a class object instance and it then 
is accessed via its own methods and properties. Like it:

oServer := CreateObject( "Vouch... " )

oPrint := oServer:VewPrintPreview()
oPrint:setPageSize( "A4" )  // oPrint is accesses as an object 




> olesrv2.prg uses such hash array. But before you begin to
> change your code then I would like to know what API you
> used in xHarbour and maybe I'll create sth similar to reduce
> number of necessary modifications.
> 

I showed the converted code.
The return value of a method of main ole object is NIL.
This is where I am struck.



> For sure I do not plan to introduce as user API any C code
> encapsulated in #pragma BEGINDUMP/ENDDUMP or similar hacks
> but maybe many other things can be implemented.
> 

Not necessary at all.
User does not even required to know them.


-----
     enjoy hbIDEing...
        Pritpal Bedi 
http://hbide.vouch.info/
-- 
View this message in context: 
http://harbour-devel.1590103.n2.nabble.com/SF-net-SVN-harbour-project-14593-trunk-harbour-tp5100733p5101327.html
Sent from the harbour-devel mailing list archive at Nabble.com.
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to