FlexGrid 8 in C++ and Eventhandling

Posted by: jens.debernitz on 10 April 2018, 5:15 pm EST

    • Post Options:
    • Link

    Posted 10 April 2018, 5:15 pm EST

    Hello,

    I will use the VSFlexGrid8L in my c++ project.

    Now I need all DispId’s for the Events.

    Example:

    The DispId for the Event SelChange is 1

    and the methode look like this

    void FlexGrid::OnSelChange()
    

    now I have approximately 50 Event with the right methode definitions found in the examples from the flexgrid.

    Summary I need a list from all DispIds for the event and the methode definitions

  • Posted 11 April 2018, 5:38 pm EST

    Hi,

    I am discussing this with the team internally. Will get back to you once have information on the same.

    Thanks,

    Pragati

  • Posted 12 April 2018, 9:03 pm EST - Updated 29 September 2022, 2:57 am EST

    Hi Jens,

    I had a discussion with the developers regarding this. As per that, the best way to determine the DISPIDs of anything in ActiveX is to use a typelib viewer. This is the best way as it provides the methodology for the user to obtain any necessary DISPIDs should the product change over time.

    All versions of Microsoft Visual Studio include a viewer as part of the installation. The viewer is listed as OLE/COM Object Viewer (file oleviewer.exe). The executable is installed as part of the SDKs installed with Visual Studio. There are several ways to use it.

    Starting the viewer results in a display of registered OLE objects and includes Object Classes, Applications IDs, Type Libraries and Interfaces. If a warning is presented when the program is first started, close the program and start it again, but using Run As Administrator. Running as Administrator allows the program to find and register any supporting DLLs that have not yet been registered.

    • To obtain DISPIDs the interest is in Type Libraries. In this case, open the Type Libraries node and look for ComponentOne VSFlexGrid 8.0 (Light) (Ver 1.0) - you may find several. These entries result when registering the control and multiple entries result when using VB6. If you’ve registered the control multiple times you may find multiple entries.

    • Double click each entry until one of them pops up a new window with text description of the type library. In the left hand panel you see a list of various TypeLib nodes. For DISPIDs you want to view Dispinterfaces - these are the registered dispatch interfaces. You may find that events are not listed - if this is the case then this is the result of VB6 registering a temporary OCA file. Close the window and try another entry from the main window of the program.

    • Once you find the correct entry, you will see the text “uuid(1C0489F8-9EFD-423D-887A-315387F18C8F),” listed in the new window right hand side near the top of window - it is the GUID that is important. This GUID is the identifier of the embedded TypeLib of VSFlexGrid8L. You will also find that the Dispinterfaces node in the left hand panel contains a subnode “dispinterface _IVSFlexGridEvents”.

    • Click on the subnode, "dispinterface _IVSFlexGridEvents. The right hand side of the window now shows a description of the TypeLib dispatch events. Each entry begins with “id(0x000000nn)” - these are the DISPIDs in hexadecimal format for the event. The so called standard events have negative values and so begin with “0xFFFF…”. The custom events are positive and begin with “0x0000…”.

    • Each object interface has it’s own set of properties, methods and events, but in reality, everything at the TypeLib level is a method/function. If you continue to open subnodes in the left hand panel - the Methods node in particular, you’ll see a list of the events by name. Clicking on each gives you the isolated entry for that event. See the attachment for an image.

    An alternative method of finding the correct TypeLib entry is to “View TypeLib…” under the File menu entry. Just open the appropriate OCX and the embedded TypeLib will be viewed. Keep in mind that there will be at least 2 different OleViewer.exe programs on 64 bit machines, a 32 bit version and a 64 bit version. You must use the version that matches the OCX version you open.

    Looking at the node “dispinterface IVSFlexGrid” and the Methods it contains, you will see that each property has 2 entries, a get method and a set method. The get version generally takes no arguments, and the set version takes the new value as an argument. In both cases, the id or DISPID is the same. For example:

    Get or propget of FormatString property.

    [id(0x0000000a), propget, helpstring(“Assigns column widths, alignments, and fixed row and column text.”), helpcontext(0x0000272e)]

    BSTR FormatString();

    Set or propput of FormatString property.

    [id(0x0000000a), propput, helpstring(“Assigns column widths, alignments, and fixed row and column text.”), helpcontext(0x0000272e)]

    void FormatString([in] BSTR rhs);

    Note also that actual methods (i.e. not properties) only have a single entry under the Methods node. e.g. “About” or “Sort”, etc.

    If you want to generate a full listing of the DISPIDs, we suggest using the Save As entry under the File menu to save the text of the entire library, then modify the resultant file to form an include file.

    ~Pragati

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels