AustrianOak Posted August 7, 2008 Share Posted August 7, 2008 I really need to be able to put .pngs in my program and I've read the topics showing how to do this but it seems like a LONG DRAWN OUT process that will take a lot of code and a lot of time. I was wondering if there is a simpler way to do this and if there is I'd appreciate it if someone told me because I'm wondering if there is a way to do this with no more than 4 or 5 lines of code. Please help! Link to comment Share on other sites More sharing options...
Szhlopp Posted August 7, 2008 Share Posted August 7, 2008 I really need to be able to put .pngs in my program and I've read the topics showing how to do this but it seems like a LONG DRAWN OUT process that will take a lot of code and a lot of time. I was wondering if there is a simpler way to do this and if there is I'd appreciate it if someone told me because I'm wondering if there is a way to do this with no more than 4 or 5 lines of code. Please help! Here you go... Very simple, 1 command and you have a PNG bacgkround. However, it's the coding of all the buttons that takes time. #include <PNGbackgroundUDF.au3> CreateTransparentGUI($Title) In the SAME folder you need an image called : "Background.png" and "Grey2.gif". I've included the Grey image, you need to put the background image in the SAME folder as PNGUDF.au3 =) PNGUDF.zip RegEx/RegExRep Tester!Nerd Olympics - Community App!Login UDFMemory UDF - "Game.exe+753EC" - CE pointer to AU3Password Manager W/ SourceDataFiler - Include files in your au3!--- Was I helpful? Click the little green '+' Link to comment Share on other sites More sharing options...
AustrianOak Posted August 7, 2008 Author Share Posted August 7, 2008 Wow this is great!!! Thanks! Btw, what do you mean when you say the coding of all the buttons takes all the time. And what if I want to create more than one png? Windows won't let me have 10 or so images called background.png Link to comment Share on other sites More sharing options...
monoceres Posted August 7, 2008 Share Posted August 7, 2008 I think I gave you a good answer in your previous thread with the same subject:http://www.autoitscript.com/forum/index.ph...3624&hl=png And even though that code is more than 4-5 lines it definitely not a long drawn out process. Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
Szhlopp Posted August 7, 2008 Share Posted August 7, 2008 Wow this is great!!! Thanks! Btw, what do you mean when you say the coding of all the buttons takes all the time.And what if I want to create more than one png? Windows won't let me have 10 or so images called background.pngThis was designed for a single PNG.You would have to understand how the function worked to use more than one PNG=) Figure it out, otherwise just use normal windows for children or whatever=) RegEx/RegExRep Tester!Nerd Olympics - Community App!Login UDFMemory UDF - "Game.exe+753EC" - CE pointer to AU3Password Manager W/ SourceDataFiler - Include files in your au3!--- Was I helpful? Click the little green '+' Link to comment Share on other sites More sharing options...
AustrianOak Posted August 7, 2008 Author Share Posted August 7, 2008 Monceres, whenever I would move the window containing the png a black shadow would expand around it up to about 20 pixels. If that wouldnt have happened, i wouldnt have started this thread... Link to comment Share on other sites More sharing options...
monoceres Posted August 7, 2008 Share Posted August 7, 2008 Monceres,whenever I would move the window containing the png a black shadow would expand around it up to about 20 pixels.If that wouldnt have happened, i wouldnt have started this thread...If you comment out the GUICtrlCreatePic() line then no black pixel should appear.Of course then you won't have a control that can receive events and such but that could be fixed by some manually work. Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
AustrianOak Posted August 7, 2008 Author Share Posted August 7, 2008 (edited) Well I've been studying the code for a while and thought that maybe I could increment the background.png name like: (..."\Background" & 1 & ".png"). And thats all I've come up with (which is pretty sad...). Can I have a hint? Edited August 7, 2008 by IWantIt Link to comment Share on other sites More sharing options...
AustrianOak Posted August 8, 2008 Author Share Posted August 8, 2008 No hint? Link to comment Share on other sites More sharing options...
AustrianOak Posted August 9, 2008 Author Share Posted August 9, 2008 bump Link to comment Share on other sites More sharing options...
AustrianOak Posted August 10, 2008 Author Share Posted August 10, 2008 Im still lost on this one. Can somebody offer a helpful hint? Link to comment Share on other sites More sharing options...
davecollinsnz Posted August 10, 2008 Share Posted August 10, 2008 For $i=1 to 15 (..."\Background" & $i & ".png") Next I think thats sort of what you asked for... Trust me to make SkyNet with AutoIt... Link to comment Share on other sites More sharing options...
AustrianOak Posted August 10, 2008 Author Share Posted August 10, 2008 yes, but that is only part of the solution to this problem. i will need someway to tell it to display each of the fifteen different images whenever called upon. (dont even know if im saying this right...) @PsaltyDS: whenever you get back, it'd be really helpful if you could help... here's the updated code (not much updated) expandcollapse popup#include <GDIPlus.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> Global Const $AC_SRC_ALPHA = 1 Global $hImage, $gui1, $controlGui Func CreateTransparentGUI($Title) ;if FileExists(@ScriptDir & '\grey.gif') = 0 then _GDIPlus_Startup() For $i=1 to 15 $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Background" & $i & ".png") Next $ImageHeight = _GDIPlus_ImageGetHeight($hImage) $ImageWidth = _GDIPlus_ImageGetWidth($hImage) $gui1 = GUICreate($Title, $ImageWidth, $ImageHeight, -1, -1, $WS_popup, $WS_EX_LAYERED) SetBitMap($gui1, $hImage, 255) GUISetState() $controlGui = GUICreate("ControlGUI", $ImageWidth, $ImageHeight, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $GUI1) GUICtrlCreatePic(@ScriptDir & "\grey2.gif", 0, 0, $ImageWidth, $ImageHeight) GUICtrlSetState(-1, $GUI_DISABLE) GUISetState() GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") EndFunc Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam) if ($hWnd = $gui1) and ($iMsg = $WM_NCHITTEST) then Return $HTCAPTION EndFunc Func SetBitmap($hGUI, $hImage, $iOpacity) Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hScrDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize ) DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth ($hImage)) DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage)) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha" , $iOpacity ) DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA) _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _WinAPI_ReleaseDC (0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC ($hMemDC) EndFunc Link to comment Share on other sites More sharing options...
davecollinsnz Posted August 10, 2008 Share Posted August 10, 2008 NextBG() Global $bgcount=1 Func NextBG() $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Background" & $bgcount & ".png") $bgcount+=1 if $bgcount>15 then $bgcount=1; reset Endfunc How about this? Trust me to make SkyNet with AutoIt... Link to comment Share on other sites More sharing options...
AustrianOak Posted August 10, 2008 Author Share Posted August 10, 2008 Im a confused ass retard. But out of all my confusion I think your first example was fine. Its just even though we are incrementing the picture file name, we still have to find a way to load them all on command and right now its only loading $hImage. Link to comment Share on other sites More sharing options...
davecollinsnz Posted August 10, 2008 Share Posted August 10, 2008 You could try updating the graphic by deleting it and creating a new one each time. I saw a graphic that updates that way here. It should be able to be adapted to show a different png each time. Trust me to make SkyNet with AutoIt... Link to comment Share on other sites More sharing options...
AustrianOak Posted August 24, 2008 Author Share Posted August 24, 2008 (edited) This was designed for a single PNG.You would have to understand how the function worked to use more than one PNG=) Figure it out, otherwise just use normal windows for children or whatever=)Schzlopp:Hi, I've been trying to figure it out for a long time now, whats the way to use it for multiple pngs? Edited September 13, 2008 by IWantIt Link to comment Share on other sites More sharing options...
AustrianOak Posted August 26, 2008 Author Share Posted August 26, 2008 Bump Link to comment Share on other sites More sharing options...
AustrianOak Posted August 31, 2008 Author Share Posted August 31, 2008 Bump Link to comment Share on other sites More sharing options...
AustrianOak Posted September 12, 2008 Author Share Posted September 12, 2008 (edited) Bump. Edited September 12, 2008 by IWantIt Link to comment Share on other sites More sharing options...
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