Create OCX Control with QT 4.8.7

  • Good Morning Community,

    iam new in the Qt World, and develped some tiny tools.. Now there a requirement to port my tiny tools (exe) to ocx componentes. is this a big deal?

    EDIT: ActiveQT Server means a OCX Control, right?

    I build a empty ActiveQt Server with VS2008 (qt4.8.7) with the wizzard.

    But when i build it, i get an error from the MIDL Compiler, that the idl is missing.

    1>   Creating library C:\Users\admin\Documents\Visual Studio 2008\Projects\MircoScanOCX\Win32\Release\MircoScanOCX.lib and object C:\Users\admin\Documents\Visual Studio 2008\Projects\MircoScanOCX\Win32\Release\MircoScanOCX.exp
    1>Embedding manifest...
    1>Performing Post-Build Event...
    1>"c:\users\admin\documents\visual studio 2008\projects\mircoscanocx\win32\release\mircoscanocx.idl"
    1>Couldn't open "c:\users\admin\documents\visual studio 2008\projects\mircoscanocx\win32\release\mircoscanocx.idl" for writing!
    1>Microsoft (R) 32b/64b MIDL Compiler Version 7.00.0500 
    1>Copyright (c) Microsoft Corporation 1991-2006. All rights reserved.
    1>Processing C:\Users\admin\Documents\Visual Studio 2008\Projects\MircoScanOCX\Win32\Release\MircoScanOCX.idl
    1>c1 : fatal error C1083: Cannot open source file: 'C:\Users\admin\Documents\Visual Studio 2008\Projects\MircoScanOCX\Win32\Release\MircoScanOCX.idl': No such file or directory
    1>midl : command line error MIDL1003 : error returned by the C preprocessor (2)
    1>Couldn't open c:\users\admin\documents\visual studio 2008\projects\mircoscanocx\win32\release\mircoscanocx.tlb for read
    1>Failed to register server!
    1>Project : error PRJ0019: A tool returned an error code from "Performing Post-Build Event..."
    1>Build log was saved at "file://C:\Users\admin\Documents\Visual Studio 2008\Projects\MircoScanOCX\Win32\Release\BuildLog.htm"
    1>MircoScanOCX - 3 error(s), 0 warning(s)
    ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

    iam confused.. i search for a solution an there is desribed that i have to create the idl via IDC tool? but i though this must be automatic genereate by the wizzard?

    Thank you

  • Hi, an ActiveQt server means an .exe file, not an .OCX (dll) file.
    If you want to consume/use an Active Qt server .exe file from a Visual Studio project, you need to import it as a standalone .exe COM server, not as an OCX dll control.
    Building .ocx files with Qt is possible but not easy :-(

  • Hey @hskoglund thanks for your replay.

    Now iam able to build and register an OCX(dll) Hello World Application:) In next step i want to execute/debug my dll.. if i click on "run" in Visual Studio, a dialog appear where i have to input an Exe File.. I there an OCX Host Container meant? what i have to do, that after build und run, an ocs container with my ocx will start, an debug?

  • Hi, this question is because I'm guessing you have built your .ocx (dll) project in Visual Studio and not in Qt Creator. When you run a .dll type of project in Visual Studio it begins by asking you for an .EXE file that uses the .dll you just built. For an .ocx (dll) file that .exe file would be the container/application that will load the .ocx file into its user interface.

  • Oh ok thanks that a advice. I investigate some time, an found the "testcon.exe" from qt. there i can load my ocx. thats very .. good! What ocx container would you suggest? Iam using VS2008 and since 2005 there is no more ocs container provied from MS?

  • 20 years ago when this technology (.ocx dlls) was hot I used Microsoft's Visual Basic IDE as test container for my .ocx projects.
    However it's 2018 now and .ocx dlls are obsolete, Microsoft has switched to .NET and .NET Core.
    So you might instead try porting your tools to a normal Win32 desktop .dll, this you can do either in Qt Creator or in Visual Studio. Also, because they both are free, you could update to Visual Studio 2017 and Qt5.

  • Good Morning @hskoglund ,

    thats absolutly right.. OCX is obsolute, but is unfortunatly an requirment to have compatiblity to OCX bases environment. An we have to provide a complatibilty to old WinXP 32 bit (VS++9.0) Systems, thats the reason.
    If this all wouldnt matter, i would prefare .NET.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.