Jerrif Posted January 1, 2010 Posted January 1, 2010 Hi, I'm trying to write a script that (amongst other things) displays a .PNG picture from a website, in a GUI. I simply want to link directly to the image, so this is what I've tried so far #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <IE.au3> $oIE = _IECreateEmbedded() GUICreate("Embedded Control Test", 640, 480, "", "", $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN) $GUIActiveX = GUICtrlCreateObj($oIE, 10, 40, 600, 360) GUISetState() _IENavigate($oIE, "http://cache.www.gametracker.com/server_info/113.212.97.73:16567/banner_160x400_T0_F-1_CFF6633-FFFFFF-7E7D8C-002850.png") While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd This method seems to work fine for any other image type, but when I try it with a .PNG, the image doesn't display. Something that I found odd however, is that if loaded as part of a webpage, the .PNG will load correctly. Am I doing something wrong, is there a way around this, or am I doomed to not have pretty pictures in my GUI?
Malkey Posted January 1, 2010 Posted January 1, 2010 This example may help you. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> If Not FileExists(@TempDir & "\banner_160x400.png") Then _ InetGet("http://cache.www.gametracker.com/server_info/113.212.97.73:16567/banner_160x400_T0_F-1_CFF6633-FFFFFF-7E7D8C-002850.png", _ @TempDir & "\banner_160x400.png") _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile(@TempDir & "\banner_160x400.png") $w = _GDIPlus_ImageGetWidth($hImage) $h = _GDIPlus_ImageGetHeight($hImage) _GDIPlus_ImageSaveToFile($hImage, @TempDir & "\banner_160x400.bmp") _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() GUICreate("Embedded Control Test", $w + 20, $h + 20, "", "", BitOR($WS_OVERLAPPEDWINDOW, $WS_VISIBLE, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN)) GUICtrlCreatePic(@TempDir & "\banner_160x400.bmp", 10, 10, $w, $h);supported types BMP, JPG, GIF(but not animated). GUICtrlSetResizing(-1, 1) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd
Jerrif Posted January 1, 2010 Author Posted January 1, 2010 This example may help you.That's exactly what I was looking for! Thanks for the help!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now