explorerpl

Adobe AIR like window

8 posts in this topic

It's been long enough since I started looking for a solution, so I post this with a clear conscious. 

I am developing an application that would render keystrokes and click on the screen, much like KeyCastr on Mac OS. I did this once in the past. Back then I faced with the same problem - making a nice semitransparent window. I solved it by using Adobe AIR for the interface and Visual Basic for the data. VB was the server capturing the keystrokes and mouse events and passing them via TCP over localhost to Adobe AIR (compiled to exe). This solution worked quite ok. I even tried reviving it few hours before posting it with no success.

Important note - this is NOT a keylogger, though it shares some core functionality with such application. I do not ask for tips on capturing keyboards events (though if someone could post something useful I'd be grateful). 

These are some posts that I've found on the forum:
https://www.autoitscript.com/forum/topic/137618-two-questions-about-layered-gui/#comment-963975
https://www.autoitscript.com/forum/topic/102961-multiple-png-images-as-gui-elements/
https://www.autoitscript.com/forum/topic/47651-png-as-gui-drop-shadows-curved-edges-you-name-it/
https://www.autoitscript.com/forum/topic/102920-advanced-gui-udf-design/
https://www.autoitscript.com/forum/topic/157841-gui-fun/#comment-1144334
https://www.autoitscript.com/forum/topic/140053-just-the-text/#comment-983400
and even more...

The reason for not using an existing application is that there aren't many for windows, they look ugly, and they do not behave the way I need them too.

I've tried these approaches, but I'm either to stupid to understand them fully or I'm simply missing something. The main problem that I'm having is having the window transparent and displaying a label with text on top of it. As you know regular controls will not be transparent. I figured out that making a child window (transparent) on top of the parent transparent window might be the solution (I figured it out myself before finding some posts about it so I'm pretty proud of myself :)). Still... even if I do so the text is not anti-aliased and simply looks ugly.

I could really use an example code that creates a window that has a PNG as a background with a nice label on top that has drop shadow (two labels? one black for the shadow and one white for the text). The window should also be dragable with a mouse.

Here's a video with my old app running (start watching from 0:50)https://www.youtube.com/watch?v=C7fSpZntpfA
Here's a similar application called KeyPose: http://jungsbluth.de/magnus/blog/keypose/keypose.html

At some point I thought I'd just create a flash object on my window and make it transparent (I've seen this done even back in Windows 98). The difficulty here is that it's not a binary transparency, but a 32bpc one - real, smooth alpha channel like in a PNG, which is what most of the code I've seen is doing. Unfortunately I wasn't able to check that code, because I fail to create the Shockwave.Shockwave.11 object. I've installed the Flash player and the Shockwave player manually, registered the OCX, but no success.

TL;DR

Honestly - the solution to all my problems and problems other users are having would be replicating the behavior of such apps, that take an SWF and make a windowless EXE out of them. Just take a look at the attached file. Please note that the BG is semi-transparent, the labels are anti-aliased with a drop shadow. This is my old solution using Adobe AIR (Flash). I'd like to replicate that as closely as possible.

I really hope some good soul will help me with this.
Thank you.

 

screen.png

Share this post


Link to post
Share on other sites



explorerpl,

I do not ask for tips on capturing keyboards events (though if someone could post something useful I'd be grateful). 

Good, because if the thread does stray into that area it will be closed - and anyone posting such code will be sanctioned.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Good, because if the thread does stray into that area it will be closed - and anyone posting such code will be sanctioned.

I've noticed :) I fully understand the policy, though hooking into system events is a valid programming skill and it would be nice to have some examples and have them stripped out of "keylogging" functionality but have them close enough so that a smart person can figure it out. Still - that wouldn't help me :) I'm not that smart, that's why I need help, but not with keylogging. I'm solving one problem at a time :)

The solution to my problem (which essentially is creating a nice antialiased text on transparent background) seems so close with all the examples on the forum, yet I can't figure it out. Examples I've seen use a binary transparency (based on one color) which causes nasty edges. 8 bit transparency like with PNG and Layered Windows) use PNG's and that's great, but doesn't help me either.

At some point I was thinking about painting the PNG "in memory" (no files required) and then passing the resulting image as a "fake PNG" to use along with the Layered Windows examples. Again - this is to complex for my brain.

As for Adobe AIR it seems this is exactly what they are doing to create these nice transparent windows. How else could they do that? There's no single color to be set as transparent, the SWF that is being displayed can be anything and it works. If someone could figure out how to do that we all would be saved and eternaly happy creating out GUIs in Adobe Flash, publish them to SWF, and then put them in out AutoIt apps.

But again... The bottom line is that I need a nice antialiased text, with a shadow, on a semi transparent window with rounded corners.

Anyone?

Share this post


Link to post
Share on other sites

Ok. I think I'm done. I've seen people asking for good keyboard and mouse hooks UDF's, but due to forum policy such a thing (especially a keyboard hook) would constitute a KeyLogger. Just as mentioned above in this thread my project is NOT a keylogger though it shares many of such application characteristics. 

Would it be ok if I posted my compiled project so that others could also use it instead of a keylogger UDF? The app sends what it captures to localhost over TCP connection. No source code.

Share this post


Link to post
Share on other sites

explorerpl,

Would it be ok if I posted my compiled project so that others could also use it instead of a keylogger UDF? The app sends what it captures to localhost over TCP connection. No source code.

You are joking? At least I do hope so. There is no way can you post something that.

M23 


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Just wanted to make sure :) It's somewhat strange to me that while there are examples in the AutoIt documentation on how to do global keyboard hookds it's not considered ethical to post usage of that on the forum. But whatever you say. Don't want to piss anyone off. :)

Share this post


Link to post
Share on other sites

Here something similar which I had created in the past without text and buttons:

;coded by UEZ 2013

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <GDIPlus.au3>

Global Const $SC_DRAGMOVE = 0xF012
Global Const $iW = 300, $iH = 200
_GDIPlus_Startup()

                            ;text                           x       y           text color      font                font size
Global $aText[6][6] = [ [   "Windows Translucent GUI",      10,     12,         0xFFFFFFFF,     "Arial",            18          ], _
                        [   "Connection port:",             10,     80,         0xFFFFFFFF,     "Arial",            11          ], _
                        [   "80",                           150,    80,         0xFFFFFFFF,     "Arial",            11          ], _
                        [   "Connection status:",           10,     100,        0xFFFFFFFF,     "Arial",            11          ], _
                        [   "offline",                      150,    100,        0xFFFF8080,     "Arial",            12          ], _
                        [   "Coded by UEZ 2015 ;-)",        10,     150,        0xFFFFFFFF,     "Comic Sans MS",    15          ]]

                            ;   x       y       w       h       bmp handle
Global $aButtons[2][5] = [  [   230,    150,    24,     24,     _GDIPlus_BitmapCreateFromMemory(_Nok2_24x24png())       ], _
                            [   260,    150,    24,     24,     _GDIPlus_BitmapCreateFromMemory(_Ok2_24x24png())        ]]

Global Const $hGUI = GUICreate("", $iW, $iH, -1, -1, $WS_POPUP, $WS_EX_LAYERED) ;must be set before _GDIPlus_CreateCurvedTranslucentPanel
Global Const $aReturn = _GDIPlus_CreateCurvedTranslucentPanel($aText, $aButtons, 0xE04576B2, 0x509FBADC, $iW, $iH)
GUISetState()

_WinAPI_BitmapSetTransparent($hGUI, $aReturn[0])

GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN")

Do
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            _GDIPlus_BitmapDispose($aReturn[0])
            _GDIPlus_Shutdown()
            GUIDelete($hGUI)
            Exit
        Case $aReturn[1] ;cancel
            MsgBox(0, "Info", "Cancel was pressed")
        Case $aReturn[2] ;ok
            MsgBox(0, "Info", "Ok was pressed")
    EndSwitch
Until False


Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam)
    _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0)
EndFunc   ;==>_WM_LBUTTONDOWN

Func _GDIPlus_CreateCurvedTranslucentPanel($aText, $aButtons, $iColorBG, $iColorFrame, $iW, $iH, $iRadiusCorner = 20, $bTextShadow = True) ;build 2015-11-03 by UEZ
    Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH)
    Local Const $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetSmoothingMode($hCtxt, 2)
    _GDIPlus_GraphicsSetInterpolationMode($hCtxt, 7)
    _GDIPlus_GraphicsSetPixelOffsetMode($hCtxt, 2)
    _GDIPlus_GraphicsSetTextRenderingHint($hCtxt, 5)

    Local Const $hPath = _GDIPlus_PathCreate()
    Local Const $hPath_Shape = _GDIPlus_PathCreate()

    Local $iPenSize = 2

    _GDIPlus_PathAddArc($hPath, $iW - ($iRadiusCorner * 2), 0, $iRadiusCorner * 2, $iRadiusCorner * 2, 270, 90)
    _GDIPlus_PathAddArc($hPath, $iW - ($iRadiusCorner * 2), $iH - ($iRadiusCorner * 2), $iRadiusCorner * 2, $iRadiusCorner * 2, 0, 90)
    _GDIPlus_PathAddArc($hPath, 0, $iH - ($iRadiusCorner * 2), $iRadiusCorner * 2, $iRadiusCorner * 2, 90, 90)
    _GDIPlus_PathAddArc($hPath, 0, 0, $iRadiusCorner * 2, $iRadiusCorner * 2, 180, 90)
    _GDIPlus_PathCloseFigure($hPath)

    Local $iColorBG2 = BitAND(0xFF000000, $iColorBG) + BitAND(0x00FF0000, $iColorBG) - 0x200000 + BitAND(0x0000FF00, $iColorBG) - 0x2000 + BitAND(0x000000FF, $iColorBG) - 0x20
    Local $hBrush_Bg = _GDIPlus_LineBrushCreate($iW / 2, 0, $iW / 2, $iH, $iColorBG2, $iColorBG)
    _GDIPlus_GraphicsFillPath($hCtxt, $hPath, $hBrush_Bg)


    Local $hBrush_Shape = _GDIPlus_LineBrushCreate($iW / 2, $iH / 5 + 7, $iW / 2, 0, $iColorFrame, 0xA0FFFFFF)

    _GDIPlus_PathAddArc($hPath_Shape, 0, 0, $iRadiusCorner * 2, $iRadiusCorner * 2, 180, 90)
    _GDIPlus_PathAddArc($hPath_Shape, $iW - ($iRadiusCorner * 2), 0, $iRadiusCorner * 2, $iRadiusCorner * 2, 270, 90)

    _GDIPlus_PathAddLine($hPath_Shape, 0, $iRadiusCorner, 0, $iH / 5)
    _GDIPlus_PathAddLine($hPath_Shape, 0, $iH / 5, $iW / 2, $iH / 5 + 7)
    _GDIPlus_PathAddLine($hPath_Shape, $iW, $iH / 5, $iW, $iRadiusCorner)
    _GDIPlus_PathCloseFigure($hPath_Shape)

    _GDIPlus_GraphicsFillPath($hCtxt, $hPath_Shape, $hBrush_Shape)

    Local $hPen = _GDIPlus_PenCreate(0xF0000000 + $iColorFrame, $iPenSize)
    _GDIPlus_GraphicsDrawPath($hCtxt, $hPath, $hPen)

    _GDIPlus_PathReset($hPath)
    Local $i, $hBrush, $hFamily, $hFormat, $tLayout
    Local $hBrush_Shadow = _GDIPlus_BrushCreateSolid(0xFF101010)
    For $i = 0 To UBound($aText) - 1
        $hBrush = _GDIPlus_BrushCreateSolid($aText[$i][3])  ;color
        $hFamily = _GDIPlus_FontFamilyCreate($aText[$i][4]) ;font
        $hFormat = _GDIPlus_StringFormatCreate()
        _GDIPlus_StringFormatSetAlign($hFormat, 0)  ;alignment
        $tLayout = _GDIPlus_RectFCreate($aText[$i][1] + $aText[$i][5] / 8, $aText[$i][2] + $aText[$i][5] / 8)
        _GDIPlus_PathAddString($hPath, $aText[$i][0], $tLayout, $hFamily, 0, $aText[$i][5], $hFormat)
        _GDIPlus_GraphicsFillPath($hCtxt, $hPath, $hBrush_Shadow)   ;draw shadow
        _GDIPlus_PathReset($hPath)
        $tLayout = _GDIPlus_RectFCreate($aText[$i][1], $aText[$i][2])
        _GDIPlus_PathAddString($hPath, $aText[$i][0], $tLayout, $hFamily, 0, $aText[$i][5], $hFormat)
        _GDIPlus_GraphicsFillPath($hCtxt, $hPath, $hBrush)
        _GDIPlus_PathReset($hPath)
        _GDIPlus_BrushDispose($hBrush)
        _GDIPlus_FontFamilyDispose($hFamily)
        _GDIPlus_StringFormatDispose($hFormat)
    Next

    Local $aReturn[UBound($aButtons) + 1]
    $aReturn[0] = $hBitmap
    For $i = 0 To UBound($aButtons) - 1
        _GDIPlus_GraphicsDrawImageRect($hCtxt, $aButtons[$i][4], $aButtons[$i][0], $aButtons[$i][1], $aButtons[$i][2], $aButtons[$i][3])
        _GDIPlus_ImageDispose($aButtons[$i][4])
        $aReturn[$i + 1] = GUICtrlCreateLabel("", $aButtons[$i][0], $aButtons[$i][1], $aButtons[$i][2], $aButtons[$i][3])
    Next

    _GDIPlus_PathDispose($hPath)
    _GDIPlus_PathDispose($hPath_Shape)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_BrushDispose($hBrush_Bg)
    _GDIPlus_BrushDispose($hBrush_Shape)
    _GDIPlus_BrushDispose($hBrush_Shadow)
    _GDIPlus_GraphicsDispose($hCtxt)
    Return $aReturn
EndFunc   ;==>_GDIPlus_CreateCurvedTranslucentPanel

Func _WinAPI_BitmapSetTransparent($hGUI, $hImage, $iOpacity = 0xFF)
    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", 1)
    _WinAPI_UpdateLayeredWindow($hGUI, $hMemDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)
    _WinAPI_ReleaseDC(0, $hScrDC)
    _WinAPI_SelectObject($hMemDC, $hOld)
    _WinAPI_DeleteObject($hBitmap)
    _WinAPI_DeleteDC($hMemDC)
EndFunc   ;==>_WinAPI_BitmapSetTransparent

;Code below was generated by: 'File to Base64 String' Code Generator v1.20 Build 2015-09-19

Func _Nok2_24x24png($bSaveBinary = False, $sSavePath = @ScriptDir)
    Local $Nok2_24x24png
    $Nok2_24x24png &= 'iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAACXBIWXMAABzpAAAc6QHh0LjlAAAFfUlEQVRIiYWWX2hbVxLGf+dKWDWKrJRYSuLIJVFCtFuZQLsPtpsGTO04pfQp1JSExSkJCwFTSltvk4fmqQ8l7D40gRKHPnm9mBaVFNqH4KQtBTe4gppiGpOVG0qwLNeSLNfXsixfSefOPpwospP9MzDc0WjON/PNnXvOUSLCNhHxoJQLSCmbjS1PTp5ev3nzeO2rrw6rfD4IINGo7T1xYm5HX9/t1hdeGPfv2ZMCFCIWSumtcGpbAtf1YFm6XCjsT4+NfVB5++2BnX19vuCJE/ieeQaPzweVCrpQwEmlsG/eZDWVcpquXk20nzp1qbm19UEd48kEpnKdSyb/vNDVNbLvtdf84fPnRR044CKi2NxUlMuKchkcR3AcoVgUmZuzcqOjKgOlyPj4+XBn5z/rWI0EDx2Z27eHC/39f/vDtWtuU3+/i9YeWV1VamMDNjfBcczzoUqlgtJa2NzUlelp61+JhLVrYuKv+/r7/17HVK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EcLX2ICKI63pEhIWJieEZECca1RKLVQXcR4ke12hU3KEhkU8+cWVsrOoMDekZkIVbt4a3Yv7nI/PcuZF9s7P+cCgkKhBwqVQUoPD7FQcOQEeHcPiwsGOHyPy8lRsfV5mVlVLk88//y5H5+KGfz+9PJxIfVK5eHdiZSvmCgO/oUTzRKOzejfZ6cRYWsCcmWM3nnaYrVxLtp0//n0O/LluvLUtLseVk8vT6nTvHa5OTh9UPP5hrSyxme/v65nb09t5u7e7+n9eWfwNJOhRLmn3GvAAAAABJRU5ErkJggg=='
    Local $bString = _WinAPI_Base64Decode($Nok2_24x24png)
    If @error Then Return SetError(1, 0, 0)
    $bString = Binary($bString)
    If $bSaveBinary Then
        Local Const $hFile = FileOpen($sSavePath & "\Nok2_24x24.png", 18)
        If @error Then Return SetError(2, 0, $bString)
        FileWrite($hFile, $bString)
        FileClose($hFile)
    EndIf
    Return $bString
EndFunc   ;==>_Nok2_24x24png

Func _Ok2_24x24png($bSaveBinary = False, $sSavePath = @ScriptDir)
    Local $Ok2_24x24png
    $Ok2_24x24png &= 'iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAACXBIWXMAAA2IAAANiAGC02DBAAAGHklEQVRIiXWWW29U1xmGn3XYhzns2TNj7zE2G4cYgkU4qOEkhEqlOKqESgQ0JEpx05tK/QO5afoL0tKEi15UipqmqmiqVmlzE6jqUpckqBHCARKbAEbU5TBgPNux8Yzn4Jl96IW5sFNY3826et5X31r63k/wzeMhCQCIGUKzkd108wIptiEoIQHhVWgEE1QYZZIxPiYEJB4QEK/EicfAE4YQPMcruLyOyU5f+8o1izi2w3zjIZNLFXxtgSSiw8Xy7NIJLgQf8DEJHmKlyEoBBUT8CJ9NvIfmu57yk6LtikI6HxnKYGFxTky35rAgQZiYwlBInRgGor7UPFP+YurHnKSMhyIgWikg8YgZZis9nCah37f90LVd4Vh5ZQiD/87fodypLTsXJggDU2oMQaSxEqWVXqJxZ/LmVwd5nysESCCWeMsXjtDPG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PT5S7yYP0aYhGSMLGudXny3j2KmSErbRFEc36rdlV9Ojv10/nfBleXuZxoTqYHM3ozObJLCCGNiudFay+WlG1y79QWyrfj05jl+fu1X7HS+jaUMepw19OV6yNkuljIxpIGpjHC6NquvVSb+fnnk328w5QnxKMVifkL/4Le2f5oT7lMIFSohdVrZ1OI2Y60v8Y11bE0/Q8Fy6c4USBkZDKExlIGlbSxlhpXFOT0+N3H7b5/88Tv8hjt4yNWB80O2bhncfTqv3H6ZyBAhhSVNZeoUWiiKqQJuysVQBqY0sZSFZdiRSGQS1Of01fmrd8YunzkYnAiusDypY/VIICGD4l/MBMX7f8mV8ttSqewzlrQFKJFAtCbXk7ipPKYyElvZsamtRAktG52WuF0r'
    $Ok2_24x24png &= 'q/EHl86Mnv3wcOOdxk08FI3lD/b40N+P8Pf7r5TWPv16Pl3YacuM6koVyBoZtDIRCDpxh4V2LXqwcP/irdvXTkx9MvkB57wEL3hi6K8UAYjZj/a2ebuLfu8LGcfZZqpUSQlJO2pXqtXqxOS9u6OMB2OcIwRP4gX/t7b8DwlNcnxkhYu3AAAAAElFTkSuQmCC'
    Local $bString = _WinAPI_Base64Decode($Ok2_24x24png)
    If @error Then Return SetError(1, 0, 0)
    $bString = Binary($bString)
    If $bSaveBinary Then
        Local Const $hFile = FileOpen($sSavePath & "\Ok2_24x24.png", 18)
        If @error Then Return SetError(2, 0, $bString)
        FileWrite($hFile, $bString)
        FileClose($hFile)
    EndIf
    Return $bString
EndFunc   ;==>_Ok2_24x24png

Func _WinAPI_Base64Decode($sB64String)
    Local $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "ptr", 0, "dword*", 0, "ptr", 0, "ptr", 0)
    If @error Or Not $aCrypt[0] Then Return SetError(1, 0, "")
    Local $bBuffer = DllStructCreate("byte[" & $aCrypt[5] & "]")
    $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "struct*", $bBuffer, "dword*", $aCrypt[5], "ptr", 0, "ptr", 0)
    If @error Or Not $aCrypt[0] Then Return SetError(2, 0, "")
    Return DllStructGetData($bBuffer, 1)
EndFunc   ;==>_WinAPI_Base64Decode

 


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

Wow! Thanks UEZ. Once again you save the day. I have already completed the project using Adobe AIR and AutoIt, but your code will most certainly come in handy. I'm using TCP to get the applications talking, though I can only make a one way connection, but that's luckily enough. Now I'm struggling with an unfortunate memory leak. To bad I can't post the code so that someone could help me with the project. I'm an educator and the tool is designed to show all my keyboard shourcuts and mouse button combinations, but it does without a doubt a keylogger in nature.

Thanks again for your code.

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

  • Similar Content

    • Skeletor
      By Skeletor
      Hi All,
      I know many newbies search for this feature.
      I decided to share this piece of code with everyone.
      Basically its a "splash screen" that has a transparent image.
      In a nutshell - Gui with a transparent gif.
      Enjoy...
      Download attachment....
       
      Splash Screen GUI.zip
    • 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
    • UEZ
      By UEZ
      Here some graphical examples written completely in FreeBasic just for fun.  
      3D Starfield Scrolling v1 Booster 3D Starfield Scrolling v3 Booster GDI - GDI+ 3D Sinus Wave GDI - GDI+ Animated Pythagoras Tree GDI - GDI+ Particles - Repulsive Force Sim v2.0 GDI - GDI+ Plasma v5 Booster GDI - GDI+ Random Pattern GDI - GDI+ Tunnel Flight - WipeOut Style GDI Classic Raytraced Tunnel GDI Elastic Twister Effect GDI Exploding Pixels GDI Liquid Pixels GDI Particle Repulsion Grid GDI Particles Mouse Attraction GDI Starfield GDI The Nautilus Raymarcher GDI+ Performance Test - Au3 vs FB Mandelbrot Rutt_Etra_Izer_Booster  
      Download: FreeBasic Examples build 2017-01-22.7z
      I will add new examples from time to time.
       
      FreeBasic source codes are also included.