Daniel, aqui estas uno exemplo
/*-----------------------------------------------------------------------------------------------*/
#include "fivewin.ch"
/*-----------------------------------------------------------------------------------------------*/
function main()
public ownd, oact, progid:="Agent.Control.2"
define window ownd color 0,0
oAct:=MyClass():New(ownd,progid,100,100,100,100)
// erros con los testes
// ownd:=oAct
// ownd:=oAct:hWnd
activate window ownd
return nil
/*-----------------------------------------------------------------------------------------------*/
CLASS myCLASS From TControl
DATA hWnd
method new() Constructor
ENDCLASS
/*-----------------------------------------------------------------------------------------------*/
method new(win,prog,nTop,nLeft,nBottom,nRight) CLASS myClass
::hWnd:=CRWIN(win:hWnd,prog,nTop,nLeft,nBottom,nRight)
return self
/*-----------------------------------------------------------------------------------------------*/
#pragma BEGINDUMP
#include <hbvmopt.h>
#include <windows.h>
#include <commctrl.h>
#include <hbapi.h>
#include <hbvm.h>
#include <hbstack.h>
#include <ocidl.h>
#include <hbapiitm.h>
#ifdef HB_ITEM_NIL
#define hb_dynsymSymbol( pDynSym ) ( ( pDynSym )->pSymbol )
#endif
PHB_SYMB s___GetMessage = NULL;
typedef HRESULT ( WINAPI *LPAtlAxWinInit ) ( void );
typedef HRESULT ( WINAPI *LPAtlAxGetControl ) ( HWND, IUnknown** );
typedef HRESULT ( WINAPI *LPAtlAxCreateControl ) ( LPCOLESTR, HWND, IStream*, IUnknown** );
HMODULE hDll = NULL;
LPAtlAxWinInit AtlAxWinInit;
LPAtlAxGetControl AtlAxGetControl;
LPAtlAxCreateControl AtlAxCreateControl;
static void LoadAtl( void )
{
if( ! hDll )
{
hDll = LoadLibrary( "Atl.dll" );
AtlAxWinInit = ( LPAtlAxWinInit ) GetProcAddress( hDll, "AtlAxWinInit" );
AtlAxGetControl = ( LPAtlAxGetControl ) GetProcAddress( hDll, "AtlAxGetControl" );
AtlAxCreateControl = ( LPAtlAxCreateControl ) GetProcAddress( hDll, "AtlAxCreateControl" );
AtlAxWinInit();
}
}/*-----------------------------------------------------------------------------------------------*/
HB_FUNC( CRWIN)
{
HWND hWndCtrl;
LoadAtl();
hWndCtrl = CreateWindowEx(
(DWORD) 0 , // nExStyle
(LPCTSTR) "AtlAxWin" , // cClsName
(LPCTSTR) hb_parc( 2 ) , // cProgId
(DWORD) WS_CHILD | WS_VISIBLE | WS_TABSTOP , // style
(INT) hb_parni( 3 ) , // nLeft
(INT) hb_parni( 4 ) , // nTop
(INT) hb_parni( 5 ) , // nWidth
(INT) hb_parni( 6 ) , // nHeight
(HWND) hb_parnl( 1 ) , // OParent:handle
0,
0,
NULL );
hb_retnl( (long) hWndCtrl );
}
/*-----------------------------------------------------------------------------------------------*/
#pragma ENDDUMP
/*-----------------------------------------------------------------------------------------------*/