473,804 Members | 3,638 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

com interop

hi,
i need to know what interface ms-word's spell checker uses.
i got this example from msdn, that makes use of com interop.
i was wondering how do i get the interface IMediaContorl or any other (i am
interested in ms-words spell checker interface. )
thnx






// interop2.cs
using System;
using System.Runtime. InteropServices ;

namespace QuartzTypeLib
{
// Declare IMediaControl as a COM interface which
// derives from IDispatch interface:
[Guid("56A868B1-0AD4-11CE-B03A-0020AF0BA770"),
InterfaceType(C omInterfaceType .InterfaceIsDua l)]
interface IMediaControl // Cannot list any base interfaces here
{
// Note that IUnknown Interface members are NOT listed here:
void Run();
void Pause();

void Stop();

void GetState( [In] int msTimeout, [Out] out int pfs);

void RenderFile(
[In, MarshalAs(Unman agedType.BStr)] string strFilename);

void AddSourceFilter (
[In, MarshalAs(Unman agedType.BStr)] string strFilename,
[Out, MarshalAs(Unman agedType.Interf ace)]
out object ppUnk);

[return: MarshalAs(Unman agedType.Interf ace)]
object FilterCollectio n();

[return: MarshalAs(Unman agedType.Interf ace)]
object RegFilterCollec tion();

void StopWhenReady() ;
}
// Declare FilgraphManager as a COM coclass:
[ComImport, Guid("E436EBB3-524F-11CE-9F53-0020AF0BA770")]
class FilgraphManager // Cannot have a base class or
// interface list here.
{
// Cannot have any members here
// NOTE that the C# compiler will add a default constructor
// for you (no parameters).
}
}

class MainClass
{
/*************** *************** *************** *************
Abstract: This method collects the file name of an AVI to
show then creates an instance of the Quartz COM object.
To show the AVI, the program calls RenderFile and Run on
IMediaControl. Quartz uses its own thread and window to
display the AVI.The main thread blocks on a ReadLine until
the user presses ENTER.
Input Parameters: the location of the AVI file it is
going to display
Returns: void
*************** *************** *************** *************** */

public static void Main(string[] args)
{
// Check to see if the user passed in a filename:
// if (args.Length != 1)
// {
// DisplayUsage();
// return;
// }
//
// if (args[0] == "/?")
// {
// DisplayUsage();
// return;
// }

String filename = "movie.avi" ;//args[0];

// Check to see if the file exists
if (!System.IO.Fil e.Exists(filena me))
{
Console.WriteLi ne("File " + filename + " not found.");
DisplayUsage();
return;
}

// Create instance of Quartz
// (Calls CoCreateInstanc e(E436EBB3-524F-11CE-9F53-0020AF0BA770,
// NULL, CLSCTX_ALL, IID_IUnknown,
// &graphManager). ):
try
{
QuartzTypeLib.F ilgraphManager graphManager =
new QuartzTypeLib.F ilgraphManager( );

// QueryInterface for the IMediaControl interface:
QuartzTypeLib.I MediaControl mc =
(QuartzTypeLib. IMediaControl)g raphManager;

// Call some methods on a COM interface.
// Pass in file to RenderFile method on COM object.
mc.RenderFile(f ilename);

// Show file.
mc.Run();
}
catch(Exception ex)
{
Console.WriteLi ne("Unexpected COM exception: " + ex.Message);
}
// Wait for completion.
Console.WriteLi ne("Press Enter to continue.");
Console.ReadLin e();
}

private static void DisplayUsage()
{
// User did not provide enough parameters.
// Display usage.
Console.WriteLi ne("VideoPlayer : Plays AVI files.");
Console.WriteLi ne("Usage: VIDEOPLAYER.EXE filename");
Console.WriteLi ne("where filename is the full path and");
Console.WriteLi ne("file name of the AVI to display.");
}
}
Nov 16 '05 #1
2 2773
Frazer,

I am not sure what you are trying to do. The example you give deals
with showing a movie, and yet, you want the spell checker from word? If you
want to access Word functionality, you should be able to just add a
reference to the Word object library, and then access what you wish. In
this case, I would imagine the spell checker capability is something that
the Document object exposes.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"frazer" <ic***@hotmail. com> wrote in message
news:uT******** ******@TK2MSFTN GP11.phx.gbl...
hi,
i need to know what interface ms-word's spell checker uses.
i got this example from msdn, that makes use of com interop.
i was wondering how do i get the interface IMediaContorl or any other (i am interested in ms-words spell checker interface. )
thnx






// interop2.cs
using System;
using System.Runtime. InteropServices ;

namespace QuartzTypeLib
{
// Declare IMediaControl as a COM interface which
// derives from IDispatch interface:
[Guid("56A868B1-0AD4-11CE-B03A-0020AF0BA770"),
InterfaceType(C omInterfaceType .InterfaceIsDua l)]
interface IMediaControl // Cannot list any base interfaces here
{
// Note that IUnknown Interface members are NOT listed here:
void Run();
void Pause();

void Stop();

void GetState( [In] int msTimeout, [Out] out int pfs);

void RenderFile(
[In, MarshalAs(Unman agedType.BStr)] string strFilename);

void AddSourceFilter (
[In, MarshalAs(Unman agedType.BStr)] string strFilename,
[Out, MarshalAs(Unman agedType.Interf ace)]
out object ppUnk);

[return: MarshalAs(Unman agedType.Interf ace)]
object FilterCollectio n();

[return: MarshalAs(Unman agedType.Interf ace)]
object RegFilterCollec tion();

void StopWhenReady() ;
}
// Declare FilgraphManager as a COM coclass:
[ComImport, Guid("E436EBB3-524F-11CE-9F53-0020AF0BA770")]
class FilgraphManager // Cannot have a base class or
// interface list here.
{
// Cannot have any members here
// NOTE that the C# compiler will add a default constructor
// for you (no parameters).
}
}

class MainClass
{
/*************** *************** *************** *************
Abstract: This method collects the file name of an AVI to
show then creates an instance of the Quartz COM object.
To show the AVI, the program calls RenderFile and Run on
IMediaControl. Quartz uses its own thread and window to
display the AVI.The main thread blocks on a ReadLine until
the user presses ENTER.
Input Parameters: the location of the AVI file it is
going to display
Returns: void
*************** *************** *************** *************** */

public static void Main(string[] args)
{
// Check to see if the user passed in a filename:
// if (args.Length != 1)
// {
// DisplayUsage();
// return;
// }
//
// if (args[0] == "/?")
// {
// DisplayUsage();
// return;
// }

String filename = "movie.avi" ;//args[0];

// Check to see if the file exists
if (!System.IO.Fil e.Exists(filena me))
{
Console.WriteLi ne("File " + filename + " not found.");
DisplayUsage();
return;
}

// Create instance of Quartz
// (Calls CoCreateInstanc e(E436EBB3-524F-11CE-9F53-0020AF0BA770,
// NULL, CLSCTX_ALL, IID_IUnknown,
// &graphManager). ):
try
{
QuartzTypeLib.F ilgraphManager graphManager =
new QuartzTypeLib.F ilgraphManager( );

// QueryInterface for the IMediaControl interface:
QuartzTypeLib.I MediaControl mc =
(QuartzTypeLib. IMediaControl)g raphManager;

// Call some methods on a COM interface.
// Pass in file to RenderFile method on COM object.
mc.RenderFile(f ilename);

// Show file.
mc.Run();
}
catch(Exception ex)
{
Console.WriteLi ne("Unexpected COM exception: " + ex.Message);
}
// Wait for completion.
Console.WriteLi ne("Press Enter to continue.");
Console.ReadLin e();
}

private static void DisplayUsage()
{
// User did not provide enough parameters.
// Display usage.
Console.WriteLi ne("VideoPlayer : Plays AVI files.");
Console.WriteLi ne("Usage: VIDEOPLAYER.EXE filename");
Console.WriteLi ne("where filename is the full path and");
Console.WriteLi ne("file name of the AVI to display.");
}
}

Nov 16 '05 #2
what im trying to ask is how do i get the interface for IMediaControl like
this example in msdn has.
I want to know the way to get it so that i can get ms-words Interface.
thnx
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:e7******** ******@TK2MSFTN GP11.phx.gbl...
Frazer,

I am not sure what you are trying to do. The example you give deals
with showing a movie, and yet, you want the spell checker from word? If you want to access Word functionality, you should be able to just add a
reference to the Word object library, and then access what you wish. In
this case, I would imagine the spell checker capability is something that
the Document object exposes.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"frazer" <ic***@hotmail. com> wrote in message
news:uT******** ******@TK2MSFTN GP11.phx.gbl...
hi,
i need to know what interface ms-word's spell checker uses.
i got this example from msdn, that makes use of com interop.
i was wondering how do i get the interface IMediaContorl or any other (i

am
interested in ms-words spell checker interface. )
thnx






// interop2.cs
using System;
using System.Runtime. InteropServices ;

namespace QuartzTypeLib
{
// Declare IMediaControl as a COM interface which
// derives from IDispatch interface:
[Guid("56A868B1-0AD4-11CE-B03A-0020AF0BA770"),
InterfaceType(C omInterfaceType .InterfaceIsDua l)]
interface IMediaControl // Cannot list any base interfaces here
{
// Note that IUnknown Interface members are NOT listed here:
void Run();
void Pause();

void Stop();

void GetState( [In] int msTimeout, [Out] out int pfs);

void RenderFile(
[In, MarshalAs(Unman agedType.BStr)] string strFilename);

void AddSourceFilter (
[In, MarshalAs(Unman agedType.BStr)] string strFilename,
[Out, MarshalAs(Unman agedType.Interf ace)]
out object ppUnk);

[return: MarshalAs(Unman agedType.Interf ace)]
object FilterCollectio n();

[return: MarshalAs(Unman agedType.Interf ace)]
object RegFilterCollec tion();

void StopWhenReady() ;
}
// Declare FilgraphManager as a COM coclass:
[ComImport, Guid("E436EBB3-524F-11CE-9F53-0020AF0BA770")]
class FilgraphManager // Cannot have a base class or
// interface list here.
{
// Cannot have any members here
// NOTE that the C# compiler will add a default constructor
// for you (no parameters).
}
}

class MainClass
{
/*************** *************** *************** *************
Abstract: This method collects the file name of an AVI to
show then creates an instance of the Quartz COM object.
To show the AVI, the program calls RenderFile and Run on
IMediaControl. Quartz uses its own thread and window to
display the AVI.The main thread blocks on a ReadLine until
the user presses ENTER.
Input Parameters: the location of the AVI file it is
going to display
Returns: void
*************** *************** *************** *************** */

public static void Main(string[] args)
{
// Check to see if the user passed in a filename:
// if (args.Length != 1)
// {
// DisplayUsage();
// return;
// }
//
// if (args[0] == "/?")
// {
// DisplayUsage();
// return;
// }

String filename = "movie.avi" ;//args[0];

// Check to see if the file exists
if (!System.IO.Fil e.Exists(filena me))
{
Console.WriteLi ne("File " + filename + " not found.");
DisplayUsage();
return;
}

// Create instance of Quartz
// (Calls CoCreateInstanc e(E436EBB3-524F-11CE-9F53-0020AF0BA770,
// NULL, CLSCTX_ALL, IID_IUnknown,
// &graphManager). ):
try
{
QuartzTypeLib.F ilgraphManager graphManager =
new QuartzTypeLib.F ilgraphManager( );

// QueryInterface for the IMediaControl interface:
QuartzTypeLib.I MediaControl mc =
(QuartzTypeLib. IMediaControl)g raphManager;

// Call some methods on a COM interface.
// Pass in file to RenderFile method on COM object.
mc.RenderFile(f ilename);

// Show file.
mc.Run();
}
catch(Exception ex)
{
Console.WriteLi ne("Unexpected COM exception: " + ex.Message);
}
// Wait for completion.
Console.WriteLi ne("Press Enter to continue.");
Console.ReadLin e();
}

private static void DisplayUsage()
{
// User did not provide enough parameters.
// Display usage.
Console.WriteLi ne("VideoPlayer : Plays AVI files.");
Console.WriteLi ne("Usage: VIDEOPLAYER.EXE filename");
Console.WriteLi ne("where filename is the full path and");
Console.WriteLi ne("file name of the AVI to display.");
}
}


Nov 16 '05 #3

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

Similar topics

0
2364
by: roy | last post by:
I try to call com written in VB 6.0. When I use VS.net Studio to do the debuging, some time it works fine, some time I got the following message: Server Error in '/GISOnlineReservation' Application. ----------------------------------------------------------- --------------------- Configuration Error Description: An error occurred during the processing of a
0
1570
by: roy | last post by:
I try to call com written in VB 6.0., some time it works fine, some time I got the following message: Server Error in '/GISOnlineReservation' Application. ----------------------------------------------------------- --------------------- Configuration Error Description: An error occurred during the processing of a configuration file required to service this request.
0
2294
by: keefah | last post by:
Hi, I'm writing a C# web app that uses Outlook to send email. I use a reference to the Microsoft Outlook 11.0 Object Library, but it's giving me problems. I tracked down some stuff on the Net about the global assembly cache (GAC) and primary interop assemblies (PIA) and so forth, and did all the recommendations, in terms of tweeking Office, installing the .NET Office stuff for framework 1.1, etc. I got it to the point where it compiles ok,...
0
2794
by: lacour | last post by:
I can't seem to figure out the difference between adding a COM dll reference in VS2003 and by using TLBIMP. I have a COM dll that references another COM dll, and I want the syntax of my interop-filenames to be interop.<NameOfCOMDLL>.dll I now make the first interop file tlbimp COM1.dll /out:interop.COM1.dll /namespace:COM1
1
1999
by: Nadav | last post by:
Hi, Introduction *************** I have a system build of a collection of 'Native COM objects' and '.NET COM interop' objects, all of the COM objects are managed through a 'Native COM' layer, this layer manage the underlying COM Objects and upon request, provide a pointer to those objects to the 'API Consumer', following is an illustration of the system: API Consumer ( Native C++/C# ) || ******************************************* * ...
8
3426
by: Rob Edwards | last post by:
When trying to add the Microsoft CDO for Exchange Management Library (aka CDOEXM.dll) I receive the following message: "A reference to 'Microsoft CDO for Exchange Management Library' could not be added. Converting the type library to a .Net assembly failed. A depended type library 'CDO' could not be converted to a .NET assembly. A dependent type library 'ADODB' could not be converted to a .NET assembly. Item has already been added." ...
7
10966
by: R Reyes | last post by:
Can someone please explain to me why I can't get the MS Word Interop assembly to work in my VS2005 project? I'm trying to manipulate MS Word from my Web Form application and I can't get passed this screen below. Please help, thanks in advance... Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify...
2
7307
by: JC | last post by:
Anybody knows what problem has this code? I think, in the Garbage Collector? You know the Solution? The program in the test's case, whit 350 contacts, run OK before number 86. The error is a "Array index out of bounds". Microsoft.Office.Interop.Outlook._Application olApp = new Microsoft.Office.Interop.Outlook.ApplicationClass(); Microsoft.Office.Interop.Outlook._NameSpace olNs = olApp.GetNamespace("MAPI");
1
2872
by: allbelonging | last post by:
C#.Net Outlook 2003 automation (programmatically) with Office.Interop.Outlook Problem: I have my outlook 2003 configured with multiple mailbox on my local machine. I want to specify the mailbox and server (Exchange server mail box) to connect and then save the mailitems(from Inbox or any other folder) based on a filter to a*.msg file. I want to achieve this using only one Interop dll if this is possible. Tried so far:
0
2060
by: Tina | last post by:
I've gotten this before where it says there is a problem with Interop.MSDASC but I can't remember what causes this. This is a 1.1 app I'm trying to debug in vs2005. It was running yesterday just fine. Help! T Server Error in '/VT.Users' Application. -------------------------------------------------------------------------------- Configuration Error
0
10575
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10330
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10076
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9144
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6851
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4297
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3816
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.