Fafi,
You may need to create the ImageList as an OleAuto object.
Look for the cProgId to create an ImageList using CreateObject( cProgId ).
carlos vargas wrote:the link in rapidshre is dead.
can you put the file in other file host. mediafire, filefront, etc.
please.
thank you.
salu2
/*
My OCX create with VB
by Fafi
*/
#define Caption_Left_Top 1
#define Caption_Left_Middle 2
#define Caption_Left_Bottom 3
#define Caption_Center_Top 4
#define Caption_Center_Middle 5
#define Caption_Center_Bottom 6
#define Caption_Right_Top 7
#define Caption_Right_Middle 8
#define Caption_Right_Bottom 9
#define Text_Caption_Normal 1
#define Text_Caption_Embossed 2
#define Text_Caption_Engraved 3
#define Text_Caption_OutLine 4
#define Text_Caption_Shadow 5
#include "FiveWin.ch"
static oGetEvent,cGetEvent,oWnd,oBrushSilver,oBrushBlack,oBrushBlue,oAct1,oAct2,oAct,oAct3,oAct4
function Main()
Local oDlg, oWnd, oAct := array(10)
local aCaption := { ;
"Media Center",;
"Media Player",;
"Office 2007 1",;
"Office 2007 2",;
"Vista 1",;
"Vista 2",;
"XP Blue",;
"XP Olive Green",;
"XP Silver";
}
if !file("FafiButtonx.StylerButton.ocx")
MsgAlert("Can't find FafiButtonx.StylerButton.ocx")
return nil
else
RegisterServer( "FafiButtonx.StylerButton.ocx" )
endif
DEFINE ICON oIcon NAME "BASEPRO"
DEFINE WINDOW oWnd TITLE "FWH Support Fafi OCX" ICON oIcon
DEFINE BRUSH oBrushSilver FILE "SILVER.BMP"
DEFINE DIALOG oDlg FROM 0, 0 TO 400,400 PIXEL OF oWnd TRANSPARENT STYLE nOr( WS_VISIBLE, WS_CHILD ) BRUSH oBrushSilver
nRow := 300
nCol := 10
oAct := TActiveX():New( oWnd, "FafiButtonx.StylerButton", nRow, nCol, 200, 200 )
oAct:bOnEvent := { | cEvent, aParams, pParams | ButtonEvent( cEvent, aParams, pParams ) }
oAct:SetProp("Caption","Alpha")
oAct:SetProp("ImageFile","trash.bmp")
oAct:SetProp("ImageTopPosition",16)
oFontButton := TOleAuto():New( ActXPdisp( oAct:hActiveX ) )
oFontButton := oFontButton:Font()
oFontButton:Size := 40
oFontButton:Name := "Times New Roman"
oAct:SetProp("CaptionAlignment",Caption_Center_Bottom)
nRow := 10
nCol := 350
for i := 1 to 9
// nTop, nLeft. nWidth, nHeight
oAct := TActiveX():New( oWnd, "FafiButtonx.StylerButton", nRow, nCol, 100, 35 )
oAct:bOnEvent := { | cEvent, aParams, pParams | ButtonEvent( cEvent, aParams, pParams ) }
oAct:SetProp("Caption","Black Small")
oAct:SetProp("Theme",5)
oAct:SetProp("ForeColor",CLR_GREEN )
oAct:SetProp("CaptionAlignment",Caption_Right_Middle)
oAct:SetProp("ImageFile","heart.ico")
oAct:SetProp("ImageTopPosition",2 )
oAct:SetProp("RoundedValue",10)
nRow += 40
next
nRow := 10
nCol := 10
for i := 1 to 9
// nTop, nLeft. nWidth, nHeight
oAct := TActiveX():New( oWnd, "FafiButtonx.StylerButton", nRow, nCol, 120, 25 )
oAct:bOnEvent := { | cEvent, aParams, pParams | ButtonEvent( cEvent, aParams, pParams ) }
oAct:SetProp("Caption",aCaption[i]+" Style")
oAct:SetProp("Theme",i)
nRow += 30
next
nRow := 10
nCol := 150
// nTop, nLeft. nWidth, nHeight
oAct := TActiveX():New( oWnd, "FafiButtonx.StylerButton", nRow, nCol, 150, 50 )
oAct:bOnEvent := { | cEvent, aParams, pParams | ButtonEvent( cEvent, aParams, pParams ) }
oAct:SetProp("Caption","Normal Button")
oAct:SetProp("CaptionEffect",Text_Caption_Shadow)
oFontButton := TOleAuto():New( ActXPdisp( oAct:hActiveX ) )
oFontButton := oFontButton:Font()
oFontButton:Size := 14
oFontButton:Name := "Tahoma"
nRow += 55
nCol := 150
// nTop, nLeft. nWidth, nHeight
oAct := TActiveX():New( oWnd, "FafiButtonx.StylerButton", nRow, nCol, 150, 50 )
oAct:bOnEvent := { | cEvent, aParams, pParams | ButtonEvent( cEvent, aParams, pParams ) }
oAct:SetProp("Caption","Round Button")
oFontButton := TOleAuto():New( ActXPdisp( oAct:hActiveX ) )
oFontButton := oFontButton:Font()
oFontButton:Size := 14
oFontButton:Name := "Tahoma"
oAct:SetProp("RoundedValue",20)
nRow += 55
nCol := 150
// nTop, nLeft. nWidth, nHeight
oAct := TActiveX():New( oWnd, "FafiButtonx.StylerButton", nRow, nCol, 180, 60 )
oAct:bOnEvent := { | cEvent, aParams, pParams | ButtonEvent( cEvent, aParams, pParams ) }
oAct:SetProp("Caption","Alpha Bitmap")
oAct:SetProp("ImageFile","explorer1.bmp")
oAct:SetProp("CaptionAlignment",Caption_Right_Middle)
oAct:SetProp("CaptionEffect",Text_Caption_OutLine)
oAct:SetProp("ForeColor",nRGB(152,37,2) )
oFontButton := TOleAuto():New( ActXPdisp( oAct:hActiveX ) )
oFontButton := oFontButton:Font()
oFontButton:Size := 14
oFontButton:Name := "Tahoma"
nRow += 65
nCol := 150
// nTop, nLeft. nWidth, nHeight
oAct := TActiveX():New( oWnd, "FafiButtonx.StylerButton", nRow, nCol, 80, 100 )
oAct:bOnEvent := { | cEvent, aParams, pParams | ButtonEvent( cEvent, aParams, pParams ) }
oAct:SetProp("Caption","PNG")
oAct:SetProp("ImageFile","BinEmpty1.png")
oAct:SetProp("CaptionAlignment",Caption_Right_Middle)
oAct:SetProp("CaptionEffect",Text_Caption_OutLine)
oAct:SetProp("ForeColor",nRGB(152,37,2) )
oAct:SetProp("ImageTopPosition",10 )
oFontButton := TOleAuto():New( ActXPdisp( oAct:hActiveX ) )
oFontButton := oFontButton:Font()
oFontButton:Size := 14
oFontButton:Name := "Tahoma"
nCol := 250
// nTop, nLeft. nWidth, nHeight
oAct := TActiveX():New( oWnd, "FafiButtonx.StylerButton", nRow, nCol, 80, 100 )
oAct:bOnEvent := { | cEvent, aParams, pParams | ButtonEvent( cEvent, aParams, pParams ) }
oAct:SetProp("Caption","ICON")
oAct:SetProp("ImageFile","ActiveContentWizard.ico")
oAct:SetProp("CaptionAlignment",Caption_Center_Bottom)
oAct:SetProp("CaptionEffect",Text_Caption_OutLine)
oAct:SetProp("ForeColor",nRGB(152,37,2) )
oAct:SetProp("ImageTopPosition",10 )
oFontButton := TOleAuto():New( ActXPdisp( oAct:hActiveX ) )
oFontButton := oFontButton:Font()
oFontButton:Size := 14
oFontButton:Name := "Tahoma"
ACTIVATE DIALOG oDlg NOWAIT VALID oWnd:End()
ACTIVATE WINDOW oWnd ON RESIZE ( oDlg:SetSize( oWnd:nWidth, oWnd:nHeight ) ) MAXIMIZED
Return Nil
static function ButtonEvent( cEvent, aParams, pParams )
cEvent := upper(alltrim(cEvent))
if left(cEvent,5) == "MOUSE" // don't use mouse event
else
if cEvent == "CLICK"
cGetEvent := aParams[1]
MsgAlert(cGetEvent)
endif
endif
return nil
#pragma BEGINDUMP
#include <hbapi.h>
#include <windows.h>
typedef LONG ( * PDLLREGISTERSERVER ) ( void );
HB_FUNC( REGISTERSERVER )
{
HMODULE hDll = LoadLibrary( hb_parc( 1 ) );
LONG lReturn = 0;
if( hDll )
{
FARPROC pRegisterServer = GetProcAddress( hDll, "DllRegisterServer" );
if( pRegisterServer )
lReturn = ( ( PDLLREGISTERSERVER ) pRegisterServer )();
FreeLibrary( hDll );
}
hb_retnl( lReturn );
}
#pragma ENDDUMP
CLASS TMyRibbonBar FROM TActiveX
CLASSDATA lRegistered AS LOGICAL
METHOD New( oWnd, nTop, nLeft, nWidth, nHeight )
ENDCLASS
METHOD New( oWnd, nTop, nLeft, nWidth, nHeight ) CLASS TMyRibbonBar
::Super:New( oWnd, "FafiOCX.RibbonBar", nTop, nLeft, nWidth, nHeight )
return Self
Antonio Linares wrote:Fafi,
> I want to make myRIbbonbar, MyExplorerbar and MyButton class with FWH
You have to create a new Class inherited from Class TActiveX:
- Code: Select all Expand view
CLASS TMyRibbonBar FROM TActiveX
CLASSDATA lRegistered AS LOGICAL
METHOD New( oWnd, nTop, nLeft, nWidth, nHeight )
ENDCLASS
METHOD New( oWnd, nTop, nLeft, nWidth, nHeight ) CLASS TMyRibbonBar
::Super:New( oWnd, "FafiOCX.RibbonBar", nTop, nLeft, nWidth, nHeight )
return Self
''Windows API Functions
Private Declare Function CreateWindowEx Lib "user32" Alias "CreateWindowExA" (ByVal dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName As String, ByVal dwStyle As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, ByVal hMenu As Long, ByVal hInstance As Long, lpParam As Any) As Long
#include "fivewin.ch"
function Main()
define dialog oDlg from 1,1 to 400,400 pixel
oRect := TRect():New(oDlg, 1,1,100,100 )
activate dialog oDlg
return nil
CLASS TRECT FROM TControl
CLASSDATA lRegistered AS LOGICAL
METHOD New(oWnd,nTop,nLeft,nBottom,nRight) CONSTRUCTOR
ENDCLASS
METHOD New(oWnd,nTop,nLeft,nBottom,nRight) CLASS TRECT
local nStylePen := PS_SOLID
local nWidthPen := 2
local nColorPen := CLR_RED
::oWnd := oWnd
::nTop := nTop
::nLeft := nLeft
::nBottom := nBottom
::nRight := nRight
Rectangle( ::oWnd:hDC, ::nTop, ::nLeft, ::nBottom, ::nRight,CreatePen( nStylePen, nWidthPen, nColorPen ) )
return self
ukoenig wrote:With Windows VISTA there is the same problem like Your other OCX ( no display ).
A test with WINDOWS 2000 works this time ( with Your other OCX, there was a error )
A test with XP was ok as well.
#include "fivewin.ch"
#include "Constant.ch"
#define LTGRAY_BRUSH 1
#define TRANSPARENT 1
#define SS_CENTER 1
#define SS_RIGHT 2
#define SS_GRAYRECT 5 // BOXRECT
#define DLGC_BUTTON 8192 // 0x2000
#define COLOR_WINDOW 5
#define COLOR_WINDOWTEXT 8
#define COLOR_BTNFACE 15
#define WM_NCHITTEST 132 // 0x84
function Main()
define dialog oDlg from 1,1 to 400,400 pixel
oRect := TRect():New(oDlg,2,2,100,100 )
@30,10 SAY "Press down on My Rectangle" size 100,12 of oDlg pixel
activate dialog oDlg
return nil
CLASS TRect FROM TControl
CLASSDATA lRegistered AS LOGICAL
DATA lProcessing AS LOGICAL INIT .f.
METHOD New(oWnd,nTop,nLeft,nBottom,nRight,cMsg,lAdjust,lUpdate,cLayout,bAction,nWidth,nHeight,lBorder) CONSTRUCTOR
METHOD LButtonDown( nRow, nCol )
METHOD LButtonUp( nRow, nCol )
METHOD MouseMove( nRow, nCol, nKeyFlags )
ENDCLASS
METHOD New(oWnd,nTop,nLeft,nWidth,nHeight,cMsg) CLASS TRECT
DEFAULT cMsg := " ", nWidth := 20, nHeight := 20, oWnd := GetWndDefault()
* Default class from Tcontrol
::nStyle = nOR( WS_CHILD, WS_VISIBLE )
::nId = ::GetNewId()
::oWnd = oWnd
::cMsg = cMsg
::nTop = nTop
::nLeft = nLeft
::nBottom = nTop + nHeight - 1
::nRight = nLeft + nWidth - 1
::Register( nOR( CS_VREDRAW, CS_HREDRAW ) )
if ! Empty( oWnd:hWnd )
::Create( "STATIC" )
::SetColor( ::nClrText, ::nClrPane )
oWnd:AddControl( Self )
else
oWnd:DefControl( Self )
endif
return self
METHOD LButtonDown( nRow, nCol ) CLASS TRect
MsgAlert("Press Down")
return 0
METHOD LButtonUp( nRow, nCol ) CLASS TRect
MsgAlert("Up")
return 0
METHOD MouseMove( nRow, nCol, nKeyFlags ) CLASS TRect
return 0
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot], nageswaragunupudi and 55 guests