|
-
Sep 4th, 2009, 03:34 AM
#1
Thread Starter
Fanatic Member
Big threading problem
Hi All,
Heres my problem.
I have a standard windows application called winap.
I have a com component which acts as an api to the winap.
I have a class in winap call classapi which has all the methods that the api calls and all works well.
The problem is that one of the methods in my class api needs to get a handle on form elements in the main worker thread. Whenever I try to access an existing form I keep getting null because the for exists in the main worker thread and my api call is in a seperate thread.
Any ideas how I can overcome this?
Is it possible ?
Thanks In advance
-
Sep 4th, 2009, 04:12 AM
#2
Re: Big threading problem
Forms don't exist in any thread. They just exist. Threads are not about data; they are about instructions. Instructions are executed on a specific thread but all those instructions have access to exactly the same data.
You're going to have to explain more clearly your situation because I can't tell whether you're saying that your app is making calls to this COM API or your app is providing this API to COM components.
-
Sep 4th, 2009, 04:33 AM
#3
Thread Starter
Fanatic Member
Re: Big threading problem
OK. I'll try and be a little clearer tyhough to be honest I have been looking at this for so long I am confusing myself.
I have a testbed VB 6.0 application which references my COM component which is a COM callable .net assembly.
One of the COM methods is "Show Form 1()".
My COM callable assembly is part of my .net windows soultion. When building my solution it auto registers the COM bit.
When the VB 6.0 application calls "Show Form 1()" the COM object itself calls a method in my Winap which is supposed to do the work of showing the actual form. This code fires without any problems. I placed a messagebox in this method and it opens fine but it opens in a different thread as it is not modal as far as the winap is concerned.
I cannot for the life of me reference any existing properties in the main application as they are in a different thread.
For example when my winap first loads it sets a bunch of static properties so I can access them anywhere. winapp.Global.Variables.UserSettings["CuirrentUser"] in my winapp will always return "VenerableBede" but when I try this via the COM call it is always NULL.
Man I am even more confused.
If you get this you are a genius.
Jeez jmcilhinney. I have jsut noticed...over 50,000 posts. WOW. Do you live here ?
-
Sep 4th, 2009, 05:07 AM
#4
Thread Starter
Fanatic Member
Re: Big threading problem
Because I am dealing with 2 different app domains I think I may have to go down the COM+ route which I would prefer to avoid but I can't think of any other way.
This is a nasty one.
-
Sep 5th, 2009, 05:06 AM
#5
Re: Big threading problem
Isn't the problem that you are actually dealing with two different instances of data? You aren't sharing the same form in your vb6 app and your .net one.
-
Sep 5th, 2009, 09:12 AM
#6
Re: Big threading problem
 Originally Posted by Edneeis
Isn't the problem that you are actually dealing with two different instances of data? You aren't sharing the same form in your vb6 app and your .net one.
My thoughts exactly, I dont think this has anything to do with threading. I've never done any COM stuff at all though so I dont think I can help I'm afraid..
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
|