|
-
May 20th, 2009, 12:56 AM
#1
Thread Starter
New Member
[RESOLVED] Application.Run
Hello All,
I am having a small 'head banging' experience working on one of our DLL products.
The problem I am having is that this application is an outlook addin, and as such, does not own its own Message Pump. No problems there, I have a UI class, which starts a thread, and calls Application.Run(new fControlForm)
I use the Application.Run passing a form, rather than an ApplicationContext purely because I want this form to be in charge of displaying other forms: ie, I can use BeginInvoke to ensure that a second, and many more forms are created in the context of the thread that owns the Message Pump.
I however feel this to be quite hackish. I get a form displayed at startup (which I am sure I can hide if I needed to)
My question: IS there any way to create some form of Invoke procedure in an applicationContext that uses the Message Pump thread? I have created a class which implements the ISynchronizeInvoke and can Invoke from a thread that it owns, however this is not the same as invoking from the Message Pump owner.
Any input will be greatly accepted.
-
Jun 18th, 2009, 12:42 AM
#2
Thread Starter
New Member
Re: Application.Run
Problem solved ..
I ended up creating a new SynchronizationContext, and applying it to the UI thread BEFORE calling Application.Run
Any forms that are displayed use this synchronizationContext to 'post' to. As such, all windows are created using the UI thread :-)
If anyone needs an example, please feel free to ask.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|