473,387 Members | 1,493 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,387 software developers and data experts.

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(ComInterfaceType.InterfaceIsDual)]
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(UnmanagedType.BStr)] string strFilename);

void AddSourceFilter(
[In, MarshalAs(UnmanagedType.BStr)] string strFilename,
[Out, MarshalAs(UnmanagedType.Interface)]
out object ppUnk);

[return: MarshalAs(UnmanagedType.Interface)]
object FilterCollection();

[return: MarshalAs(UnmanagedType.Interface)]
object RegFilterCollection();

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.File.Exists(filename))
{
Console.WriteLine("File " + filename + " not found.");
DisplayUsage();
return;
}

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

// QueryInterface for the IMediaControl interface:
QuartzTypeLib.IMediaControl mc =
(QuartzTypeLib.IMediaControl)graphManager;

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

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

private static void DisplayUsage()
{
// User did not provide enough parameters.
// Display usage.
Console.WriteLine("VideoPlayer: Plays AVI files.");
Console.WriteLine("Usage: VIDEOPLAYER.EXE filename");
Console.WriteLine("where filename is the full path and");
Console.WriteLine("file name of the AVI to display.");
}
}
Nov 16 '05 #1
2 2750
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.com

"frazer" <ic***@hotmail.com> wrote in message
news:uT**************@TK2MSFTNGP11.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(ComInterfaceType.InterfaceIsDual)]
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(UnmanagedType.BStr)] string strFilename);

void AddSourceFilter(
[In, MarshalAs(UnmanagedType.BStr)] string strFilename,
[Out, MarshalAs(UnmanagedType.Interface)]
out object ppUnk);

[return: MarshalAs(UnmanagedType.Interface)]
object FilterCollection();

[return: MarshalAs(UnmanagedType.Interface)]
object RegFilterCollection();

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.File.Exists(filename))
{
Console.WriteLine("File " + filename + " not found.");
DisplayUsage();
return;
}

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

// QueryInterface for the IMediaControl interface:
QuartzTypeLib.IMediaControl mc =
(QuartzTypeLib.IMediaControl)graphManager;

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

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

private static void DisplayUsage()
{
// User did not provide enough parameters.
// Display usage.
Console.WriteLine("VideoPlayer: Plays AVI files.");
Console.WriteLine("Usage: VIDEOPLAYER.EXE filename");
Console.WriteLine("where filename is the full path and");
Console.WriteLine("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.com> wrote in
message news:e7**************@TK2MSFTNGP11.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.com

"frazer" <ic***@hotmail.com> wrote in message
news:uT**************@TK2MSFTNGP11.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(ComInterfaceType.InterfaceIsDual)]
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(UnmanagedType.BStr)] string strFilename);

void AddSourceFilter(
[In, MarshalAs(UnmanagedType.BStr)] string strFilename,
[Out, MarshalAs(UnmanagedType.Interface)]
out object ppUnk);

[return: MarshalAs(UnmanagedType.Interface)]
object FilterCollection();

[return: MarshalAs(UnmanagedType.Interface)]
object RegFilterCollection();

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.File.Exists(filename))
{
Console.WriteLine("File " + filename + " not found.");
DisplayUsage();
return;
}

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

// QueryInterface for the IMediaControl interface:
QuartzTypeLib.IMediaControl mc =
(QuartzTypeLib.IMediaControl)graphManager;

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

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

private static void DisplayUsage()
{
// User did not provide enough parameters.
// Display usage.
Console.WriteLine("VideoPlayer: Plays AVI files.");
Console.WriteLine("Usage: VIDEOPLAYER.EXE filename");
Console.WriteLine("where filename is the full path and");
Console.WriteLine("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
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'...
0
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....
0
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...
0
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...
1
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,...
8
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...
7
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...
2
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...
1
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...
0
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...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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
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.