468,457 Members | 1,615 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,457 developers. It's quick & easy.

Threads, Processes .NET 2.0 - Drag and Drop Registration

1
Hi, I have a Drag and Drop registration problem (See http://www.thescripts.com/forum/thread434707.html for similar problem post), can anyone out thereadvise on the best solution?
I have a .NET 2.0 application (actually in C#) called from a third party piece of software via VBScript. The VB script passes an object as a parameter which my application applies changes to.
My C# application dynamically creates a form, which includes controls extended from the RichTextBoxControl. These controls need to support drag and drop.
I also need to ensure that the calling application can not receive mouse/keyboard events until my application stops.

If I call my application directly from the VB script I get a drag and Drop registration exception.

I have tried starting my application via a bridging application which starts the app as a separate process (and waits for it to exit) - my app works OK but I can't pass the required parameter using this method.

I have also tried the following code to create my form in a new STA thread:
//public method called via VB script
public void launchApp(object oParam)
{
Thread t = new Thread(new ParameterizedThreadStart(formCreator));
t.SetApartmentState(ApartmentState.STA);
t.Start(oParam);

}

//Form creator in separate thread to avoid Drag Drop registration problems
static public void formCreator(object oParam)
{
frmMyDynamicForm frm = new frmMyDynamicForm(oParam);
frm.ShowDialog();
}

This has two problems.
1. Although I don't get Drag and Drop regestration exception, drag and drop still does not work. Another form allows a drag operation to start OK, and my DragEnter event handler on my extended richTextBoxControl is called but the code " e.Effect = DragDropEffects.Link;" line is ignored and the "Can't drop" icon is displayed.
2. The calling application can get focus.

I am tearing my hair out (I have only documented a 2 of many attempted solutions), can anyone offer advice?

Any suggestions would be much appreciated. Thanks!
Aug 21 '06 #1
0 2165

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by SamSpade | last post: by
3 posts views Thread by Ajay Krishnan Thampi | last post: by
2 posts views Thread by Dante | last post: by
reply views Thread by Urs Vogel | last post: by
6 posts views Thread by jojobar | last post: by
3 posts views Thread by Eric S. Johansson | last post: by
7 posts views Thread by Raj Wall | last post: by
1 post views Thread by haplo | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.