Click here to Skip to main content
15,888,521 members
Home / Discussions / C#
   

C#

 
QuestionVideo Download's No Idea!!! Pin
s4n4t4n1-Feb-09 7:49
s4n4t4n1-Feb-09 7:49 
AnswerRe: Video Download's No Idea!!! Pin
harold aptroot1-Feb-09 9:18
harold aptroot1-Feb-09 9:18 
Questionobtaining local lan address,,, Pin
Mubeen.asim1-Feb-09 7:28
Mubeen.asim1-Feb-09 7:28 
AnswerRe: obtaining local lan address,,, Pin
CPallini1-Feb-09 8:03
mveCPallini1-Feb-09 8:03 
GeneralRe: obtaining local lan address,,, Pin
Mubeen.asim1-Feb-09 8:04
Mubeen.asim1-Feb-09 8:04 
Questionaccessing shared database... Pin
Mubeen.asim1-Feb-09 6:43
Mubeen.asim1-Feb-09 6:43 
AnswerRe: accessing shared database... Pin
Mubeen.asim1-Feb-09 7:24
Mubeen.asim1-Feb-09 7:24 
QuestionCustom IE button calling BHO Pin
Haim Nachum1-Feb-09 6:32
Haim Nachum1-Feb-09 6:32 
Im trying to build a simple bho object that handles a custom IE button click event.

Ive created the needed interfaces(IOleCommandTarget,IServiceProvider,IOBJECTWITHSITE )

i have the following SetSite function implementation:
public int SetSite(object site)
        {
            SHDocVw.IWebBrowser2 m_pIWebBrowser2 = site as SHDocVw.IWebBrowser2;
            IServiceProvider ISP = site as IServiceProvider;

            if (m_pIWebBrowser2 != null)
            {
                Marshal.ReleaseComObject(m_pIWebBrowser2);
                m_pIWebBrowser2 = null;
            }

            if (Explorer != null)
            {
                Marshal.ReleaseComObject(Explorer);
                Explorer = null;
            }

            if (ISP != null)
            {
                Guid IID_IUnknown = new
                Guid("{00000000-0000-0000-C000-000000000046}");
                Guid IID_IWebBrowserApp = new
                Guid("{0002DF05-0000-0000-C000-00000000046}");
                object pOut;

                try
                {
                    ISP.QueryService(ref IID_IWebBrowserApp, ref IID_IUnknown, out
                    pOut);
                    Explorer = (WebBrowserClass)Marshal.CreateWrapperOfType(pOut as
                    IWebBrowser2, typeof(WebBrowserClass));
                }
                catch (Exception e)
                {
                    System.Windows.Forms.MessageBox.Show(e.Message, "Talkative Browser");
                }
            }


when im debugging i can see that the function is called twice, once when the browser is opend and two when i click my button.
i provided an IServiceProvider interface to look for the browser handle when i click my button(it seems it is sending ISHELLBROWSER pointer to my SetSite).
Everything is working fine except the Exec function implemented by the IOLECOMMANDTARGET interface is not being called.

here is my IOLECOMMANDTARGET code:

[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);
    }



can anybody point me a direction for solving the problem?
QuestionSaving text file with StreamWriter Pin
Mark F.1-Feb-09 5:27
Mark F.1-Feb-09 5:27 
AnswerRe: Saving text file with StreamWriter Pin
PIEBALDconsult1-Feb-09 6:42
mvePIEBALDconsult1-Feb-09 6:42 
AnswerRe: Saving text file with StreamWriter Pin
Guffa1-Feb-09 13:03
Guffa1-Feb-09 13:03 
GeneralRe: Saving text file with StreamWriter Pin
Mark F.2-Feb-09 5:08
Mark F.2-Feb-09 5:08 
GeneralRe: Saving text file with StreamWriter Pin
Guffa2-Feb-09 6:22
Guffa2-Feb-09 6:22 
GeneralRe: Saving text file with StreamWriter [Resolved] Pin
Mark F.3-Feb-09 14:55
Mark F.3-Feb-09 14:55 
QuestionHow to add additional text to a bound combobox Pin
udikantz1-Feb-09 5:00
udikantz1-Feb-09 5:00 
AnswerRe: How to add additional text to a bound combobox Pin
priyareguri2-Feb-09 5:28
priyareguri2-Feb-09 5:28 
QuestionUniversal Remote Control for PDA Pin
gauravxxx1-Feb-09 4:01
gauravxxx1-Feb-09 4:01 
QuestionSending email using SmtpClient SendAsync with gmail doesn’t work Pin
jankekk1-Feb-09 2:22
jankekk1-Feb-09 2:22 
AnswerRe: Sending email using SmtpClient SendAsync with gmail doesn’t work Pin
fquaino10-May-10 9:35
fquaino10-May-10 9:35 
QuestionDrive Control Pin
amiralimadadi1-Feb-09 1:24
amiralimadadi1-Feb-09 1:24 
AnswerRe: Drive Control Pin
amiralimadadi1-Feb-09 17:52
amiralimadadi1-Feb-09 17:52 
AnswerRe: Drive Control Pin
Dragonfly_Lee1-Feb-09 19:02
Dragonfly_Lee1-Feb-09 19:02 
GeneralRe: Drive Control Pin
amiralimadadi3-Feb-09 18:05
amiralimadadi3-Feb-09 18:05 
GeneralRe: Drive Control Pin
amiralimadadi17-Feb-09 1:46
amiralimadadi17-Feb-09 1:46 
Questionhow to paste graphic object on screen from arraylist...in c#.net Pin
priyareguri1-Feb-09 0:57
priyareguri1-Feb-09 0:57 

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.