Click here to Skip to main content
15,914,160 members
Home / Discussions / COM
   

COM

 
GeneralRe: MY very own language Pin
MohammadAmiry3-Oct-04 3:37
MohammadAmiry3-Oct-04 3:37 
GeneralRe: MY very own language Pin
Jörgen Sigvardsson3-Oct-04 8:05
Jörgen Sigvardsson3-Oct-04 8:05 
GeneralRe: MY very own language Pin
MohammadAmiry8-Oct-04 5:30
MohammadAmiry8-Oct-04 5:30 
QuestionIRegExp problem ? Pin
necroleak1-Oct-04 23:22
sussnecroleak1-Oct-04 23:22 
AnswerRe: IRegExp problem ? Pin
Jörgen Sigvardsson3-Oct-04 8:09
Jörgen Sigvardsson3-Oct-04 8:09 
GeneralAfxOleInit and CoInitializeEx Pin
Shao Voon Wong1-Oct-04 5:51
mvaShao Voon Wong1-Oct-04 5:51 
GeneralRe: AfxOleInit and CoInitializeEx Pin
Jörgen Sigvardsson7-Oct-04 13:22
Jörgen Sigvardsson7-Oct-04 13:22 
GeneralIOleCommandTarget in a .net COM server! HELP! HELP!! Pin
SmallUmka1-Oct-04 1:00
SmallUmka1-Oct-04 1:00 
Hi!
I implement IOleCommandTarget in a .net COM server.
Here's my code. I'm trying to implement an object that can be used as a
COM object for a button in IE. I get a System.ExecutionEngineException when hitting the button (.

---------------------------------implement------------------------------------------
// Import IOleCommandTarget interface
[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;
}

// Interop definition for IOleCommandTarget.
[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);
}
-----------------------------------implement----------------------------------------

-----------------------------------using----------------------------------------
[ClassInterfaceAttribute(ClassInterfaceType.None)]
[GuidAttribute("81AC67A9-1511-4104-93AC-BD8BFEC93F71")]
[ProgIdAttribute("MyDll.dll")]
public class GetURL: IObjectWithSite, IOleCommandTarget
{
protected SHDocVw.IWebBrowser2
m_pIWebBrowser2; // the browser class object

public GetURL()
{
}


public void SetSite(object pUnkSite)
{
// MessageBox.Show("SetSite");

if (m_pIWebBrowser2!=null)
Release();

if (pUnkSite==null)
return;
IServiceProvider isp = (IServiceProvider)pUnkSite;
try
{
//!!!!!получаем указатель на SHDocVw.IWebBrowser2 через IServiceProvider а не QueryInterface
Guid g1 = typeof(SHDocVw.IWebBrowserApp).GUID;
Guid g2 = typeof(SHDocVw.IWebBrowser2).GUID;
object obj;
//isp.RemoteQueryService( ref g1, ref g2, out m_pIWebBrowser2 );
isp.QueryService( ref g1, ref g2, out obj );
//получили объект и преобразуем его к SHDocVw.IWebBrowser2
m_pIWebBrowser2 = (SHDocVw.IWebBrowser2)obj;


}
catch(System.Runtime.InteropServices.COMException ex)
{
//
}
MessageBox.Show(m_pIWebBrowser2.ToString());
}

public void GetSite(ref System.Guid riid, out object ppvSite)
{
ppvSite = m_pIWebBrowser2;
try
{
//
}
catch(Exception ex)
{
MessageBox.Show(ex.Message + " GetSite");
}
}

public void QueryStatus(ref Guid pguidCmdGroup, UInt32 cCmds, OLECMD[] prgCmds, ref OLECMDTEXT CmdText)
{
MessageBox.Show ("Query status");
}
public void Exec(ref Guid pguidCmdGroup, uint nCmdId, uint nCmdExecOpt, ref object pvaIn, ref object pvaOut)
{
MessageBox.Show ("Execing");
}


}
-----------------------------------using----------------------------------------
In what a mistake? Help! Plz!!

GeneralDCOM on Windows 2003: error in COM-client Pin
RadioShark30-Sep-04 2:05
RadioShark30-Sep-04 2:05 
GeneralRe: DCOM on Windows 2003: error in COM-client Pin
Milton Karimbekallil4-Oct-04 0:12
Milton Karimbekallil4-Oct-04 0:12 
Question.Net COM alternative?? Pin
Gammill29-Sep-04 11:33
Gammill29-Sep-04 11:33 
AnswerRe: .Net COM alternative?? Pin
ursus zeta29-Sep-04 14:18
ursus zeta29-Sep-04 14:18 
Questioncan someone recommend a COM book? Pin
liyang yu29-Sep-04 3:31
liyang yu29-Sep-04 3:31 
AnswerRe: can someone recommend a COM book? Pin
Gammill29-Sep-04 11:22
Gammill29-Sep-04 11:22 
GeneralEssential COM Pin
ursus zeta30-Sep-04 6:22
ursus zeta30-Sep-04 6:22 
GeneralRegsvr32 writes an error Pin
Rassul Yunussov28-Sep-04 7:58
Rassul Yunussov28-Sep-04 7:58 
GeneralRe: Regsvr32 writes an error Pin
geo_m12-Oct-04 21:17
geo_m12-Oct-04 21:17 
GeneralRe: Regsvr32 writes an error Pin
Rassul Yunussov14-Oct-04 5:37
Rassul Yunussov14-Oct-04 5:37 
GeneralRe: Regsvr32 writes an error Pin
geo_m14-Oct-04 19:44
geo_m14-Oct-04 19:44 
GeneralRe: Regsvr32 writes an error Pin
Eurosid21-Jul-05 6:04
Eurosid21-Jul-05 6:04 
GeneralPLS HELP : CreateInstance (__uuidof(SHDocVw::ShellWindows) failed Pin
SenPy28-Sep-04 7:23
SenPy28-Sep-04 7:23 
GeneralRe: PLS HELP : CreateInstance (__uuidof(SHDocVw::ShellWindows) failed Pin
4apai30-Sep-04 23:07
4apai30-Sep-04 23:07 
Generalchanging the stack size in DLL Pin
Anonymous28-Sep-04 5:57
Anonymous28-Sep-04 5:57 
GeneralRe: changing the stack size in DLL Pin
darkbyte29-Sep-04 4:09
darkbyte29-Sep-04 4:09 
GeneralAdd-ins, creating using Visual C++ : Help! Pin
agentnem27-Sep-04 18:46
agentnem27-Sep-04 18:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.