Search
Windowless or Windowed Activation

FlowChartX supports both windowed and windowless in-place activation models. When windowless, the control does not own its own window and renders itself in the window owned by its container. Thus it executes faster, since all expensive window creation and management code is skipped. When imported by an MFC wizard or in a Visual Basic 6.0 project the windowed implementation of FlowChartX is used by default. You would probably want to create the control windowed because of the control built-in scrollbars, which are not supported in the windowless version (you can use RegExtrScrollers to register external scrollbars though).

The COM way to prohibit windowless activation is to return false from the CanWindowlessActivate method of the container's IOleInPlaceSiteWindowless interface. Since this interface is implemented internally by VB and cannot be overridden, we have devised a work-around method to create the control windowed, and still support windowless activation. When FlowChartX is being created it checks if a named semaphore called "FCX_windowless" exists in the system. If the semaphore exists the control reports that it supports windowless activation when asked about it. Otherwise it hides this fact and is created in its own window. If for any reason you want to use the control in windowless mode you can do it as shown below:

VB  Copy Code

Private Declare Function CreateSemaphoreA Lib "Kernel32" (ByVal sec As Long, ByVal a As Long, ByVal b As Long, ByVal s As String) As Long
Private Declare Function CloseHandle Lib "Kernel32" (ByVal handle As Long) As Long

Sub Main()

    Dim smph As Long
 
    'the semaphore should be created before the form
    'that contains FlowChartX is loaded
    smph = CreateSemaphoreA(0, 0, 1, "FCX_windowless")
 
    'load and display the main form
    Form1.Show
 
    'close the semaphore
    CloseHandle smph

End Sub

 Note

Current version of .NET does not support windowless activation of ActiveX controls, so FlowChartX is always created in its own window when used in .NET applications.