Take the 2-minute tour ×

Developed an 32 bit Visual Basic dll. dll written only 1 method GetSum having two integer parameteres

Now using late binding load an dll in Winform 32 bit application. pass two integer values show the sum in label. the sum shows correct.

private void Form1_Load(object sender, EventArgs e)
     object[] args = new object[] { "89", "2" };
     Type comObjectType = Type.GetTypeFromProgID("Project1.Class1", true);
     object comObject = Activator.CreateInstance(comObjectType);
     Type acctualObjectType = comObject.GetType();
     object result = acctualObjectType.InvokeMember("GetSum", System.Reflection.BindingFlags.InvokeMethod, null, comObject, args);
     label1.Text = result.ToString();

My problem is when i run the winfrom exe on windows 7 64 bit machine. in task manager processes section shows like "WindowsFormsApplication.exe *32"

Means my winfrom exe is running as 32 bit mode on 64 bit machine. What should i do to run my 32 bit exe on 64 bit machine to run as 64 bit exe.

Dont want *32 append to exe in task manager processes section.

share|improve this question
Have you set the Platform Target to AnyCPU and turned off Prefer 32-bit? –  Matthew Watson Jun 25 '13 at 7:41
when i set platform to any cpu then exe corrcltly works on 32 bit machine but it crashes in 64 bit machine giving an error class not registered..System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {0AAB73EC-446B-4142-B758-9637D4CA8E18} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)). –  Nikhil Jun 25 '13 at 7:43
Matthew where is tab for Prefer 32-bit –  Nikhil Jun 25 '13 at 8:06
It's next to the "AnyCPU" setting, but it's only there for VS2012. Are you using VS2010 by any chance? –  Matthew Watson Jun 25 '13 at 8:14
Matthew i am using vs2010 –  Nikhil Jun 25 '13 at 8:16
show 7 more comments

1 Answer

First: for creating the dll, are you using Visual Basic .NET or legacy Visual Basic 6?

If you are using VB6, you won't be able to create a 64bit dll. If you are using VB.NET, compile your dll to 64bit.

And remember, if your VB dll is a 32bit dll, you won't be able to use it from a 64bit application.

share|improve this answer
i cant do anything on dll level ...client gives me 32 bit dll always –  Nikhil Jun 25 '13 at 7:49
@Nikhil: well, you have no option. You must create 32bit apps. –  marc casas Jun 25 '13 at 7:50
is there any way... –  Nikhil Jun 25 '13 at 7:55
AFAIK, it's impossible to comunicate a 64bit app with a 32bit dll. –  marc casas Jun 25 '13 at 8:05
add comment

Your Answer


