FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour ToleAuto / OleWevent
Posts: 603
Joined: Sun May 04, 2008 08:44 PM
ToleAuto / OleWevent
Posted: Sun Aug 16, 2009 02:58 AM
SomeOne can help solve this problem...

It´OK.
Code (fw): Select all Collapse
#include "Fivewin.ch"
function main()
 public ownd, oOle
 public left:=0, Top:=0, Right:=0, Bottom:=0
 define window ownd
 oOle:=ToleAuto():new("Codejock.CommandBars.13.0.0")
 cToolA:=oOle:Invoke("Add","ToolBar", 0)
 cToolB:=oOle:Invoke("Add","ToolBar", 0)
 cToolC:=oOle:Invoke("Add","ToolBar", 0)
 OleInvoke(cToolB,"GetWindowRect",@Left, @Top, @Right, @Bottom)
 Activate Window oWnd
Return nil


Now trying use ToleWevent...

Code (fw): Select all Collapse
#include "Fivewin.ch"
function main()
 public ownd, oOle
 public left:=0, Top:=0, Right:=0, Bottom:=0
 define window ownd
 oOle:=oleWevent():new(oWnd,"Codejock.CommandBars.13.0.0")
 uOle:=oOle:oOle // <-- here is ToleAuto create in class OleWevent
 cToolA:=uOle:Invoke("Add","ToolBar", 0)
 cToolB:=uOle:Invoke("Add","ToolBar", 0)
 cToolC:=uOle:Invoke("Add","ToolBar", 0)
 OleInvoke(cToolB,"GetWindowRect",@Left, @Top, @Right, @Bottom) // error this line
 Activate Window oWnd
Return nil


Link Class ToleEvent:
http://www.redstarsoft.com.br/oOle.rar
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: ToleAuto / OleWevent
Posted: Sun Aug 16, 2009 06:31 AM

Lailton,

> OleInvoke(cToolB,"GetWindowRect",@Left, @Top, @Right, @Bottom) // error this line

What error do you get ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 603
Joined: Sun May 04, 2008 08:44 PM
Re: ToleAuto / OleWevent
Posted: Sun Aug 16, 2009 03:39 PM
Antonio,



I can´t understand because give me this erro. :-)
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: ToleAuto / OleWevent
Posted: Sun Aug 16, 2009 05:13 PM

Lailton,

Are you using Harbour or xHarbour ?

If Harbour, is it current SVN version ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 603
Joined: Sun May 04, 2008 08:44 PM
Re: ToleAuto / OleWevent
Posted: Sun Aug 16, 2009 05:20 PM

Antonio,

yo uso somiente XHARBOUR

estoy con:
Fivewin 902 y xHarbour 1.1.0 + Bcc55

Gracias.

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: ToleAuto / OleWevent
Posted: Sun Aug 16, 2009 07:42 PM

Lailton,

If you remove "@" from this line:

OleInvoke(cToolB,"GetWindowRect",@Left, @Top, @Right, @Bottom)

do you still get the GPF ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: ToleAuto / OleWevent
Posted: Sun Aug 16, 2009 07:53 PM
Lailton,

Please add this code to your PRG and try it again:
Code (fw): Select all Collapse
function OleInvoke( hObj, cMethod, ... )

#ifndef __XHARBOUR__
   return __ObjSendMsg( TOleAuto():New( hObj ), cMethod, ... )
#else   
   local aParams := hb_aParams()

   aParams[ 1 ] = TOleAuto():New( hObj )

   return hb_execFromArray( @__ObjSendMsg(), aParams )   
#endif 

function OleSetProperty( hObj, cPropName, uValue )

return __ObjSendMsg( TOleAuto():New( hObj ), "_" + cPropName, uValue )

function OleGetProperty( hObj, cPropName )

return __ObjSendMsg( TOleAuto():New( hObj ), cPropName )
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 603
Joined: Sun May 04, 2008 08:44 PM
Re: ToleAuto / OleWevent
Posted: Sun Aug 16, 2009 08:18 PM
Antonio,

Erro when i try compile...

Code (fw): Select all Collapse
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
OleWEvents0.c:
xHarbour Compiler build 1.1.0 (SimpLex) (Rev. 6195)
Copyright 1999-2008, http://www.xharbour.org <!-- m --><a class="postlink" href="http://www.harbour-project.org/">http://www.harbour-project.org/</a><!-- m -->
Compiling 'DEMO.PRG'...

DEMO.PRG(18) Error E0030  Syntax error: "syntax error at '...'"

DEMO.PRG(23) Error E0004  LOCAL declaration follows executable statement

2 errors

No code generated


i need add someone include ?

thanks
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: ToleAuto / OleWevent
Posted: Sun Aug 16, 2009 08:23 PM

It seems as your xHarbour version does not support "...", more recent builds support it.

Just for a test, please replace "..." with "u1, u2, u3, u4"

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 603
Joined: Sun May 04, 2008 08:44 PM
Re: ToleAuto / OleWevent
Posted: Sun Aug 16, 2009 08:27 PM
Antonio,

This erro now
Code (fw): Select all Collapse
Application
===========
   Path and name: C:\oOle\demo.exe (32 bits)
   Size: 1,662,976 bytes
   Time from start: 0 hours 0 mins 0 secs 
   Error occurred at: 08/16/09, 17:26:21
   Error description: Error TOleAuto/-1  Invalid argument to contructor!: TOLEAUTO:NEW
   Args:
     [   1] = O   Object

Stack Calls
===========
   Called from:  => THROW(0)
   Called from: source\rtl\win32ole.prg => TOLEAUTO:NEW(373)
   Called from: DEMO.PRG => OLEINVOKE(25)
   Called from: DEMO.PRG => MAIN(12)


demo.prg
Code (fw): Select all Collapse
#include "Fivewin.ch"

function main()

 public ownd, oOle
 public Rb
 public left:=0, Top:=0, Right:=0, Bottom:=0
 define window ownd color 0,0
 oOle:=OleWEvent():new(ownd,"Codejock.CommandBars.13.0.0",0,0,oWnd:nRight,oWnd:nBottom)
 cToolA:=oOle:Add("ToolBar", 0)
 cToolB:=oOle:Add("ToolBar", 0)

 OleInvoke(cToolB,"GetWindowRect",@Left, @Top, @Right, @Bottom) // error this line
  // <-- error this line yet, toolbar is created OK more oleinvoke give me erro.
 Activate Window oWnd

Return nil

function OleInvoke( hObj, cMethod, u1, u2, u3, u4 )
return __ObjSendMsg( TOleAuto():New( hObj ), cMethod, u1, u2, u3, u4 )

function OleSetProperty( hObj, cPropName, uValue )
return __ObjSendMsg( TOleAuto():New( hObj ), "_" + cPropName, uValue )

function OleGetProperty( hObj, cPropName )
return __ObjSendMsg( TOleAuto():New( hObj ), cPropName )
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: ToleAuto / OleWevent
Posted: Sun Aug 16, 2009 10:36 PM

Lailton,

Use it this way:

OleInvoke( cToolB:hObj, "GetWindowRect",@Left, @Top, @Right, @Bottom)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 603
Joined: Sun May 04, 2008 08:44 PM
Re: ToleAuto / OleWevent
Posted: Sun Aug 16, 2009 10:53 PM
Antonio,

Code (fw): Select all Collapse
Application
===========
   Path and name: C:\oOle\demo.exe (32 bits)
   Size: 1,662,976 bytes
   Time from start: 0 hours 0 mins 0 secs 
   Error occurred at: 08/16/09, 19:53:55
   Error description: Error 16507216/3  DISP_E_MEMBERNOTFOUND: GETWINDOWRECT
   Args:
     [   1] = N   0
     [   2] = N   0
     [   3] = N   0
     [   4] = N   0

Stack Calls
===========
   Called from: source\rtl\win32ole.prg => TOLEAUTO:GETWINDOWRECT(0)
   Called from:  => __OBJSENDMSG(0)
   Called from: DEMO.PRG => OLEINVOKE(22)
   Called from: DEMO.PRG => MAIN(14)


PRG
Code (fw): Select all Collapse
#include "Fivewin.ch"

function main()

 public ownd, oOle
 public Rb
 public left:=0, Top:=0, Right:=0, Bottom:=0
 define window ownd color 0,0
 oOle:=OleWEvent():new(ownd,"Codejock.CommandBars.13.0.0",0,0,oWnd:nRight,oWnd:nBottom)

 cToolA:=oOle:Add("ToolBar", 0)
 cToolB:=oOle:Add("ToolBar", 0)

 OleInvoke( cToolB:hObj, "GetWindowRect",@Left, @Top, @Right, @Bottom)

 Activate Window oWnd

Return nil

function OleInvoke( hObj, cMethod, ua1, ua2, ua3, ua4 )
return __ObjSendMsg( TOleAuto():New( hObj ), cMethod, ua1, ua2, ua3, ua4 )

function OleSetProperty( hObj, cPropName, uValue )
return __ObjSendMsg( TOleAuto():New( hObj ), "_" + cPropName, uValue )

function OleGetProperty( hObj, cPropName )
return __ObjSendMsg( TOleAuto():New( hObj ), cPropName )


:-)
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: ToleAuto / OleWevent
Posted: Sun Aug 16, 2009 11:06 PM

Please try this with both FWH TActiveX and your Class:

MsgInfo( cToolB:cClassName )

Lets see if they are the same object class.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 603
Joined: Sun May 04, 2008 08:44 PM
Re: ToleAuto / OleWevent
Posted: Sun Aug 16, 2009 11:23 PM
OleWevent -> 16467048:ADD
TactiveX -> 16439752

Code (fw): Select all Collapse
#include "Fivewin.ch"
function main()
 public ownd, oOle
 public left:=0, Top:=0, Right:=0, Bottom:=0
 define window ownd color 0,0
// oOle:=OleWEvent():new(ownd,"Codejock.CommandBars.13.0.0",0,0,oWnd:nRight,oWnd:nBottom)
 oOle:=TactiveX():New(ownd,"Codejock.CommandBarsFrame.13.0.0")
 cToolA:=oOle:Do("Add","ToolBar",0)
 cToolB:=oOle:Do("Add","ToolBar",0)
 cToolB:GetWindowRect(@Left, @Top, @Right, @Bottom) // <-- funciona bem
 MsgInfo( cToolB:cClassName )

 Activate Window oWnd

Return nil

/*
function OleInvoke( hObj, cMethod, ua1, ua2, ua3, ua4 )
return __ObjSendMsg( TOleAuto():New( hObj ), cMethod, ua1, ua2, ua3, ua4)

function OleSetProperty( hObj, cPropName, uValue )
return __ObjSendMsg( TOleAuto():New( hObj ), "_" + cPropName, uValue )

function OleGetProperty( hObj, cPropName )
return __ObjSendMsg( TOleAuto():New( hObj ), cPropName )
*/


I can´t understand why i need use "Codejock.CommandBars.13.0.0" in OleWevent and
"Codejock.CommandBarsFrame.13.0.0" in TactiveX

if i use "Codejock.CommandBarsFrame.13.0.0" in OleWevent give me erro.. and if
i use "Codejock.CommandBars.13.0.0" in TactiveX give me erro.. :-) :-)
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: ToleAuto / OleWevent
Posted: Sun Aug 16, 2009 11:32 PM

Lailton,

> if i use "Codejock.CommandBarsFrame.13.0.0" in OleWevent give me erro..

What error is it ?

regards, saludos

Antonio Linares
www.fivetechsoft.com