Displaying image gotten via winhttp com object

Get help with using AutoHotkey and its commands and hotkeys
jbr67
Posts: 7
Joined: 06 Oct 2017, 16:00

Displaying image gotten via winhttp com object

25 Dec 2017, 08:56

Hi there,

so fore i'm using the following code to retrieve a jpeg from an online site (after authentication).

resultPicture := MyWebRequest.ResponseBody
ResultPictureSize := resultPicture._MaxIndex()
fh := FileOpen(destinationFile, "w")
for DataByte in ResultPicture
fh.WriteUchar(DataByte)
fh.Close()
Gui, Add, Picture,w300 h300, %destinationFile%
Gui, Show

All works fine, however... can this code be shortened? If so, maybe one other problem can simultaneously be solved... not storing the file on the filesystem....
Any idea's?
Jbr
User avatar
jeeswg
Posts: 6904
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Displaying image gotten via winhttp com object

25 Dec 2017, 09:12

- I have an example here to download an image/icon to a variable, and display it using SplashImage.
download urls to vars, partially/fully, via WinHttpRequest - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 09#p168409

- You can use an hBitmap with AHK GUIs:
GUI Control Types
https://autohotkey.com/docs/commands/Gu ... tm#Picture
[v1.1.23+]: A bitmap or icon handle can be used instead of a filename. For example, HBITMAP:%handle%.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA

Return to “Ask For Help”

Who is online

Users browsing this forum: au6, Bing [Bot], BushMange, CEA6597, Google [Bot], howardb1, VACO BenQ, w0z and 198 guests