Search code examples
windowsclickonceportable-executable

How do I create a Windows portable app including mysql-ODBC, all DLL- and OCX-files?


I have an application, programmed in vb6 that needs some dll-files and ocx-files installed in windows 7.

I already have an installer created with innosetup that includes all needed files and also installs the mysql Connector-ODBC for Windows (x86, 64-bit)

If I just put all files into one folder the installation doesent work, I get the error

Component MSDATGRD.OCX or one of its dependencies not correctly registered: a file is missing or invalid

I tried a search for msdatgrd.ocx portableapp but no Idea

Is there an easy workaround to make this app running without installation?

You can download the files I want to pack into a PortableApp here.


I tried opening the Setup.exe with dependency walker, but unfortunately I have not enough expertise to use that tool. here a screenshot

Although the output of dependency walker seems to be deceptive, see here:

Win 7, 64 bit, dll problems

anyway: I downloaded those 9 files here and packed them , now it shows even more other files missing: pastebin.com/8LawEbuk 7 this doesent seem to lead anywhere cause the dependency walker is too old


I am looking for something really simple to create, no matter the filesize in the end, as I am not a windows programmer


Solution

  • The error below:

    Component MSDATGRD.OCX or one of its dependencies not correctly registered: a file is missing or invalid

    is probably because you haven't registered the ocx component. If you are manually distributing this component, then you also need to register it in the user's machine. To do so you issue the following command:

    regsvr32 msdatgrd.ocx from the command line (note that you need to have admin rights).

    If you don' want to install the application in a typical application directory (i.e.: C:\Program Files) you can use the %APPDATA% or %LOCALAPPDATA% variables to get Romaming (if on a network) and Local user's application directory, respectively. You can also use Windows API to do that. For example:

    if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_COMMON_APPDATA, NULL, 0, szPathName)))
    {
        PathAppend(szPathNam, _L"\\YourCompany\\YourProduct\\") );
    }
    

    Besides the .ocx (which is a Dll that implements specific interfaces), you should note that if you use other methods from a DLL you wrote inside your setup.exe then you have to export them. Nice articles below:

    http://msdn.microsoft.com/en-us/library/z4zxe9k8.aspx

    http://www.codeproject.com/Articles/28969/HowTo-Export-C-classes-from-a-DLL

    c++ exporting and using dll function

    EDIT:

    I found this:

    Use OCX without registering it

    Be aware the Windows XP will be descontinued in April 2014!! Also note that doing this is a dirty hack and should be avoided. I don't know what happens on Windows 7 and Windows 8 (honestly you shouldn't spend time with tricks, but changing to a portable dll component)

    Also I heard about http://boxedapp.com/ I've never used but it worth a look.