I am writing a gadget to view daily comics. I would like to save the images to a local folder. Does anybody have any suggestions My gadget will display the comics I just need advice on how to save the images.
Thanks.
I am writing a gadget to view daily comics. I would like to save the images to a local folder. Does anybody have any suggestions My gadget will display the comics I just need advice on how to save the images.
Thanks.
Local cache of web images
SamuelEe
Public Function DownloadFile(ByRef url As String, ByRef filename As String) As Boolean
If that's not an option, there are some free utils that will do it, such as AutoHotKeys and use the URLDownloadToFile function. Or, AutoIt and use the InetGet function.
With AutoIt, you'll be able to compile your own EXE which you can bundle with your gadget. The AutoIt script would be:
If $CmdLine[0]<2 or $CmdLine[1]="/ " Then
MsgBox(0, "SaveFile", "Usage: SaveFile <URL> <filename>")
Exit
EndIf
InetGet($CmdLine[1], $CmdLine[2])
Laurent.Guinnard
So long as you've created it as an Interop Class, and it's COM Visible, you should be okay. eg:
<System.Runtime.InteropServices.ProgId("[ProgID]")> Public Class [ClassId]
and in the AssemblyInfo
<Assembly: ComVisibleAttribute(True)>
How I find out the registry entries, is somewhat of a botch. Run Process Monitor whilst you're compiling the DLL, and watch just registry writes. There will five main keys that you need to extract:
HKLM\Software\Classes\CLSID\<CLSID>
HKLM\Software\Classes\<ProgID>
HKLM\Software\Component Categories\<Com GUID>
HKLM\Software\TypeLib\<Type GUID>
HKLM\Software\Interface\<Intergace GUID>
To register them within your Gadget, you need to first try putting them under HKCU, then try to create your COM. If it fails, put the keys under HKLM and try to create your COM. You need to do this because for some odd reason, COM's don't work in HKCU if you're running as an elevated Administrator on Vista.
Chuff
You can use it to get the registry keys:
regasm.exe <file.dll> /regfile:myreg.reg
I wouldn't use it in your Gadget though, as it requires privilages that a "User" doesn't have.
Brannon
Thank you for your assistance. I found a good article by Bruce Williams referenced on this site on how to create controls using C++. I emailed him to ask if it is possible to use VB and he responded:
You should be able to register your VB class as an ActiveX control (using the REGASM.EXE tool for example), after which you can access it from your gadget as I describe in the article.
I followed his advice and it worked like a charm!
MagedSalah