471,348 Members | 1,358 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,348 software developers and data experts.

Why can't I create a Form in a com-object?

I'm trying to create and display a Form in an inproc COM server using
C# and it is locking up. It's intermittent, but happens more often
than not.

The following code demonstrates the problem - the Form is

Can anyone explain why this is happening?

using System.Windows.Forms;
using System.Reflection;
using System.Runtime.InteropServices;

[assembly: AssemblyDescription("TestComServerLockup 1.0 Type
[assembly: AssemblyVersion("")]
[assembly: Guid("431F88DF-A2B4-4669-841B-ED2A2316676A")]

public interface ITestComServerLockup {
[DispId(1)] void LockUp();

public class TestComServerLockup : ITestComServerLockup {
public void LockUp() {
Form f = new Form();
f.Name = "Test Form";
f.Text = "Test Form";

To build:
csc /target:library /r:System.Windows.Forms.dll TestComServerLockup.cs
regasm TestComServerLockup.dll /codebase

I'm testing it with python + win32 extentions. C++ clients exhibit
the same behavior.
python -c "from win32com.client import Dispatch;
Sep 10 '08 #1
0 772

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by Bob Garbados | last post: by
6 posts views Thread by skgolden | last post: by
2 posts views Thread by mpanwar1 | last post: by
1 post views Thread by Ronak mishra | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.