On Tue, 25 May 2010, Pritpal Bedi wrote: Hi,
> Below is the converted code which registers itself successfully. > --------------------------------------------- > #define CLS_Name "Vouch32.Vouch.1" > #define CLS_ID "{1F6C0963-1581-498a-9035-E75A0F546CA5}" > //-------------------------------------------------------------------// > PROCEDURE DllMain() > WIN_OleServerInit( CLS_ID, CLS_Name, {|| Vouch32ActiveX():new() }, .t. ) > RETURN [...] Why you added .T. as 4-th parameter? It means that all OLE messages will be redirected to your object as string 1-st parameter in EVAL() method. It's necessary when you want to accept any message names like in olesrv1.prg which is NETIO OLE server but your Vouch32ActiveX() does not even have EVAL message: > Error BASE/1004 Message not found: VOUCH32ACTIVEX:EVAL > Called from __ERRRT_SBASE(0) Server > Called from VOUCH32ACTIVEX:ERROR(0) nication > Called from (b)HBOBJECT(0) ial Communication II > Called from VOUCH32ACTIVEX:MSGNOTFOUND(0) > Called from (b)EVAL(0) SMTP Server You should simply use: WIN_OleServerInit( CLS_ID, CLS_Name, {|| Vouch32ActiveX():new() } ) or because Vouch32ActiveX object does not have any instance variables to safe some memory and increase a little bit the speed you can use only one HVM Vouch32ActiveX object for all OLE object: WIN_OleServerInit( CLS_ID, CLS_Name, Vouch32ActiveX():new() ) Both versions will work for you. > But the problem is when I am accessing its methods as such: > Function Main() > Local oGraph, oServer > if !( CreateVouch32( @oServer ) ) > Return nil > endif > oGraph := oServer:Vouch32GraphicsServer() /* IT IS OK HERE */ > oGraph:Create() /* RTE - See Below */ > oGraph:Destroy() > Return nil I think the RTE is in this line: oGraph := oServer:Vouch32GraphicsServer() /* IT IS OK HERE */ If you remove the 4-rd .T. parameter from WIN_OleServerInit() then this line will work successfully but your code will fail in this line: oGraph:Create() /* RTE - See Below */ because oGraph is NIL not OLE object. It will happen because I haven't implemented so far automatic conversion of HVM object returned by OLE methods to OLE objects. Is above description correct? best regards, Przemek _______________________________________________ Harbour mailing list (attachment size limit: 40KB) Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour