Zohran Posted June 25, 2012 Posted June 25, 2012 (edited) high. the problem is that i have crated a gui window with attribute set to $WS_EX_TOPMOST. but when i start a game it remains on back.??? expandcollapse popup#include <WinAPI.au3> #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <_PDH_PerformanceCounters.au3> Global Const $iRadius = 8 Global Const $iOpacity = 200 Global Const $AC_SRC_ALPHA = 0 Global $sString = "",$timer,$hGUI Global Enum $eScrDC = 0, $eMemDC, $eBitmap, $eWidth, $eHeight, $eGraphic, $eLast Global $hPDHQuery, $aCPUCounters, $iTotalCPUs _GDIPlus_Startup() $hCPU = GUICreate("786",$iRadius*110,$iRadius*2, 0,0,0, BitOR($WS_EX_TOOLWINDOW,$WS_EX_LAYERED, $WS_EX_TOPMOST)) GUISetState() $hGraphic = ResourceInit($iRadius*110,$iRadius*2) $hBrush = _GDIPlus_BrushCreateSolid(0xFFFFFF2F) $hFormat = _GDIPlus_StringFormatCreate() $hFamily = _GDIPlus_FontFamilyCreate("Arial") $hFont = _GDIPlus_FontCreate($hFamily,10,0) $tLayout = _GDIPlus_RectFCreate(0, 0, $iRadius * 110,$iRadius*2 ) _PDH_Init() $hPDHQuery = _PDH_GetNewQueryHandle() $aCPUCounters = _PDH_GetCPUCounters($hPDHQuery, "") $iTotalCPUs = @extended Func ResourceInit($iWidth, $iHeight) Local $aInfo[$eLast + 1] $aInfo[$eScrDC] = _WinAPI_GetDC(0) $aInfo[$eMemDC] = _WinAPI_CreateCompatibleDC($aInfo[$eScrDC]) $aInfo[$eBitmap] = _WinAPI_CreateCompatibleBitmap($aInfo[$eScrDC], $iWidth, $iHeight) _WinAPI_SelectObject($aInfo[$eMemDC], $aInfo[$eBitmap]) $aInfo[$eWidth] = $iWidth $aInfo[$eHeight] = $iHeight $aInfo[$eGraphic] = _GDIPlus_GraphicsCreateFromHDC($aInfo[$eMemDC]) _GDIPlus_GraphicsFillRect($aInfo[$eGraphic], 0, 0, $iRadius * 110, $iRadius * 2) Return $aInfo EndFunc ;==>ResourceInit Func ResourceSet($hGUI, ByRef $aInfo, $iAlpha = -1) Local $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend If $iAlpha = -1 Then $iAlpha = $iOpacity $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", $aInfo[$eWidth]) DllStructSetData($tSize, "Y", $aInfo[$eHeight]) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iAlpha) DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA) _WinAPI_UpdateLayeredWindow($hGUI, $aInfo[$eScrDC], 0, $pSize, $aInfo[$eMemDC], $pSource, 0, $pBlend, $ULW_ALPHA) EndFunc ;==>ResourceSet While 1 = 1 Sleep(1000) _PDH_CollectQueryData($hPDHQuery) $iCounterValue = _PDH_UpdateCounter($hPDHQuery, $aCPUCounters[$iTotalCPUs - 1][1], 0, True) $mem = MemGetStats() $sString = "CPU:" & $iCounterValue & "%" & " ,Memory Load: " & $mem[0] & "% ,GPU TEMP/LOAD:" & ControlGetText("TechPowerUp GPU-Z 0.6.2","","Static73") & "/ " & ControlGetText("TechPowerUp GPU-Z 0.6.2","","Static82") & ",GCC:" & ControlGetText("TechPowerUp GPU-Z 0.6.2","","Static67") & ",GMC:" & ControlGetText("TechPowerUp GPU-Z 0.6.2","","Static70") & ",Dedicated:" & ControlGetText("TechPowerUp GPU-Z 0.6.2","","Static88") & ",Dynamic:" & ControlGetText("TechPowerUp GPU-Z 0.6.2","","Static91") $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic[$eGraphic], $sString, $hFont, $tLayout, $hFormat) _GDIPlus_GraphicsFillRect($hGraphic[$eGraphic], 0, 0, $iRadius * 110, $iRadius * 2) _GDIPlus_GraphicsDrawStringEx($hGraphic[$eGraphic], $sString, $hFont, $aInfo[0], $hFormat, $hBrush) ResourceSet($hCPU, $hGraphic) WEnd Func _PDH_GetCPUCounters($hPDHQuery, $sPCName = "") If $sPCName <> "" And StringLeft($sPCName, 2) = "" Then $sPCName = StringTrimLeft($sPCName, 1) Local $aCPUsList = _PDH_GetCounterList(":2386(*)" & $sPCName) If @error Then Return SetError(@error, @extended, "") Local $aCPUCounters = _PDH_AddCountersByArray($hPDHQuery, $aCPUsList, 1, -1) If @error Then Return SetError(@error, @extended, "") Return SetExtended($aCPUsList[0], $aCPUCounters) EndFunc ;==>_PDH_GetCPUCounters Edited June 25, 2012 by Zohran
Zohran Posted June 26, 2012 Author Posted June 26, 2012 hey is there no one out there for the solution????
AZJIO Posted June 26, 2012 Posted June 26, 2012 expandcollapse popup#include <WinAPI.au3> #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> ; #include <_PDH_PerformanceCounters.au3> Global Const $iRadius = 8 Global Const $iOpacity = 200 Global Const $AC_SRC_ALPHA = 0 Global $sString = "", $timer, $hGUI Global Enum $eScrDC = 0, $eMemDC, $eBitmap, $eWidth, $eHeight, $eGraphic, $eLast Global $hPDHQuery, $aCPUCounters, $iTotalCPUs _GDIPlus_Startup() $hCPU = GUICreate("786", $iRadius * 110, $iRadius * 2, 0, 0, 0, BitOR($WS_EX_TOOLWINDOW, $WS_EX_LAYERED)) $hGraphic = ResourceInit($iRadius * 110, $iRadius * 2) $hBrush = _GDIPlus_BrushCreateSolid(0xFFFFFF2F) $hFormat = _GDIPlus_StringFormatCreate() $hFamily = _GDIPlus_FontFamilyCreate("Arial") $hFont = _GDIPlus_FontCreate($hFamily, 10, 0) $tLayout = _GDIPlus_RectFCreate(0, 0, $iRadius * 110, $iRadius * 2) GUISetState() GUISetState(@SW_RESTORE) Sleep(200) WinSetOnTop($hCPU, '', 1) WinSetOnTop($hCPU, '', 0) WinSetOnTop($hCPU, '', 1) While 1 Sleep(1000) $iCounterValue = '' $mem = MemGetStats() $sString = "CPU:" & $iCounterValue & "%" & " ,Memory Load: " & $mem[0] & "% ,GPU TEMP/LOAD:" & ControlGetText("TechPowerUp GPU-Z 0.6.2", "", "Static73") & "/ " & ControlGetText("TechPowerUp GPU-Z 0.6.2", "", "Static82") & ",GCC:" & ControlGetText("TechPowerUp GPU-Z 0.6.2", "", "Static67") & ",GMC:" & ControlGetText("TechPowerUp GPU-Z 0.6.2", "", "Static70") & ",Dedicated:" & ControlGetText("TechPowerUp GPU-Z 0.6.2", "", "Static88") & ",Dynamic:" & ControlGetText("TechPowerUp GPU-Z 0.6.2", "", "Static91") $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic[$eGraphic], $sString, $hFont, $tLayout, $hFormat) _GDIPlus_GraphicsFillRect($hGraphic[$eGraphic], 0, 0, $iRadius * 110, $iRadius * 2) _GDIPlus_GraphicsDrawStringEx($hGraphic[$eGraphic], $sString, $hFont, $aInfo[0], $hFormat, $hBrush) ResourceSet($hCPU, $hGraphic) WEnd Func ResourceInit($iWidth, $iHeight) Local $aInfo[$eLast + 1] $aInfo[$eScrDC] = _WinAPI_GetDC(0) $aInfo[$eMemDC] = _WinAPI_CreateCompatibleDC($aInfo[$eScrDC]) $aInfo[$eBitmap] = _WinAPI_CreateCompatibleBitmap($aInfo[$eScrDC], $iWidth, $iHeight) _WinAPI_SelectObject($aInfo[$eMemDC], $aInfo[$eBitmap]) $aInfo[$eWidth] = $iWidth $aInfo[$eHeight] = $iHeight $aInfo[$eGraphic] = _GDIPlus_GraphicsCreateFromHDC($aInfo[$eMemDC]) _GDIPlus_GraphicsFillRect($aInfo[$eGraphic], 0, 0, $iRadius * 110, $iRadius * 2) Return $aInfo EndFunc Func ResourceSet($hGUI, ByRef $aInfo, $iAlpha = -1) Local $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend If $iAlpha = -1 Then $iAlpha = $iOpacity $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", $aInfo[$eWidth]) DllStructSetData($tSize, "Y", $aInfo[$eHeight]) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iAlpha) DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA) _WinAPI_UpdateLayeredWindow($hGUI, $aInfo[$eScrDC], 0, $pSize, $aInfo[$eMemDC], $pSource, 0, $pBlend, $ULW_ALPHA) EndFunc My other projects or all
Zohran Posted June 26, 2012 Author Posted June 26, 2012 (edited) still not working. ok . let me clarify more . when we use a fps (frames per second utilty) we can see the frames on our screen . it is displaying on top of every window. just like that i want my gui to be displayed on top of every window Edited June 27, 2012 by Zohran
Zohran Posted June 28, 2012 Author Posted June 28, 2012 Looks Like There is no soluton to it in autoit.
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