Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
get favicons
#1
Hi Gintaras,
I want to use the google favicon getter: http://google.com/s2/favicons?domain=<www.abc.com> so I can capture a website's favicon to put next to the url line using your dialog browser examples in the forum/archive.
The problem is that it returns a favicon that for some reason doesn't get set to an icon static text or icon button.
Regular size (at least 16x16) icons set without a problem but these icons are usually around 5k whereas the ones that are returned by the google service are only around 1 k. However, they do look like the appropriate icon when viewed in an editor.
Is there a size lower limit for the icons in QM?
Any suggestions? Do I need to somehow resize the icons I get back from the service.
Sorry no example but all standard dialogs button/static text setting. Thanks!!! S

I can set the static in the control string definitions or using

Function SetStaticIcon ?
;/
function hwndControl [$iconFile] [flags] ;;flags: 1 large

;Sets/changes/deletes icon of a static icon control.

;hwndControl - control handle.
;iconFile - icon file. If "" or not used, removes icon.
;;;;To avoid memory leak, always call this function on WM_DESTROY with empty iconFile.

;Initially the control must not have icon.


int hi
if(!empty(iconFile)) hi=GetFileIcon(iconFile 0 flags)
hi=SendMessage(hwndControl STM_SETICON hi 0)
if(hi) DestroyIcon hi


S
#2
png

Code:
Copy      Help
\Dialog_Editor
str controls = "3"
str sb3
sb3="$temp qm$\favicon.png"
IntGetFile("http://www.google.com/s2/favicons?domain=www.quickmacros.com" sb3 16)

if(!ShowDialog("" 0 &controls)) ret

;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 223 135 "Dialog"
;3 Static 0x5400000E 0x0 0 0 16 16 ""
;END DIALOG
#3
Thanks!!! You are the best! Much much appreciated!
S
#4
I use this instead with the png and it works for subsequent png icon updates.

Function UpdateFavicon
Code:
Copy      Help
int hb = LoadPictureFile(FavIconFilePath)
SendMessage id(3 ToolbarHwnd) STM_SETIMAGE IMAGE_BITMAP hb

Thanks again,
S
#5
Don't forget to delete bitmap when don't need. Maybe even 2 bitmaps.
#6
I am not sure what you mean. Could you give an example of deleting a bmp?
Thanks,
S
#7
Code:
Copy      Help
int hsb=id(3 ToolbarHwnd)
int hb hbTemp=LoadPictureFile(FavIconFilePath)
SendMessage hsb STM_SETIMAGE IMAGE_BITMAP hbTemp
hb=SendMessage(hsb STM_GETIMAGE IMAGE_BITMAP 0)
if(hb!=hbTemp) DeleteObject hbTemp ;;the control copies the bitmap if alpha
__GdiHandle- t_favicon; t_favicon.Delete; t_favicon=hb ;;will auto-delete bitmap in dtor
#8
thanks, works great!
S


Forum Jump:


Users browsing this thread: 1 Guest(s)