IECUSTOMIZER
Hi E (or is that H IE Rudder)
Its a bit strange. I have a number of machines with different versions of IE running. On my IE6 Sp1 machine there is no Work Offline menu option... well it could be a group policy setting on that machine. Nope a check rules that out... It just goes to show that you cannot rely on the menu layout between versions. I couldn't find any documentation on the Work-offline menu.. could not find any registry keys and regmon does not indicate any registry changes when the menu option is toggled.
The object.offline property refers to the WebBrowser object. Add a reference to IEFrame.dll in Visual Studio and use the Object Browser to inspect its properties and methods. You will see the offline property listed with a comment 'Property Offline as Boolean - Controls if the frame is offline (read from cache)'
For a command bar button to hook into the webbrowser instance, you need to get the top window handle (hwnd) which will be the IE window where the user has pressed the button (api GetForegroundWindow). Next you have to enum the IE windows and find which one has the same hwnd value... here is a vb snippet...
hwnd = GetForegroundWindow()
dim SWs as new shdocvw.ShellWindows
dim IE as shdocvw.InternetExplorer
Set myWB = Nothing ' this is your event sink to the web browser object
For i = SWs.count - 1 to 0 Step -1 ' start from the topmost for speed
Set IE = SWs.Item(i)
If Not IE Is Nothing then
If IE.hwnd = hwnd then
Set myWB = IE
'' then you can toggle the offline property
Either myWB.Offline = Not myWB.Offline
or IE.Offline = Not IE.Offline
exit the For once you have found the top window or loop through all open IE instances if you want to toggle the Offline property for them all.
You may like to consider a scripted button instead that will use sendkeys to toggle the menu option (if it exists and is enabled)
<script language="vbscript">
// IE7 Toggle Work Offline menu
set WshShell=createobject("wscript.shell")
WshShell.AppActivate("IExplore.exe")
WshShell.SendKeys "^FW"
</script>
In both solutions you will not be able to indicate the browser Offline state with the button state on the command bar button (hot and cold icon values)
Regards.