Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8955635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:36:07+00:00 2026-06-15T14:36:07+00:00

I see that quite similar topic has been discussed here but anyone has solved

  • 0

I see that quite similar topic has been discussed here but anyone has solved my problem so far.

I have this assignment:

  1. I have .exe (32bit) utility to run with commands
  2. this utility will be started with windows service on 64bit platform

I know that this is no possibility to run 32bit apps on 64bit process. Otherwise I found workaround by COM IPC communication.

So there is my solution:

Interface declaration of COM library:

namespace Win32ConsoleAppWrapper
{
  [GuidAttribute("5a6ab402-aa68-4d58-875c-fe26dea9c1cd"), ComVisible(true),
  InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
  interface IKDUCompessor
  {
    event ProcessStarted processStarted;
    void RunKDUCompress(string comm);
  }
}

Class implementing the interface:

namespace Win32ConsoleAppWrapper
{

  [GuidAttribute("a1f4eb1a-b276-4272-90e0-0eb26e4273e0"), ComVisible(true),
  ClassInterface(ClassInterfaceType.None)]
  public class KDUCompessor : IKDUCompessor
  {
    public static readonly string KDU_COMPRESS_LIBRARY_NAME = "kdu_compress.exe";

    public event ProcessStarted processStarted;

    public KDUCompessor() { }

    public void RunKDUCompress(string comm)
    {
      if(!File.Exists(KDU_COMPRESS_LIBRARY_NAME))
      {
        throw new FileNotFoundException(String.Format("File {0} could not be found. Please check the bin directory.", KDU_COMPRESS_LIBRARY_NAME));
      }

      ProcessStartInfo info = new ProcessStartInfo();
      info.CreateNoWindow = false;
      info.UseShellExecute = true;
      info.FileName = String.Concat(KDU_COMPRESS_LIBRARY_NAME);
      info.WindowStyle = ProcessWindowStyle.Hidden;
      info.Arguments = comm;

      // Start the process with the info we specified.
      // Call WaitForExit and then the using statement will close.
      using(Process exeProcess = Process.Start(info))
      {
        exeProcess.WaitForExit();
      }      
    }
  }
}

The code is build with no error and no warnings. Then by regAsm.exe registered as COM.

Now I am trying to access to COM and call the method:

public class MyClass
{

#region COM Interface and class declaration

[
  ComImport(),
  Guid("5a6ab402-aa68-4d58-875c-fe26dea9c1cd"),
  InterfaceType(ComInterfaceType.InterfaceIsIUnknown)
]
public interface IKDUCompessor
{
  [PreserveSig]
  void RunKDUCompress(string comm);   

}

[
  ComImport,
  Guid("a1f4eb1a-b276-4272-90e0-0eb26e4273e0")
]
public class KDUCompessor { }

#endregion

protected void CallCOM(_command)
{
  if (IsCommandValid(_command))
  {
    // instance
    Type type = Type.GetTypeFromCLSID(new Guid("a1f4eb1a-b276-4272-90e0-0eb26e4273e0"));
    object o = Activator.CreateInstance(type);
    IKDUCompessor t = (IKDUCompessor)o;
    t.RunKDUCompress(_command);

  }
}

And I got a problems:

  1. executing ends with exception: System.Runtime.InteropServices.COMException was unhandled, class is not registered HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)), when assembly is registered by regasm.exe with no error
  2. I cannot add COM reference to project in VS via add reference wizard, it ends with error dialog window: “A reference to ‘assemblyName’ could not be added. The ActiveX type library ‘libary path’ was exported from a .net assembly and cannot be added as a reference. Add a reference to the .net assembly instead.”

I tried a lot of solutions but I was unsuccessful … thanks for help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T14:36:08+00:00Added an answer on June 15, 2026 at 2:36 pm

    It is not true that you can’t run a 32-bit from a 64-bit process. You can not use a 32-bit DLL or COM-Control in a 64-bit process, but you can use Process.Start to start any process you want.

    In your case it sounds like you don’t even have to use the COM control you’re describing (this causes more problems, even). Just do the following within your service (no matter whether 32- or 64-bit) and you’re fine:

    if(!File.Exists(KDU_COMPRESS_LIBRARY_NAME))
    {
        throw new FileNotFoundException(String.Format("File {0} could not be found. Please check the bin directory.", KDU_COMPRESS_LIBRARY_NAME));
    }
    
    ProcessStartInfo info = new ProcessStartInfo();
    info.CreateNoWindow = false;
    info.UseShellExecute = true;
    info.FileName = String.Concat(KDU_COMPRESS_LIBRARY_NAME);
    info.WindowStyle = ProcessWindowStyle.Hidden;
    info.Arguments = comm;
    
    // Start the process with the info we specified.
    // Call WaitForExit and then the using statement will close.
    using(Process exeProcess = Process.Start(info))
    {
        exeProcess.WaitForExit();
    }    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I see that there have been similar questions asked here regarding wrapping unmanaged C++
Sorry if this has been answered before, but all the related questions didn't quite
ok there are several similar questions but not quite anything that I want. I
I have seen many somewhat similar questions, but nothing quite what I'm looking for.
It's quite often that we see two versions of an android app: a paid
I see that many people get this error, but their situations all appear a
I see that Spring has a @Required annotation to mark member variables in beans
I see that there is PostSharp AOP support for Silverlight, but is there a
I see that tax information is kept at order level but I cannot see
I see that you can enable/disable using the EnableWindow method, but how do I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.