none
ThunderRT6UserControlDC UIAutomation C++ API

    Question

  • Hello, 

    this question is related to the one at MSFlexGrid UIAutomation C++ API .

    I have a Desktop UI composed of VB6 ActiveX components. Some of them are standard components (like the MSFlexGrid), others are custom ActiveX components. 

    I have mainly two different custom components: a ComboBox and a DatePicker. But, when I look at the Inspect tool, both show "ClassName: ThunderRT6UserControlDC" rather than specific component class names. This is a difference with the case of MSFlexGrid for which I have "ClassName: MSFlexGridWndClass". Both ComboBox and DatePicker come with an .OCX file (ComboBox.OCX and DatePicker.OCX), so that I can add "MFC Class From TypeLib" in a MFC DLL to generate C++ classes and interfaces. This is exactly what I have already done with the MSFlexGrid. 

    Now, for ComboBox I can proceed successfully in the same way I have already done with the MSFlexGrid:

    DWORD* pDWORD = (DWORD*)GetWindowLong(hwnd, GWL_USERDATA);
    pDWORD++;
    pDWORD++;
    LPDISPATCH pDispatch = (LPDISPATCH)*pDWORD;
    
    Combobox *pComboBox = NULL;
    HRESULT hr = pDispatch->QueryInterface(IID__Combobox, (LPVOID*)&pComboBox);
    if (FAILED(hr)) {
    	// manage error
    }
    
    pComboBox->put_Text(..);

    But, for the DatePicker I cannot get pDispach from hwnd because the following line returns NULL:

    DWORD* pDWORD = (DWORD*)GetWindowLong(hwnd, GWL_USERDATA);

    Looking at GetLastError(), I get "ERROR_SUCCESS 0 (0x0) The operation completed successfully."

    What could be the reason for that? Is there any other way to get an interface to that component?

    Thank you in advance.




    • Edited by onlyusv Thursday, January 26, 2017 6:22 PM
    Monday, January 23, 2017 11:49 AM