/*-----------------------------------------------------------------------------------------------*/
#include "fivewin.ch"
#include "Constant.ch"
/*-----------------------------------------------------------------------------------------------*/
function main()
local oWnd, oAct, cProgid:="Agent.Control.2"
define window oWnd color 0,0
oAct := MyClass():New( oWnd, cProgid, 100, 100, 100, 100 )
// erros con los testes
ownd:oClient:=oAct
// ownd:oClient:=oAct:hWnd
activate window oWnd
return nil
/*-----------------------------------------------------------------------------------------------*/
#define COLOR_BTNFACE 15
CLASS myCLASS From TControl
DATA hWnd
method New() Constructor
ENDCLASS
/*-----------------------------------------------------------------------------------------------*/
METHOD New( oWnd, cProgId, nTop, nLeft, nBottom, nRight, nClrFore, nClrBack, lPixel,;
lDesign, cMsg, lVertical ) CLASS myCLASS
DEFAULT nTop := 0, nLeft := 0,;
oWnd := GetWndDefault(),;
nClrFore := oWnd:nClrText,;
nClrBack := GetSysColor( COLOR_BTNFACE ),;
lPixel := .f.,;
lDesign := .f.,;
nRight := 200, nBottom := 21,;
lVertical := .f.
::nId = ::GetNewId()
::oWnd = oWnd
::cMsg = cMsg
::nTop = If( lPixel, nTop, nTop * SAY_CHARPIX_H )
::nLeft = If( lPixel, nLeft, nLeft * SAY_CHARPIX_W )
::nBottom = nBottom
::nRight = nRight
::lDrag = lDesign
::lCaptured = .f.
::nClrText = nClrFore
::nClrPane = nClrBack
::Register()
if ! Empty( oWnd:hWnd )
::hWnd:=CRWIN( oWnd:hWnd, cProgId, nTop, nLeft, nBottom, nRight )
// ::Create()
::Default()
oWnd:AddControl( Self )
else
oWnd:DefControl( Self )
endif
if lDesign
::CheckDots()
endif
return Self
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
/*-----------------------------------------------------------------------------------------------*/