Jump to content

SplashImage problem can move the image


sancas
 Share

Recommended Posts

hello, forgiveness, but I have another problem with the splashimage and I need your help.

I have the code of splash and runs and everything is 100% but I do not like is that I can move a splash in everything that is closed and I want the splash stay focused until the closing, I can say to change in the code please.

Thank you

private
Edited by sancas
Link to comment
Share on other sites

hello, forgiveness, but I have another problem with the splashimage and I need your help.

I have the code of splash and runs and everything is 100% but I do not like is that I can move a splash in everything that is closed and I want the splash stay focused until the closing, I can say to change in the code please.

Thank you

I am really hoping this will solve the problem you described.

Three things changed/added.

1. Added loop Do - Until. Press Esc to exit this loop at run time.

2. Changed to _GDIPlus_ImageDispose($hImage).

3. Commented out ; _WinAPI_SelectObject($hMemDC, $hOld)

If you do not want the image on the layered GUI, (flash) to be draggable, then comment out this line:-

; GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")

#NoTrayIcon
#include <GDIPlus.au3>
;#include <GuiComboBox.au3>
;#include <File.au3>
;#include <Array.au3>
#include <WindowsConstants.au3>
;#include <GuiConstantsEx.au3>
;#include <ButtonConstants.au3>

Opt("MustDeclareVars", 0)
Global Const $AC_SRC_ALPHA = 1
_GDIPlus_Startup()
$pngSrc = "C:\Documents and Settings\All Users.WINDOWS\Desktop\Bitm.png"
$hImage = _GDIPlus_ImageLoadFromFile($pngSrc)
$width = _GDIPlus_ImageGetWidth($hImage)
$height = _GDIPlus_ImageGetHeight($hImage)
$GUI = GUICreate("Portables by Sancas", $width, $height, -1, -1, $WS_POPUP, $WS_EX_LAYERED)
SetBitmap($GUI, $hImage, 0)
GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")
GUISetState()
WinSetOnTop($GUI, "", 1)
For $i = 0 To 255 Step 5
    SetBitmap($GUI, $hImage, $i)
Next

Do
    Sleep(10)
Until GUIGetMsg() = -3 ; Press Esc to exit

For $i = 255 To 0 Step -5
    SetBitmap($GUI, $hImage, $i)
Next
_GDIPlus_ImageDispose($hImage)
_GDIPlus_Shutdown()


Func GoAutoComplete()
    ;_GUICtrlComboBox_AutoComplete($Combo)
EndFunc   ;==>GoAutoComplete

Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam)
    If ($hWnd = $GUI) And ($iMsg = $WM_NCHITTEST) Then Return $HTCAPTION
EndFunc   ;==>WM_NCHITTEST

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   ;==>SetBitmap
Link to comment
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
 Share

  • Recently Browsing   0 members

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