#include "FiveWin.ch"
static oRb
function Main()
local oWnd, oAct, oMenu, aControls := {}
DEFINE WINDOW oWnd TITLE "Visual RibbonBar"
@ 0, 0 ACTIVEX oAct PROGID "Codejock.CommandBarsFrame.12.1.1" OF oWnd SIZE 0, 0
oAct:bOnEvent = { | cEvent, aParams, pParams | RibbonBarEvent( cEvent, aParams, pParams, aControls ) }
oAct:Do( "AttachToWindow", oWnd:hWnd )
oRb = oAct:Do( "AddRibbonBar", "fwh" )
oMenu = oRb:Controls:Add( 2, 0, "Menu" )
oMenu:Flags = 1 && xtpFlagRightAlign
oTabs = oMenu:CommandBar:Controls:Add( 2, 0, "Tabs" )
AAdd( aControls, oTabs:CommandBar:Controls:Add( 1, 3000, "Add" ) )
oGroups = oMenu:CommandBar:Controls:Add( 3, 0, "Groups" )
AAdd( aControls, oGroups:CommandBar:Controls:Add( 1, 4000, "Add" ) )
ACTIVATE WINDOW oWnd
return nil
function RibbonBarEvent( cEvent, aParams, pParams, aControls )
local oTab
static nTab := 1, nGroup := 1
do case
case cEvent == "Execute" .and. Len( aControls ) > 0
do case
case aControls[ 1 ]:hObj == aParams[ 1 ]
oTab = oRb:InsertTab( nTab, "Tab " + AllTrim( Str( nTab++ ) ) )
oTab:Selected = .T.
case aControls[ 2 ]:hObj == aParams[ 1 ]
MsgInfo( "Insert Group" )
endcase
endcase
return nil
#include "FiveWin.ch"
static oRb
function Main()
local oWnd, oAct, oMenu, aControls := {}
DEFINE WINDOW oWnd TITLE "Visual RibbonBar"
@ 0, 0 ACTIVEX oAct PROGID "Codejock.CommandBarsFrame.12.1.1" OF oWnd SIZE 0, 0
oAct:bOnEvent = { | cEvent, aParams, pParams | RibbonBarEvent( cEvent, aParams, pParams, aControls ) }
oAct:Do( "AttachToWindow", oWnd:hWnd )
oRb = oAct:Do( "AddRibbonBar", "fwh" )
oMenu = oRb:Controls:Add( 2, 0, "Menu" )
oMenu:Flags = 1 && xtpFlagRightAlign
oTabs = oMenu:CommandBar:Controls:Add( 2, 0, "Tabs" )
AAdd( aControls, oTabs:CommandBar:Controls:Add( 1, 3000, "Add" ) )
oGroups = oMenu:CommandBar:Controls:Add( 3, 0, "Groups" )
AAdd( aControls, oGroups:CommandBar:Controls:Add( 1, 4000, "Add" ) )
ACTIVATE WINDOW oWnd
return nil
function RibbonBarEvent( cEvent, aParams, pParams, aControls )
local oTab
do case
case cEvent == "Execute" .and. Len( aControls ) > 0
do case
case aControls[ 1 ]:hObj == aParams[ 1 ]
oTab = oRb:InsertTab( oRb:TabCount + 1, "Tab " + AllTrim( Str( oRb:TabCount + 1 ) ) )
oTab:Selected = .T.
case aControls[ 2 ]:hObj == aParams[ 1 ]
if oRb:TabCount > 0
oRb:SelectedTab:Groups:AddGroup( "&Group", Len( oRb:SelectedTab:Groups ) + 1 )
endif
endcase
endcase
return nil
#include "FiveWin.ch"
static oRb
function Main()
local oWnd, oAct, oMenu, aControls := {}
DEFINE WINDOW oWnd TITLE "Visual RibbonBar"
@ 0, 0 ACTIVEX oAct PROGID "Codejock.CommandBarsFrame.12.1.1" OF oWnd SIZE 0, 0
oAct:bOnEvent = { | cEvent, aParams, pParams | RibbonBarEvent( cEvent, aParams, pParams, aControls ) }
oAct:Do( "AttachToWindow", oWnd:hWnd )
oRb = oAct:Do( "AddRibbonBar", "fwh" )
oMenu = oRb:Controls:Add( 2, 0, "Menu" )
oMenu:Flags = 1 && xtpFlagRightAlign
oTabs = oMenu:CommandBar:Controls:Add( 2, 0, "Tabs" )
AAdd( aControls, oTabs:CommandBar:Controls:Add( 1, 3000, "Add" ) )
oGroups = oMenu:CommandBar:Controls:Add( 3, 0, "Groups" )
AAdd( aControls, oGroups:CommandBar:Controls:Add( 1, 4000, "Add" ) )
ACTIVATE WINDOW oWnd
return nil
function RibbonBarEvent( cEvent, aParams, pParams, aControls )
local oTab
do case
case cEvent == "Execute" .and. Len( aControls ) > 0
do case
case aControls[ 1 ]:hObj == aParams[ 1 ]
oTab = oRb:InsertTab( oRb:TabCount + 1, "Tab " + AllTrim( Str( oRb:TabCount + 1 ) ) )
oTab:Selected = .T.
case aControls[ 2 ]:hObj == aParams[ 1 ]
if oRb:TabCount > 0
oRb:SelectedTab:Groups:AddGroup( "Group " + AllTrim( Str( oRb:SelectedTab:Groups:GroupCount + 1 ) ),;
oRb:SelectedTab:Groups:GroupCount + 1 )
endif
endcase
endcase
return nil
#include "FiveWin.ch"
#define xtpControlButton 1
static oRb
function Main()
local oWnd, oAct, oMenu, oGroups, oControls, aControls := {}
DEFINE WINDOW oWnd TITLE "Visual RibbonBar"
@ 0, 0 ACTIVEX oAct PROGID "Codejock.CommandBarsFrame.12.1.1" OF oWnd SIZE 0, 0
oAct:bOnEvent = { | cEvent, aParams, pParams | RibbonBarEvent( cEvent, aParams, pParams, aControls ) }
oAct:Do( "AttachToWindow", oWnd:hWnd )
oRb = oAct:Do( "AddRibbonBar", "fwh" )
oMenu = oRb:Controls:Add( 2, 0, "Menu" )
oMenu:Flags = 1 && xtpFlagRightAlign
oTabs = oMenu:CommandBar:Controls:Add( 2, 0, "Tabs" )
AAdd( aControls, oTabs:CommandBar:Controls:Add( 1, 3000, "Add" ) )
oGroups = oMenu:CommandBar:Controls:Add( 3, 0, "Groups" )
AAdd( aControls, oGroups:CommandBar:Controls:Add( 1, 4000, "Add" ) )
oControls = oMenu:CommandBar:Controls:Add( 3, 0, "Controls" )
AAdd( aControls, oControls:CommandBar:Controls:Add( 1, 5000, "Add Button" ) )
ACTIVATE WINDOW oWnd
return nil
function RibbonBarEvent( cEvent, aParams, pParams, aControls )
local oTab, oGroup, oControl
do case
case cEvent == "Execute" .and. Len( aControls ) > 0
do case
case aControls[ 1 ]:hObj == aParams[ 1 ]
oTab = oRb:InsertTab( oRb:TabCount + 1, "Tab " + AllTrim( Str( oRb:TabCount + 1 ) ) )
oTab:Id = oRb:TabCount
oTab:Selected = .T.
case aControls[ 2 ]:hObj == aParams[ 1 ]
if oRb:TabCount > 0
oGroup = oRb:SelectedTab:Groups:AddGroup( "Group " + AllTrim( Str( oRb:SelectedTab:Groups:GroupCount + 1 ) ),;
( oRb:SelectedTab:Index * 10 ) + oRb:SelectedTab:Groups:GroupCount + 1 )
endif
case aControls[ 3 ]:hObj == aParams[ 1 ]
if oRb:SelectedTab:Groups:GroupCount > 0
oGroup = oRb:FindGroup( ( oRb:SelectedTab:Index * 10 ) + oRb:SelectedTab:Groups:GroupCount )
oControl = oGroup:Add( xtpControlButton, 1, nil )
oControl:Caption = "Button " + AllTrim( Str( oGroup:Count ) )
endif
endcase
endcase
return nil
if ! IsActiveX( "Codejock.CommandBars.v13.0.0.ocx" )
MsgStop( "ActiveX missing" )
return nil
endif
I think that first you have to register the ActiveX as an administrator. But not 100% sure about it.
If IsActivex("Codejock.CommandBars.v12.1.1.ocx")
MsgInfo("Activex is already Registerd")
else // If not registered then Display the msg and REgister the OCX
MSgInfo("Activex is NOT Registerd, Now it will Register") // This line is getting executed
RegisterServer( "Codejock.CommandBars.v12.1.1.ocx" )
Endif
// After REsgisterServer, IsActivex() should return .T., but it is returning .F.
If IsActivex("Codejock.CommandBars.v12.1.1.ocx")
MSgInfo("Activex is Successful")
else
MSgInfo("Unable to register the Activex") // This line is getting executed
endif
#pragma BEGINDUMP
#include <hbapi.h>
unsigned long CoInitialize( void * );
HB_FUNC( COINITIALIZE )
{
hb_retnl( CoInitialize( NULL ) );
}
#pragma ENDDUMP
function RibbonBarEvent( cEvent, aParams, pParams, aButtons, oWnd )
IF Valtype( cEvent ) == "N"
DO CASE
CASE cEvent == 1
cEvent := "Execute"
OTHERWISE
cEvent := ""
ENDCASE
ENDIF
oAct := TActiveX():New( oWnd, "Codejock.CommandBarsFrame.12.1.1", 0, 0, 0, 0 )
Function RibbonBarEvent( cEvent, aParams, pParams, aButtons )
MsgInfo(ValType(cEvent))
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 45 guests