Przemysław Czerpak wrote:
It should be easy to fix it if you can create such example but I do not
know if it will be easy to create such self contain example. If it's not
Harbour problem then it's impossible to create it :)
It will be good if you can make this example as simple as possible reducing
any additional code, i.e. use GTWVT and windows function wrappers for hbwin
library.
You are right, this code works without GPF:
#include "hbgtinfo.ch"
#include "hbclass.ch"
REQUEST HB_GT_WVT_DEFAULT
#define WS_CHILD 1073741824
#define WS_VISIBLE 268435456
#define WS_CLIPCHILDREN 33554432
procedure main()
local oMSCAL
wait "Make sure we are 'Active Window'"
oMSCAL := HActiveX():Init( WAPI_GetActiveWindow(), "MSCAL.Calendar", 0, 0,
300, 300 )
wait "Press any key to exit"
//oMSCAL := nil
//hb_gcAll()
oMSCAL:Close()
return
CLASS HActiveX
DATA oOLE
METHOD Init
METHOD Event
ERROR HANDLER OnError
//DESTRUCTOR Close
METHOD Close
ENDCLASS
METHOD Init( hWnd, cProgId, nTop, nLeft, nWidth, nHeight, cID ) CLASS HActiveX
local nStyle := WS_CHILD + WS_VISIBLE + WS_CLIPCHILDREN
WIN_AxInit()
hWnd := WAPI_CreateWindowEX( 0, "AtlAxWin", cProgId, nStyle, nLeft, nTop,
nWidth, nHeight, hWnd, 0 )
::oOLE := WIN_AxGetControl( hWnd, { | event, ... | ::Event( event, ... ) },
cID )
return self
PROCEDURE Event( ... ) CLASS HActiveX
local cEvents := ""
local aEvents := { ... }
aEval(aEvents, { | xEvent | cEvents += HB_ValToStr( xEvent ) + ", " } )
wapi_OutputDebugString( cEvents )
return
METHOD OnError() CLASS HActiveX
return HB_ExecFromArray( ::oOLE, __GetMessage(), HB_AParams() )
METHOD Close() CLASS HActiveX
wapi_OutputDebugString( "Close" )
::oOLE := nil
wapi_OutputDebugString( "After Close" )
RETURN
I must explicitly call oMSCal:Close() to set ::oOLE to NIL, or else it will GPF.
Is that expected behaviour?
I cannot make the DESTRUCTOR work, it is simply not called, can you see why? I
tried it in the three commented lines above.
Regards
Alex
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour