hypodyne

I am trying to add a button to the internet explorer toolbar. It shows up on the toolbar but nothing happens when I click the button. The button is pressed.

I ve been trying to get this working for weeks.  

I have added all the values to the registry ButtonText, CLSID, ClsidExtension, Default Visible, HotIcon, Icon, MenuText which shows up in regedit.

I have registered the com object and it shows up in regedit.

Here is the setup project (inno setup program)

[
[Setup]
AppName=Hypodyne ThumbNailer
AppVerName=Hypodyne ThumbNailer version 1.0
DefaultDirName={pf}\Hypodyne
DefaultGroupName=My Program
UninstallDisplayIcon={app}\MyProg.exe
Compression=lzma
SolidCompression=yes
OutputDir=userdocs:Inno Setup Examples Output

[Files]
Source: "C:\Documents and Settings\hypodyne\My Documents\Visual Studio\Projects\Installer\Hypodyne.Thumb\bin\Release\Hypodyne.Thumb.dll"; DestDir: "{app}"
Source: "C:\Documents and Settings\hypodyne\My Documents\Visual Studio\Projects\HypodyneThumbNailer\HypodyneThumbNailer\HotIcon.ico"; DestDir: "{app}"
Source: "C:\Documents and Settings\hypodyne\My Documents\Visual Studio\Projects\HypodyneThumbNailer\HypodyneThumbNailer\Icon.ico"; DestDir: "{app}"

[Registry]
Root: HKCR; Subkey: "CLSID\{{DA98011A-2230-40e0-8F43-4A4EB7EDABEB}"; ValueType: string; ValueName: ; ValueData: "Hypodyne.Thumb.Class1"

Root: HKCR; Subkey: "CLSID\{{DA98011A-2230-40E0-8F43-4A4EB7EDABEB}\Implemented Categories\{{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}"; ValueType: string; ValueName: ; ValueData:

Root: HKCR; Subkey: "CLSID\{{DA98011A-2230-40E0-8F43-4A4EB7EDABEB}\InprocServer32"; ValueType: string; ValueName: ; ValueData: "mscoree.dll"
Root: HKCR; Subkey: "CLSID\{{DA98011A-2230-40E0-8F43-4A4EB7EDABEB}\InprocServer32"; ValueType: string; ValueName: "Assembly"; ValueData: "Hypodyne.Thumb, Version=1.0.2558.20094, Culture=neutral, PublicKeyToken=null"
Root: HKCR; Subkey: "CLSID\{{DA98011A-2230-40E0-8F43-4A4EB7EDABEB}\InprocServer32"; ValueType: string; ValueName: "Class"; ValueData: "Hypodyne.Thumb.Class1"
Root: HKCR; Subkey: "CLSID\{{DA98011A-2230-40E0-8F43-4A4EB7EDABEB}\InprocServer32"; ValueType: string; ValueName: "CodeBase"; ValueData: "{app}\Hypodyne.Thumb.dll"
Root: HKCR; Subkey: "CLSID\{{DA98011A-2230-40E0-8F43-4A4EB7EDABEB}\InprocServer32"; ValueType: string; ValueName: "RuntimeVersion"; ValueData: "v1.1.4322"
Root: HKCR; Subkey: "CLSID\{{DA98011A-2230-40E0-8F43-4A4EB7EDABEB}\InprocServer32"; ValueType: string; ValueName: "ThreadingModel"; ValueData: "Both"

Root: HKCR; Subkey: "CLSID\{{DA98011A-2230-40E0-8F43-4A4EB7EDABEB}\InprocServer32\\1.0.2558.20094"; ValueType: string; ValueName: ; ValueData:
Root: HKCR; Subkey: "CLSID\{{DA98011A-2230-40E0-8F43-4A4EB7EDABEB}\InprocServer32\\1.0.2558.20094"; ValueType: string; ValueName: "Assembly"; ValueData: "Hypodyne.Thumb, Version=1.0.2558.20094, Culture=neutral, PublicKeyToken=null"
Root: HKCR; Subkey: "CLSID\{{DA98011A-2230-40E0-8F43-4A4EB7EDABEB}\InprocServer32\\1.0.2558.20094"; ValueType: string; ValueName: "Class"; ValueData: "Hypodyne.Thumb.Class1"
Root: HKCR; Subkey: "CLSID\{{DA98011A-2230-40E0-8F43-4A4EB7EDABEB}\InprocServer32\\1.0.2558.20094"; ValueType: string; ValueName: "CodeBase"; ValueData: "{app}\Hypodyne.Thumb.dll"
Root: HKCR; Subkey: "CLSID\{{DA98011A-2230-40E0-8F43-4A4EB7EDABEB}\InprocServer32\\1.0.2558.20094"; ValueType: string; ValueName: "RuntimeVersion"; ValueData: "v1.1.4322"

Root: HKCR; Subkey: "CLSID\{{DA98011A-2230-40E0-8F43-4A4EB7EDABEB}\ProgId"; ValueType: string; ValueName: ; ValueData: "Hypodyne.Thumb.Class1"

Root: HKLM; Subkey: "Software\Microsoft\Internet Explorer\Extensions\{{DA98011A-2230-40e0-8F43-4A4EB7EDABEB}"; ValueType: string; ValueName: "Default Visible"; ValueData: "Yes"
Root: HKLM; Subkey: "Software\Microsoft\Internet Explorer\Extensions\{{DA98011A-2230-40e0-8F43-4A4EB7EDABEB}"; ValueType: string; ValueName: "ButtonText"; ValueData: "Thumb Nailer"
Root: HKLM; Subkey: "Software\Microsoft\Internet Explorer\Extensions\{{DA98011A-2230-40e0-8F43-4A4EB7EDABEB}"; ValueType: string; ValueName: "HotIcon"; ValueData: "{app}\HotIcon.ico"
Root: HKLM; Subkey: "Software\Microsoft\Internet Explorer\Extensions\{{DA98011A-2230-40e0-8F43-4A4EB7EDABEB}"; ValueType: string; ValueName: "Icon"; ValueData: "{app}\Icon.ico"
Root: HKLM; Subkey: "Software\Microsoft\Internet Explorer\Extensions\{{DA98011A-2230-40e0-8F43-4A4EB7EDABEB}"; ValueType: string; ValueName: "CLSID"; ValueData: "{{1FBA04EE-3024-11D2-8F1F-0000F87ABD16}"
Root: HKLM; Subkey: "Software\Microsoft\Internet Explorer\Extensions\{{DA98011A-2230-40e0-8F43-4A4EB7EDABEB}"; ValueType: string; ValueName: "ClsidExtension"; ValueData: "{{DA98011A-2230-40e0-8F43-4A4EB7EDABEB}"
Root: HKLM; Subkey: "Software\Microsoft\Internet Explorer\Extensions\{{DA98011A-2230-40e0-8F43-4A4EB7EDABEB}"; ValueType: string; ValueName: "MenuText"; ValueData: "Thumb Nailer"
using System;
using System.ComponentModel;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using Microsoft.Win32;

namespace Hypodyne.Thumb
{

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

 public enum OLECMDF : uint
 {
 OLECMDF_SUPPORTED = 1,
 OLECMDF_ENABLED = 2,
 OLECMDF_LATCHED = 4,
 OLECMDF_NINCHED = 8
 }

 [ComImport, 
 Guid("b722bccb-4f68-101b-a2bc-00fa00404770"),
 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);
 }

 [Guid("DA98011A-2230-40e0-8F43-4A4EB7EDABEB")]
 public class Class1: IOleCommandTarget
 {
 public void QueryStatus(
  ref Guid pguidCmdGroup,
  UInt32 cCmds,
  [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] OLECMD prgCmds,
  ref OLECMDTEXT CmdText) 
 {
  System.Windows.Forms.MessageBox.Show("Hello");
  prgCmds.cmdf = (uint)OLECMDF.OLECMDF_SUPPORTED | (uint)OLECMDF.OLECMDF_ENABLED;
 }

 public void Exec(
  ref Guid pguidCmdGroup,
  uint nCmdID,
  uint nCmdExecOpt,
  ref object pvaIn,
  ref object pvaOut) 
 {
  System.Windows.Forms.MessageBox.Show("Hello2");
  DoSomething();
 }

 public void DoSomething()
 {
  try
  {
  MessageBox.Show("Hey");
  }
  catch (Exception e)
  {
  MessageBox.Show(e.Message);
  }
 }
 }
}


Re: Internet Explorer Extension Development Internet Explorer Toolbar button.

IECUSTOMIZER

Hi,

Try using a different GUID value for the Extenstion key from the CLSIDExtension value.

What is the entry point to your dll - it should be the default - main()

QueryStatus is generally used to determine the button state (hot or cold) in order to toggel its view state.

I just had a look at the Add-to Zone sample from IE downloads.... (webzone.dll)... only difference is the ThreadingModel = Apartment

Regards.






Re: Internet Explorer Extension Development Internet Explorer Toolbar button.

hypodyne

The button works as in it changes when you mouse over it. Although if I put a messageBox in the function definition then it does not pop up.

I am not sure what you mean by entry point of the dll means.. As far as I know the Exec function is called when you press the button. Although it does not work. Executables have a main function and are easy to get working using IE toolbuttons. But as I will in future want to access the webpage so I can take a screen shot of the client area I need to use a DLL. As far as i know anyway.

Can you please give me the full link to the example you mentioned because the only webzone example i could find had nothing to do with IE or implement IUnknown.