473,386 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Is there a better way to marshal an interface across streams that is STA?

WTH
I set my Main() to use MTA which works for me, but I wanted to know if
there's a C# class/namespace somewhere that supports/offers the ability to
reproduce what the 'marshal interface into stream' and 'un-marshal interface
from stream' calls in C++?

Thanks,

WTH

--
"This is the best club I have played for. Everything about it is perfect;
the stadium, the training ground, the supporters and the management staff.
Sometimes the weather isn't the best but I can cope with that!" - Markus
Babbel
Jul 27 '06 #1
2 1514
WTH,

Is there any particular reason you are using an MTA with your program?
If this is a Windows Forms app, you really need to set it to STA, so that
the controls are guaranteed to work as advertised (some of them will not).

To answer your question, there is nothing in the framework to help with
this kind of marshaling. You will have to call the API's through interop
yourself.

What exactly are you trying to do?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"WTH" <sp*******@Ih8it.comwrote in message
news:On**************@TK2MSFTNGP02.phx.gbl...
>I set my Main() to use MTA which works for me, but I wanted to know if
there's a C# class/namespace somewhere that supports/offers the ability to
reproduce what the 'marshal interface into stream' and 'un-marshal
interface from stream' calls in C++?

Thanks,

WTH

--
"This is the best club I have played for. Everything about it is perfect;
the stadium, the training ground, the supporters and the management staff.
Sometimes the weather isn't the best but I can cope with that!" - Markus
Babbel


Jul 27 '06 #2
WTH
Nicholas Paldino [.NET/C# MVP] <mv*@spam.guard.caspershouse.comloquated
like no one had ever loquated before with:
WTH,

Is there any particular reason you are using an MTA with your
program? If this is a Windows Forms app, you really need to set it to
STA, so that the controls are guaranteed to work as advertised (some
of them will not).
To answer your question, there is nothing in the framework to help
with this kind of marshaling. You will have to call the API's
through interop yourself.

What exactly are you trying to do?
Thanks for the caveat about MTA and controls. This is a very simple form
which shows video, I have a per-form thread that instantiates a copy of my
C++ MPEG4 compression COM object (wraps up DirectShow and some other stuff
for me) but for various reasons I want the compressor initialized prior to
the form's worker thread running so I need to pass the interface to the
worker thread.

I'll reconsider the reasons behind not having the worker thread
create/initialize/hold the COM object entirely, but it kept some things
simpler that way (although quite obviously introducing complexity here,
LOL.)

Thanks for the heads up, as a long-time C++ guy absorbing .NET I certainly
appreciate those types of warnings.

WTH:)

--
"Shaun Wright-Phillips has got a big heart. It's as big as him, which
isn't very big, but it's bigger." - Kevin Keegan
Jul 27 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Sean C. | last post by:
Helpful folks, Most of my previous experience with DB2 was on s390 mainframe systems and the optimizer on this platform always seemed very predictable and consistent. Since moving to a WinNT/UDB...
2
by: Mountain Bikn' Guy | last post by:
It is known that one cannot pass arguments as ref or out in a marshal-by-reference class. My problem is that I have a C DLL (and C# wrapper) that I need to isolate in an AppDomain and then I need...
8
by: SDS | last post by:
VS 2005 / .NET 2.0.50727 (Sept. CTP) I've got a Windows Service application that I've pushed out to a few other workstations. There is an unhandled except occurring somewhere in the application...
21
by: Mike | last post by:
Hi, The example below shows that result of a marshaled data structure is nothing but a string >>> data = {2:'two', 3:'three'} >>> import marshal >>> bytes = marshal.dumps(data) >>>...
20
by: Frank Rizzo | last post by:
I have a class that handles events from another class. Unfortunately these events arrive on a different thread. How can I marshal the code execution to the thread on which the caller class was...
10
by: David Fort | last post by:
Hi, I'm upgrading a VB6 app to VB.net and I'm having a problem with a call to a function provided in a DLL. The function takes the address of a structure which it will fill in with values. I...
1
by: Frankie | last post by:
I have been learning about asynchronous method calls and I keep coming across this term, "marshal" and I would like to know what it means - specifically. AFAIKT, it means "send" but I suspect there...
4
by: cleanrabbit | last post by:
Hello! I hate having to do this, because im almost certain there is someone in the world that has come across this problem and i just havent found their solution yet, so i do appologise if this...
1
by: David Hirschfield | last post by:
I had a situation recently that required I manually load python bytecode from a .pyc file on disk. So, for the most part, I took code from imputil.py which loads the .pyc data via the marshal...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.