Jump to content

Recommended Posts

Posted

So i know how to put PNG file on GUI

But i want it to display only PNG file, without GUI frame, X button, minimalize button or white background

Any suggestions?

Posted

Hell, yea

I forgot that there is different GUI help section and i was searching here

Now i found what that, thanks

Posted

Try this

#include <GDIPlus.au3>
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
Dim $_GuiDelete

$_PngUrl = 'http://www.uclouvain.be/cps/ucl/doc/adcp/images/Google_logo.png'
$_PngPath = @TempDir & "\temp1.png"
If Not FileExists ( $_PngPath ) Then InetGet ( $_PngUrl, $_PngPath, 1 )
_GDIPlus_Startup ( )
$_Image = _GDIPlus_ImageLoadFromFile ( $_PngPath )
$_Width = _GDIPlus_ImageGetWidth ( $_Image )
$_Height = _GDIPlus_ImageGetHeight ( $_Image )
$_Ratio = $_Width / $_Height
$_Width = 600  
$_Gui = GUICreate ( "gui", $_Width , $_Width / $_Ratio, -1, -1, -1, BitOR ( $WS_EX_LAYERED, $WS_EX_TOPMOST ) )
$_Image = _ImageResize ( $_PngPath, $_Width, $_Width / $_Ratio ) 
_SetBitMap ( $_Gui, $_Image, 255, $_Width, $_Width / $_Ratio )
GUISetState ( @SW_SHOW )

While 1
    Sleep ( 20 )
WEnd

_GDIPlus_GraphicsDispose ( $_Image )
_GDIPlus_Shutdown ( )
Exit

Func _SetBitmap ( $hGUI, $hImage, $iOpacity, $n_width, $n_height )
    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", $n_width )
    DllStructSetData ( $tSize, "Y", $n_height )
    $tSource = DllStructCreate ( $tagPOINT )
    $pSource = DllStructGetPtr ( $tSource )
    $tBlend = DllStructCreate ( $tagBLENDFUNCTION )
    $pBlend = DllStructGetPtr ( $tBlend )
    DllStructSetData ( $tBlend, "Alpha", $iOpacity )
    DllStructSetData ( $tBlend, "Format", 1 )
    _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 ;==> _SetBitmap ( )

Func _ImageResize ( $sInImage, $newW, $newH, $sOutImage = "" )
    Local $oldImage, $GC, $newBmp, $newGC
    If $sOutImage = "" Then _GDIPlus_Startup ( )
    $oldImage = _GDIPlus_ImageLoadFromFile ( $sInImage )
    $GC = _GDIPlus_ImageGetGraphicsContext ( $oldImage )
    $newBmp = _GDIPlus_BitmapCreateFromGraphics ( $newW, $newH, $GC )
    $newGC = _GDIPlus_ImageGetGraphicsContext ( $newBmp )
    _GDIPlus_GraphicsDrawImageRect ( $newGC, $oldImage, 0, 0, $newW, $newH )
    _GDIPlus_GraphicsDispose ( $GC )
    _GDIPlus_GraphicsDispose ( $newGC )
    _GDIPlus_ImageDispose ( $oldImage )
    If $sOutImage = "" Then
    Return $newBmp 
    Else
    _GDIPlus_ImageSaveToFile ( $newBmp, $sOutImage )
    _GDIPlus_BitmapDispose ( $newBmp )
    _GDIPlus_Shutdown ( )
    Return 1
    EndIf
EndFunc ;==> _ImageResize ( )

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

  • 1 year later...
Posted

Hi this is exactly what I'm looknig for and it works great, but do you know if it's possible to allow the gui to be moved (with mouse).

Actually I'm looking for something like a floating icon always on top (with action on left click and possibility to be moved).

This script does the trick (I can catch up the primary button with $GUI_EVENT_PRIMARYUP) but I don't know how to move the gui..

Can you help me please?

Thank you in advance.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...