Threads con COM

10/07/2006 - 08:52 por Juan Cuello | Informe spam
Hola a todos.

Tengo una cuestión que preguntar:

Resulta que no tengo ningún problema en ejecutar una función de .NET en un
thread secundario. El problema está en que, si esa función ejecuta algún
método de una DLL COM (desgraciadamente tengo que usarla) me salta una
excepción diciéndome algo de interfaces COM.

¿Alguien sabe como ejecutar una función de COM en un hilo secundario sin que
falle?


Gracias y un sALUDO
AP Software Development
 

Leer las respuestas

#1 Angel. E. Ruiz. P
10/07/2006 - 15:45 | Informe spam
Sorry me equivoque... esta respuesta no es para este pregunta sorry


"Angel. E. Ruiz. P" escribió en el mensaje
news:%
Amigo revisa este articulo:
http://www.sunlightd.com/Windows/DirectX.NET/

Update
This tutorial explores the interworking of DirectX 8 with the .NET
Framework. After the writing of this article, some details of DirectX 9
have appeared.

DirectX 9 will include 'Managed DirectX'. This appears to be a C++ .NET
wrapper around the DirectX classes. This should sound somewhat familiar...
Microsoft will produce a more complete implementation than I have the time
to produce, so I will wait for DirectX 9 before the next version of this
tutorial.

First details of DirectX 9 indicate that it will include managed wrappers
for Direct3D 9, DirectDraw 7, DirectSound, DirectPlay and DirectInput 8.
This means no DirectShow and no DirectMusic. It may seem odd to you that
Microsoft would support DirectDraw and DirectSound over the latter two; it
certainly seems odd to me.

Please note that the above observations relate to a beta release of
DirectX 9; there is no guarantee that they will apply to the released
version. Microsoft may, of course, decide to let their .NET framework
commit client-side suicide by not releasing Managed DirectX at all.

The techniques described in this tutorial will continue to work with the
new version of DirectX. DirectX 9 is expected in late October.

Introduction
In this tutorial, we will investigate the interoperation of DirectX with
the Microsoft .NET Framework. We will use the knowledge of DirectX gained
in the DirectX tutorial to build a DirectX .NET wrapper, then use that in
C# and Visual Basic.NET applications.

Existing .NET DirectX samples use the DirectX Visual Basic type library.
While this is adequate for some purposes, it makes working with vertex
buffers difficult, and generally lacks the flexibility offered by the COM
API. For this reason, and for the reason that it needs as much description
as anything else, we will create a C++.NET class library wrapper for the
parts of DirectX we plan to use.

We will first explore the class hierarchy. We will then go on to implement
each of the classes in the hierarchy, learning about C++.NET
interoperation concepts as we go. Finally, we will explore the fruits of
our exploration and class library by building two sample applications
using the class library: a version of the test program in the DirectX
tutorial, and a 'Snake'-type game.



For this tutorial, you will need a working knowledge of C++.NET, C#.NET or
VB.NET, as well as an understanding of the concepts underlying .NET. This
is not a general .NET tutorial; these can be found in the .NET Framework
SDK, as well as plenty of places on the Internet. You will also need to
have a working knowledge of the various components of DirectX. A DirectX
tutorial can be found here.

You will also need a .NET compiler. Currently, these are supplied with the
.NET Framework SDK. I strongly recommend using Microsoft Visual Studio
.NET on Windows 2000 or XP. The samples can also be compiled using the
.NET compilers alone, on Windows 2000, XP or Windows 98/ME.

To explore the class library implementation, you will need a thorough
knowledge of C++, and of DirectX. If you do not have this knowledge, you
can skip the class library implementation chapters and go directly from
the hierarchy to the descriptions of the sample applications.

Downloads
a.. Download this tutorial in ZIP format (does not include code ZIP
files, 180k).
b.. Download the complete source code for the C++.NET class library.
Required to build the samples.
a.. View build instructions for the C++.NET class library.
c.. Download the source code for the DXTest C# sample.
d.. Download the source code for the DXTest VB.NET sample.
e.. Download the graphics and sound effects for the DXTest samples (25k).
f.. Download the source code for the Snake C# sample.

g.. Download the source code for the Snake VB.NET sample.
h.. Download the graphics and sound effects for the Snake samples
(1.25MB).
Table of Contents
a.. Class Library Hierarchy
b.. Building the Library
c.. Implementing Graphics: Basic Objects
d.. Implementing Graphics: Sprites
e.. Implementing Input
f.. Implementing Sound and Music: DirectMusic
g.. Implementing Sound and Music: DirectShow
h.. Infrastructure and Error Handling
i.. Sample Application: DXTest
a.. C#: DXTestCS
b.. VB.NET: DXTestVB
j.. Sample Application: Snake
a.. C#: SnakeCS
b.. VB.NET: SnakeVB
Saludos cordiales,
Ángel Ruiz
MCP C#
MVP de Visual Basic desde 2004
Caracas - Venezuela
"El conocimiento es un bien, que crece a medida que se comparte"

"Juan Cuello" escribió en el
mensaje news:
Hola a todos.

Tengo una cuestión que preguntar:

Resulta que no tengo ningún problema en ejecutar una función de .NET en
un
thread secundario. El problema está en que, si esa función ejecuta algún
método de una DLL COM (desgraciadamente tengo que usarla) me salta una
excepción diciéndome algo de interfaces COM.

¿Alguien sabe como ejecutar una función de COM en un hilo secundario sin
que
falle?


Gracias y un sALUDO
AP Software Development






Preguntas similares