Sign in to follow this  
Followers 0
wakillon

Polaroider v1.0.3.1 Update of 03 july 2013

44 posts in this topic

#1 ·  Posted (edited)

Polaroider 1.0.3.1

Easily Create a picture as a Polaroid and be able after, to create Custom Photos Polaroid Collage.

May be you know Pola a soft for create easily Polaroid-like photos from your digital images, but after some tries, i didn't find it very handy !

So i made mine.

 

201306301803461.jpg

Photo can be positioned by drag and zoomed/unzoomed with mouse wheel ( sorry for Touchpad user :P   )

Polaroid can be inclined 10 or 20 degrees, on left or right, and with simple or multiple frames.

Inclination will only be visible on the saved shoot.

It is also saved with a transparent background for be able to create "Pêle-Mêles" (in french) with a photo editor.

I have set the desktop as save directory.

previous downloads : 122

 

source and executable are available in the Download Section

All files are included in script.

I hope you will like it !

Happy Shooting !  ;)

Edited by wakillon
2 people like this

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Nice work wakillon.  :thumbsup:

Just add to line 611

DllCall($ghGDIPDll, "uint", "GdipSetTextRenderingHint", "handle", $hGraphic6, "int", 4)

to add also antialiasing to Vista+ os.

And here a code to get some information about images:

#include <GDIPlus.au3>

Global $sFile = FileOpenDialog("Select an image", "", "(*.jpg;*.png;*.bmp;*.gif;*.tif;*.ico;*.emf;*.wmf)")
If @error Then Exit
_GDIPlus_Startup()
Global $hImage = _GDIPlus_ImageLoadFromFile($sFile)
Global $aPixelFormat = _GDIPlus_ImageGetPixelFormat($hImage)
Global $aImageRawFormat = _GDIPlus_ImageGetRawFormat($hImage)
Global $hImageContext = _GDIPlus_ImageGetGraphicsContext($hImage)
Global $aImageDPIX = DllCall($ghGDIPDll, "uint", "GdipGetDpiX", "handle", $hImageContext, "float*", 0)
Global $aImageDPIY = DllCall($ghGDIPDll, "uint", "GdipGetDpiY", "handle", $hImageContext, "float*", 0)

MsgBox(0, "Image Information",  "Filename: " & $sFile & @LF & @LF & _
                                "Width: " & @TAB & @TAB & _GDIPlus_ImageGetWidth($hImage) & @LF & _
                                "Height: " & @TAB & @TAB & _GDIPlus_ImageGetHeight($hImage) & @LF & _
                                "DPI: " & @TAB & @TAB & Round($aImageDPIX[2], 0) & "x" & Round($aImageDPIY[2], 0) & @LF & _
                                "Color Depth: " & @TAB & $aPixelFormat[1]  & @LF & _
                                "Image Type: " & @TAB & $aImageRawFormat[1], 30)

_GDIPlus_GraphicsDispose($hImageContext)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_Shutdown()
Exit

When loading large images and moving around the window the window will be jerky. My suggestion scale down the preview image instead to copy always the large image to the preview gfx handle.

Are the tiny loves your kids?

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Very nice thank you very much.  :thumbsup:

Share this post


Link to post
Share on other sites

Looks good. Thanks for sharing!


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites

Nice work wakillon.  :thumbsup:

Just add to line 611

DllCall($ghGDIPDll, "uint", "GdipSetTextRenderingHint", "handle", $hGraphic6, "int", 4)

to add also antialiasing to Vista+ os.

And here a code to get some information about images:

#include <GDIPlus.au3>

Global $sFile = FileOpenDialog("Select an image", "", "(*.jpg;*.png;*.bmp;*.gif;*.tif;*.ico;*.emf;*.wmf)")
If @error Then Exit
_GDIPlus_Startup()
Global $hImage = _GDIPlus_ImageLoadFromFile($sFile)
Global $aPixelFormat = _GDIPlus_ImageGetPixelFormat($hImage)
Global $aImageRawFormat = _GDIPlus_ImageGetRawFormat($hImage)
Global $hImageContext = _GDIPlus_ImageGetGraphicsContext($hImage)
Global $aImageDPIX = DllCall($ghGDIPDll, "uint", "GdipGetDpiX", "handle", $hImageContext, "float*", 0)
Global $aImageDPIY = DllCall($ghGDIPDll, "uint", "GdipGetDpiY", "handle", $hImageContext, "float*", 0)

MsgBox(0, "Image Information",  "Filename: " & $sFile & @LF & @LF & _
                                "Width: " & @TAB & @TAB & _GDIPlus_ImageGetWidth($hImage) & @LF & _
                                "Height: " & @TAB & @TAB & _GDIPlus_ImageGetHeight($hImage) & @LF & _
                                "DPI: " & @TAB & @TAB & Round($aImageDPIX[2], 0) & "x" & Round($aImageDPIY[2], 0) & @LF & _
                                "Color Depth: " & @TAB & $aPixelFormat[1]  & @LF & _
                                "Image Type: " & @TAB & $aImageRawFormat[1], 30)

_GDIPlus_GraphicsDispose($hImageContext)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_Shutdown()
Exit

When loading large images and moving around the window the window will be jerky. My suggestion scale down the preview image instead to copy always the large image to the preview gfx handle.

Are the tiny loves your kids?

Br,

UEZ

 

Hi UEZ 

Is the antialiasing line you suggest need to be repeat for other graphics handles ?

And i don't understand your scale down preview image suggestion...do you want to reduce the preview ? i found it so small !

It interest me because i'm working on another project with bigger photos than this preview.  ;)

And yes, it's my kids (photos are old now)  

Thanks for your help!  :)

 

Very nice thank you very much.  :thumbsup:

 

Glad you like it !

Looks good. Thanks for sharing!

 

Thanks !


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

Hi UEZ 

Is the antialiasing line you suggest need to be repeat for other graphics handles ?

And i don't understand your scale down preview image suggestion...do you want to reduce the preview ? i found it so small !

It interest me because i'm working on another project with bigger photos than this preview.  ;)

And yes, it's my kids (photos are old now)  

Thanks for your help!  :)

 

Glad you like it !

 

Thanks !

 

Yes, you can add also to the other gfx handles which makes sense, otherwise only GUI text is anti aliased.

Regarding scale down preview: your polaroid preview has a dimension of 285x285 px and e.g. if you load an image with dimension 2400x3200 px you always copy that image to the preview handle which slows down it extremely. I would scale the image down once only to display it in the preview handle. It will be much faster on repaint activities.

Very cute kids on that picture.

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Nice. And lovely kids!

I'm running executable you provided and unfortunately I get crashes on exit, for example if I start the app and then do nothing but close it. I was intrigued so I went through the source you provided and really without goinng too deep saw it's the _ControlGlobalSubclass() that causes the issues.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Yes, you can add also to the other gfx handles which makes sense, otherwise only GUI text is anti aliased.

Regarding scale down preview: your polaroid preview has a dimension of 285x285 px and e.g. if you load an image with dimension 2400x3200 px you always copy that image to the preview handle which slows down it extremely. I would scale the image down once only to display it in the preview handle. It will be much faster on repaint activities.

Very cute kids on that picture.

Br,

UEZ

 

Ok, if after drag'n drop, i do a copy of the photo with a reduced size, it will be less jerky, I'm right ?

But if size is reduced, is quality zoom not affected ?  :huh:


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Nice. And lovely kids!

 

I'm running executable you provided and unfortunately I get crashes on exit, for example if I start the app and then do nothing but close it. I was intrigued so I went through the source you provided and really without goinng too deep saw it's the _ControlGlobalSubclass() that causes the issues.

 

Hi trancexx, glad you like it !  :king:

I can't reproduce your crashes (win7x64)

 

Can you please try this debug way ?

 

1 - add  If @error Then ConsoleWrite ( '@error : ' & @error & @Crlf ) after _ControlGlobalSubclass () line

 

2 - replace _ControlGlobalSubclass () function by this one

 

Func _ControlGlobalSubclass () ; by rover
    If $hNew_ControlProc <> 0 Then Return SetError ( 1, 0, 0 )
    Local $hGUITemp = GUICreate ( '', 1, 1, -10, -10 )
    Local $hButtonTemp = GUICtrlGetHandle ( GUICtrlCreateButton ( '', -10, -10, 1, 1 ) )
    $hNew_ControlProc = DllCallbackRegister ( '_WndProc', 'int', 'hwnd;uint;wparam;lparam' )
    If $hNew_ControlProc = 0 Then Return SetError ( 2, 0, 0 )
    Local $pCallbackPtr = DllCallbackGetPtr ( $hNew_ControlProc )
    If $pCallbackPtr = 0 Then Return SetError ( 3, 0, 0 )
    $pOriginal_ButtonProc = DllCall ( $hUser32DLL, 'dword', 'SetClassLongW', 'hwnd', $hButtonTemp, 'int', -24, 'ptr', $pCallbackPtr ) ; $GCL_WNDPROC
    If @error Then Return SetError ( 4, 0, 0 )
    $pOriginal_ButtonProc = $pOriginal_ButtonProc[0]
    GUIDelete ( $hGUITemp )
    Return SetError ( 0, 0, 1 )
EndFunc ;==> _ControlGlobalSubclass ()

3 - and in _OnAutoItExit () function replace DllCallbackFree ( $hNew_ControlProc ) by :

If $hNew_ControlProc <> 0 Then
        DllCallbackFree ( $hNew_ControlProc )
        If @error Then ConsoleWrite ( '@error : ' & @error & @Crlf )
    EndIf

Thanks for your help  :)

Edit : it's a >Rover's tips for prevent dotted focus lines on controls.

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

^^ I don't have AutoIt installed here where I am so I can't run scripts.

...I can run executables though.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Take rover's example and remove line

GUIDelete($hGUI)

... then try it. What results you get there?

I see he has this comment which you ignored:

; Must delete subclassed controls before freeing DLLCallbacks 
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Edited by trancexx

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

^^ I don't have AutoIt installed here where I am so I can't run scripts.

...I can run executables though.

 

Oh, ok

So could you try this Polaroider v1.0.2.9.exe modified ? 


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

 

Take rover's example and remove line

GUIDelete($hGUI)

... then try it. What results you get there?

I see he has this comment which you ignored:

; Must delete subclassed controls before freeing DLLCallbacks 
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

 

Results return absolutely no crashes, compiled or not, after 10 tries...

+>09:56:04 AutoIt3.exe ended.rc:0
>Exit code: 0    Time: 3.518

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

Still, could you add line like that to your app and upload it for me. Polaroider v1.0.2.9.exe crashes for me also.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Still, could you add line like that to your app and upload it for me. Polaroider v1.0.2.9.exe crashes for me also.

 

No problem, GUIDelete ( $hGUI ) added in _OnAutoItExit function.

Polaroider v1.0.3.0.exe

i must change file version because with googlecode each uploaded file must have a distinct name.

:)


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

No problem, GUIDelete ( $hGUI ) added in _OnAutoItExit function.

Polaroider v1.0.3.0.exe

i must change file version because with googlecode each uploaded file must have a distinct name.

:)

That's the same.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

No wait, that's fine now. I was running older version.

Yep, that one is good!


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

No wait, that's fine now. I was running older version.

Yep, that one is good!

 

Cool, thanks for your help !  :thumbsup:

I look forward to see your polaroids !  :D


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

I look forward to see your polaroids !  :D

Nice one.

Thanks for fixing it for me.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Nice one.

Thanks for fixing it for me.

 

All thanks are for you, and between us, I couldn't resist to the beautiful smile of your avatar!  :D


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • Larnil
      By Larnil
      This script generates Barnsleys Fractal Fern using script only.
      ; version 2017-10-03 ; Barnsley Fractal Fern ; by larnil #include <GUIConstants.au3> Dim $x, $y, $xn, $yn, $n, $r, $dc $WinSize = 800 ; window size ;Create graphics windows AutoItSetOption("GUIOnEventMode", 1) $GUI = GUICreate("Barnsley Fractal Fern", $WinSize, $WinSize, -1, -1) $Graphic = GuiCtrlCreateGraphic(0, 0, $WinSize, $WinSize) GUICtrlSetBkColor(-1, 0x000000) GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x00ff00) GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE,"Bye") ;Main $start = TimerInit() _Fern(800) ; hight of fern - can be larger than window MsgBox(0,"Time taken:",Round(TimerDiff($start)/1000,3) &" seconds") While 1 Sleep(100) WEnd Func Bye() Exit EndFunc Func _Fern($height) $f = $height/10.6 ; scale factor. Complete fern is within 0 <= y <= 9.9983 (with no scale) $offset_x = $height/2 - $height/40 ; Side adjustment. Fern is within −2.1820 < x < 2.6558 (with no scale) For $n = 1 To $height*200 ; Number of iterations $r = Random(0, 99, 1) Select Case $r < 85 ; 0-84 = 85% of the time $xn = 0.85 * $x + 0.04 * $y $yn = -0.04 * $x + 0.85 * $y + 1.6 Case $r > 84 AND $r < 92 ; 85-91 = 7% of the time $xn = 0.2 * $x - 0.26 * $y $yn = 0.23 * $x + 0.22 * $y + 1.6 Case $r > 91 AND $r < 99 ; 92-98 = 7% of the time $xn = -0.15 * $x + 0.28 * $y $yn = 0.26 * $x + 0.24 * $y + 0.44 Case Else ; 99-99 = 1% of the time $xn = 0 $yn = 0.16 * $y EndSelect $x = $xn $y = $yn GUICtrlSetGraphic($Graphic, $GUI_GR_PIXEL, $offset_x + $x * $f, $height - $y * $f) Next GUICtrlSetGraphic($Graphic, $GUI_GR_REFRESH) EndFunc ;==> Fern  
      Here is another example where I have used GDI (my very first attempt at using GDI by the way). This script can generate much larger Ferns and save them to file (png). I have used this script to generate a 20000 x 20000 pixel @ 600 dpi image. Looks really good printed out in full size.
      #include <GDIPlus.au3> #include <GUIConstantsEx.au3> ; Param Local Const $iPxColor = 0xFF00FF00 ; Pixel color for fractal Alpha/R/G/B Local Const $iBgColor = 0xFFFFFFFF ; Background color for image Alpha/R/G/B Local Const $iSize = 1000 ; Hight of fern in pixels - image will have this hight and width too Local Const $iIter = $iSize*400 ; Number of iterations - $iSize * 200 is a good starting point ; Call function ;$start = TimerInit() _Fern($iSize,$iIter) ;MsgBox(0,"Time taken:",Round(TimerDiff($start)/1000,3) &" seconds") ; Function for generating Barnsley Fractal Fern Func _Fern($Size,$Iter) _GDIPlus_Startup() ; initialize GDI+ Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($Size, $Size) ; create an empty bitmap Local $hBmpCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) ; get the graphics context of the image _GDIPlus_GraphicsClear($hBmpCtxt, $iBgColor) ; Set the background color for empty bitmap ; Here the magic happens $x=0 ; init $y=0 ; init $f = $Size/10.6 ; scale factor. Complete fern is within 0 <= y <= 9.9983 (with no scale) $offset_x = $Size/2 - $Size/40 ; Side adjustment. Fern is within −2.1820 < x < 2.6558 (with no scale) For $n = 1 To $Iter ; Number of iterations $r = Random(0, 99, 1) Select Case $r < 85 ; 0-84 = 85% of the time $xn = 0.85 * $x + 0.04 * $y $yn = -0.04 * $x + 0.85 * $y + 1.6 Case $r > 84 AND $r < 92 ; 85-91 = 7% of the time $xn = 0.2 * $x - 0.26 * $y $yn = 0.23 * $x + 0.22 * $y + 1.6 Case $r > 91 AND $r < 99 ; 92-98 = 7% of the time $xn = -0.15 * $x + 0.28 * $y $yn = 0.26 * $x + 0.24 * $y + 0.44 Case Else ; 99-99 = 1% of the time $xn = 0 $yn = 0.16 * $y EndSelect $x = $xn $y = $yn _GDIPlus_BitmapSetPixel($hBitmap, $offset_x + $x * $f, $Size - $y * $f, $iPxColor) ; Change pixel color for calculated X,Y Next ; ==> End of magic $File = "\Fractal_Fern_"&StringRight(Hex($iPxColor),6)&"-"&StringRight(Hex($iBgColor),6)&"-"&$iSize&".png" _GDIPlus_ImageSaveToFile($hBitmap, @MyDocumentsDir & $File) ;save bitmap to disk ShellExecute(@MyDocumentsDir & $File); Show it to the world in your default image viewer ; Cleanup GDI+ resources _GDIPlus_GraphicsDispose($hBmpCtxt) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_Shutdown() EndFunc ;==> _Fern  
       

    • loganizzi
      By loganizzi
      If you look at the help file for the above command, you'll see that it states that it only works for certain zoom values (100 and 200 to 6400).   I assume that this is due to an issue in an MSDN library that the command relies on.
      After doing some investigating, I noticed that the GUIRichEdit.au3 library file contains the following code:
      ; #FUNCTION# ==================================================================================================================== ; Authors........: Chris Haslam (c.haslam) ; Modified ......: ; =============================================================================================================================== Func _GUICtrlRichEdit_SetZoom($hWnd, $iPercent) If Not _WinAPI_IsClassName($hWnd, $__g_sRTFClassName) Then Return SetError(101, 0, False) If Not __GCR_IsNumeric($iPercent, ">0") Then Return SetError(1021, 0, False) Local $iNumerator, $iDenominator Select Case Not ($iPercent = 100 Or ($iPercent >= 200 And $iPercent < 6400)) Return SetError(1022, 0, False) Case $iPercent >= 100 $iNumerator = 10000 $iDenominator = 10000 / ($iPercent / 100) Case Else $iNumerator = 10000 * ($iPercent / 100) $iDenominator = 10000 EndSelect Return _SendMessage($hWnd, $EM_SETZOOM, $iNumerator, $iDenominator) <> 0 EndFunc ;==>_GUICtrlRichEdit_SetZoom Which ensures that values are only within the bounds specified in the help file.    I found that if I comment out the portion of the code that limits the values, the function works fine for most (if not all) values.   I changed the code in the library file to this by simply commenting out the restricting lines of code:
      ; #FUNCTION# ==================================================================================================================== ; Authors........: Chris Haslam (c.haslam) ; Modified ......: ; =============================================================================================================================== Func _GUICtrlRichEdit_SetZoom($hWnd, $iPercent) If Not _WinAPI_IsClassName($hWnd, $__g_sRTFClassName) Then Return SetError(101, 0, False) If Not __GCR_IsNumeric($iPercent, ">0") Then Return SetError(1021, 0, False) Local $iNumerator, $iDenominator Select ; Case Not ($iPercent = 100 Or ($iPercent >= 200 And $iPercent < 6400)) ; Return SetError(1022, 0, False) Case $iPercent >= 100 $iNumerator = 10000 $iDenominator = 10000 / ($iPercent / 100) Case Else $iNumerator = 10000 * ($iPercent / 100) $iDenominator = 10000 EndSelect Return _SendMessage($hWnd, $EM_SETZOOM, $iNumerator, $iDenominator) <> 0 EndFunc ;==>_GUICtrlRichEdit_SetZoom  
      I assume whatever windows bug existed at the time this was created, no longer exists so there is no need to restrict the values.   
      Just wanted to point this out if anyone else is using this part of the library and required this functionality like I did.
       
    • rootx
      By rootx
      how can I fit the image when the GUI is maximized? I would like to always measure the 50% height and width of the GUI and is always in the bottom right poistion, and does not lose its quality.
      THX
       
      #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <Array.au3> #include <WinAPI.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 437, 192, 124,BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_TABSTOP)) _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir&"\img.jpg") $hGraphics = _GDIPlus_GraphicsCreateFromHWND($Form1) $resimg = _GDIPlus_ImageResize($hImage,200,300) _GDIPlus_GraphicsDrawImage($hGraphics, $resimg, 0, 0) GUIRegisterMsg($WM_PAINT, "MY_WM_PAINT") ;GUIRegisterMsg($WM_SIZE, "WM_SIZE") GUISetState(@SW_SHOW,$Form1) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func MY_WM_PAINT($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam _WinAPI_RedrawWindow($Form1, 0, 0, $RDW_UPDATENOW) _GDIPlus_GraphicsDrawImage($hGraphics, $resimg, 300, 0) _WinAPI_RedrawWindow($Form1, 0, 0, $RDW_VALIDATE) Return $GUI_RUNDEFMSG EndFunc ;==>MY_WM_PAINT ;Func WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam) ; #forceref $hWnd, $iMsg, $iwParam, $ilParam ; Local $xClient, $yClient ; $xClient = BitAND($ilParam, 0x0000FFFF) ; $yClient = BitShift($ilParam, 16) ; _WinAPI_RedrawWindow($Form1, 0, 0, $RDW_UPDATENOW) ; _GDIPlus_GraphicsDrawImage($hGraphics, $resimg, $xClient/2, $yClient/2) ; _WinAPI_RedrawWindow($Form1, 0, 0, $RDW_VALIDATE) ; ConsoleWrite($xClient & " "&$yClient&@CR) ; Return $GUI_RUNDEFMSG ;EndFunc  
    • chacoya121
      By chacoya121
      plz help explain between GDI+ and Winapi, is it desktop inside another desktop, 3 layer dimension?
      i can't get the picture
      1. u get desktop u can visual see
      2. then u create GDI+ startup another desktop screen dimension?
      3. then u have Winapi command inside GDI+, is this another desktop screen dimension? cuz GDI+ could create bitmap that is one dimension? Winapi get windowDC also another dimension?
      plz help and explain, with picture would be nice, im not good with visualize ("dumb newbie"), still learning
      newbie to programming world
      thankyou.
    • mdwerne
      By mdwerne
      I'm attempting to cobble together a replacement for the 64bit version of BGInfo that will run within WinPE 10/64. I've located a couple useful threads:
       Between the two, they get me close (see code below), but for some reason GDI+ is not working the same within WinPE as it does in Windows 10. Bottomline is that the "Text" never get's written to WallPaper.
      Here is what I have thus far. Any thoughts if any of the GDI commands might not work within WinPE? Any other way to achieve the same result (system information on the wallpaper in WinPE 10)?
      #include <GDIPlus.au3> #include <Date.au3> _GDIPlus_Startup() $image = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\WallPaper.bmp") $imagegraphics = _GDIPlus_ImageGetGraphicsContext($image) $w = _GDIPlus_ImageGetWidth($image) $h = _GDIPlus_ImageGetHeight($image) $whitebrush = _GDIPlus_BrushCreateSolid(0xFFFFFFFF) $fontfamily = _GDIPlus_FontFamilyCreate("Arial") $font = _GDIPlus_FontCreate($fontfamily, 16) $stringformat = _GDIPlus_StringFormatCreate() _GDIPlus_StringFormatSetAlign($stringformat, 2) $rect = _GDIPlus_RectFCreate(0, $h - $h + 100, $w - 25, $h) ;$rect = _GDIPlus_RectFCreate(100, 100, 200, 200) _GDIPlus_GraphicsDrawStringEx($imagegraphics, _Now() & @CRLF & @UserName & @CRLF & @ComputerName & @CRLF & @IPAddress1, $font, $rect, $stringformat, $whitebrush) _GDIPlus_ImageSaveToFile($image, @ScriptDir & "\NewWallPaper.bmp") _GDIPlus_ImageDispose($image) _GDIPlus_GraphicsDispose($imagegraphics) _GDIPlus_BrushDispose($whitebrush) _GDIPlus_FontFamilyDispose($fontfamily) _GDIPlus_FontDispose($font) _GDIPlus_StringFormatDispose($stringformat) _GDIPlus_Shutdown() _ChangeDesktopWallpaper(@ScriptDir & "\NewWallPaper.bmp", 2) Func _ChangeDesktopWallpaper($bmp, $style = 0) ;=============================================================================== ; ; Function Name: _ChangeDesktopWallPaper ; Description: Update WallPaper Settings ; Usage: _ChangeDesktopWallPaper(@WindowsDir & '\' & 'zapotec.bmp',1) ; Parameter(s): $bmp - Full Path to BitMap File (*.bmp) ; [$style] - 0 = Centered, 1 = Tiled, 2 = Stretched ; Requirement(s): None. ; Return Value(s): On Success - Returns 0 ; On Failure - -1 ; Author(s): FlyingBoz ; Thanks: Larry - DllCall Example - Tested and Working under XPHome and W2K Pro ; Excalibur - Reawakening my interest in Getting This done. ; ;=============================================================================== If Not FileExists($bmp) Then Return -1 ;The $SPI* values could be defined elsewhere via #include - if you conflict, ; remove these, or add if Not IsDeclared "SPI_SETDESKWALLPAPER" Logic Local $SPI_SETDESKWALLPAPER = 20 Local $SPIF_UPDATEINIFILE = 1 Local $SPIF_SENDCHANGE = 2 Local $REG_DESKTOP = "HKEY_CURRENT_USER\Control Panel\Desktop" If $style = 1 Then RegWrite($REG_DESKTOP, "TileWallPaper", "REG_SZ", 1) RegWrite($REG_DESKTOP, "WallpaperStyle", "REG_SZ", 0) Else RegWrite($REG_DESKTOP, "TileWallPaper", "REG_SZ", 0) RegWrite($REG_DESKTOP, "WallpaperStyle", "REG_SZ", $style) EndIf DllCall("user32.dll", "int", "SystemParametersInfo", _ "int", $SPI_SETDESKWALLPAPER, _ "int", 0, _ "str", $bmp, _ "int", BitOR($SPIF_UPDATEINIFILE, $SPIF_SENDCHANGE)) Return 0 EndFunc ;==>_ChangeDesktopWallpaper Thanks for your time,
      -Mike