Jump to content

GDI+ With GUICtrlCreateTab's


AzKay
 Share

Recommended Posts

Kay, So ive got this:

#NoTrayIcon
#include <GUIConstants.au3>
#include <GDIPlus.au3>
#Include <File.au3>

Opt("MustDeclareVars", 0)

Global Const $AC_SRC_ALPHA      = 1
Global Const $ULW_ALPHA         = 2

_GDIPlus_Startup()
$pngSrc = @ScriptDir & "\gui2.png"
$hImage = _GDIPlus_ImageLoadFromFile($pngSrc)
$width =  _GDIPlus_ImageGetWidth ($hImage)
$height = _GDIPlus_ImageGetHeight($hImage)

$GUI = GUICreate("BomBa", $width, $height, -1, -1, $WS_POPUP, $WS_EX_LAYERED)
SetBitMap($GUI, $hImage, 255)
GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")
GUISetState()

$controlGui = GUICreate("BomBa", $width, $height, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED,$WS_EX_MDICHILD), $GUI)
GUICtrlCreatePic(@ScriptDir & "\grey.gif", 0, 0, $width, $height)
GUICtrlSetState(-1, $GUI_DISABLE)
$Tab1 = GUICtrlCreateTab(0, 0, 289, 281)
GUICtrlCreateTabItem("asd")
GUICtrlCreateTabItem("asdszfsdf")
GUISetState()

While 1

WEnd

GUIDelete($controlGui)
_WinAPI_DeleteObject($hImage)
_GDIPlus_Shutdown()

Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam)
  if ($hWnd = $GUI) 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

Any ideas why the Tab's arent created?

Works fine with inputbox's, labels, etc. But not with tabs.

Posted Image

^ gui2.png ^

Posted Image

^ grey.gif ^

# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

"Bump".

If you change the 2 GuiCreate lines to these -

$GUI = GUICreate("BomBa", $width, $height, 0, 0, $WS_POPUP);, $WS_EX_LAYERED)
.
.


$controlGui = GUICreate("BomBa2", $width, $height, 10, 10, BitOr($WS_CHILD, $WS_EX_LAYERED), -1, $gui)

then it might give what you want.

You need to make the child window smaller than the parent though or there will be nowhere you can click on the parent to use the $WM_NCHITTEST message, so I've just shifted it a bit. (10,10)

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

replace this

$controlGui = GUICreate("BomBa", $width, $height, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED,$WS_EX_MDICHILD), $GUI)
GUICtrlCreatePic(@ScriptDir & "\grey.gif", 0, 0, $width, $height)
GUICtrlSetState(-1, $GUI_DISABLE)
$Tab1 = GUICtrlCreateTab(0, 0, 289, 281)
GUICtrlCreateTabItem("asd")
GUICtrlCreateTabItem("asdszfsdf")
GUISetState()

with

$controlGui = GUICreate("BomBa", $width, $height, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED,$WS_EX_MDICHILD), $GUI)
$Tab1 = GUICtrlCreateTab(0, 0, 289, 281)
GUICtrlCreateTabItem("asd")
GUICtrlCreateTabItem("asdszfsdf")
GUICtrlCreateTabItem("asdszfsdf")
GUICtrlCreateTabItem("asdszfsdf")
GUICtrlCreatePic(@ScriptDir & "\grey.gif", 0, 0, $width, $height)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState(@SW_SHOW, $controlGui)
Link to comment
Share on other sites

;rspdll burn
#NoTrayIcon
#include <GUIConstants.au3>
#include <GDIPlus.au3>
#Include <File.au3>

Opt("MustDeclareVars", 0)

Global Const $AC_SRC_ALPHA = 1
Global Const $ULW_ALPHA = 2

_GDIPlus_Startup()
$pngSrc = @ScriptDir & "\gui2.png"
$hImage = _GDIPlus_ImageLoadFromFile($pngSrc)
$width =  _GDIPlus_ImageGetWidth ($hImage)
$height = _GDIPlus_ImageGetHeight($hImage)

$GUI = GUICreate("BomBa", $width, $height, -1, -1, $WS_POPUP, $WS_EX_LAYERED)
SetBitMap($GUI, $hImage, 255)
GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")
GUISetState(@SW_SHOW, $GUI)

$controlGui = GUICreate("BomBa", $width, $height, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED,$WS_EX_MDICHILD), $GUI)
GUISetBkColor(0x000000)
$Tab1 = GUICtrlCreateTab(0, 0, 289, 281, -1, $WS_EX_TRANSPARENT)
GUICtrlCreateTabItem("asd")
GUICtrlCreateTabItem("asdszfsdf")
GUICtrlCreatePic(@ScriptDir & "\grey.gif", 0, 0, $width, $height)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState(@SW_SHOW, $controlGui)

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = -3
            GUIDelete($GUI)
            GUIDelete($controlGui)
            _WinAPI_DeleteObject($hImage)
            _GDIPlus_Shutdown()
            Exit
    EndSelect
WEnd

Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam)
  if ($hWnd = $GUI) 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

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...