QueryStatus Implementation

  • Thread starter Thread starter Sujoan
  • Start date Start date
S

Sujoan

Hi,
Can somebody say how to implement IOLECommandTarget's QueryStatus in
C#.My problem is to handle a toolbar button click..

Thanks and Regards,
Sudha.
 
Hello,

Try the following code to define the IOLECommandTarget implementation.

Regards

using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential,CharSet=CharSet.Unicode)]
public struct OLECMDTEXT
{
public uint cmdtextf;
public uint cwActual;
public uint cwBuf;
[MarshalAs(UnmanagedType.ByValTStr,SizeConst=100)]public char rgwz;
}

[StructLayout(LayoutKind.Sequential)]
public struct OLECMD
{
public uint cmdID;
public uint cmdf;
}

[ComImport,
Guid("b722bccb-4e68-101b-a2bc-00aa00404770"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IOleCommandTarget
{
void QueryStatus(ref Guid pguidCmdGroup, UInt32 cCmds,
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex=1)] OLECMD[] prgCmds, ref
OLECMDTEXT CmdText);
void Exec(ref Guid pguidCmdGroup, uint nCmdId, uint nCmdExecOpt, ref object
pvaIn, ref object pvaOut);
}
 
Hello Sir,
Thank u sir.Can you please direct me to any sample codes on
Querystatus and Exec method implementations in C# to get an idea so as
to customize for my project. I could get codes only in VC++. I am new
to this area sir.

Thamks and Regards,
Sujoan.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top