Sign in to follow this  
Followers 0
goss34

RDP Session In AutoIT Gui

13 posts in this topic

Hi Guys,

I have been scouring the forums but cant find what i want so i am hoping someone can help me out by pointing me in the right direction or starting me off with how to build the script from scratch.

What i want to be able to achieve is:

  • Have the script hunt for a machine that is available from a group of say 4 (how it will know its available i dont know?)
  • When a free machine is found launch an RDP session within the autoit window (scaling the window to fit in the GUI)
First off is this possible?

Second, can someone help me get started?

Thanks

Dan

Share this post


Link to post
Share on other sites



Can anyone help with this? :graduated:

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Try this uncomplete version:

#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
 
$host = "" ;<<<<<<< enter here the host name or ip address
;Remote Desktop ActiveX Control Interfaces -> http://msdn.microsoft.com/en-us/library/aa383022(v=VS.85).aspx
$hGUI = GUICreate("RDP Embedded Sessions", 952, 675, -1, -1, $WS_OVERLAPPEDWINDOW + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN)
$oRDP = ObjCreate("MsTscAx.MsTscAx.2") ;http://msdn.microsoft.com/en-us/library/aa381344(v=VS.85).aspx
$oRDP_Ctrl = GUICtrlCreateObj($oRDP, 64, 44, 800, 600)
GUICtrlSetResizing(-1, $GUI_DOCKALL)
GUICtrlSetStyle($oRDP_Ctrl , $WS_VISIBLE)
$oRDP.DesktopWidth = 800
$oRDP.DesktopHeight = 600
$oRDP.Fullscreen = False
$oRDP.ColorDepth = 16
$oRDP.AdvancedSettings3.SmartSizing = True
$oRDP.Server = $host
$oRDP.UserName = "" ;<<<<<<< enter here the user name
$oRDP.Domain = ""
$oRDP.AdvancedSettings2.ClearTextPassword = ""
$oRDP.ConnectingText = "Connecting to " & $host
$oRDP.DisconnectedText = "Disconnected from " & $host
$oRDP.StartConnected = True
$oRDP.Connect()
 
GUISetState(@SW_SHOW, $hGUI)
;~ ConsoleWrite($oRDP.GetErrorDescription() & @CRLF)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            $oRDP.Disconnect()
            Exit
    EndSwitch
WEnd

It will open a RDP session embedded in the GUI.

Br,

UEZ

Edited by UEZ
3 people like this

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

#4 ·  Posted (edited)

Thanks UEZ.

Exactly the one I'm searching for. The above script works as expected. But it only runs when I run this script from SciTE4AutoIt3 editor.

After I build this script as exe, that exe fails to connect that system. It just hangs and displays a message 'Connecting to 172.16.0.160'. I didn't modify this script expect the following lines.

$host = "172.16.0.160"

$oRDP.UserName = "administrator"

Exe should be perfectly same as the script. I'm just wondering how it works like a charm when I run from the editor but the exe hangs to connect.

Any Help is appreciated. If you need any more information to help me please let me know.

Thanks in advance for your help.

post-67499-0-51208500-1334415181_thumb.j

Edited by pilot

Share this post


Link to post
Share on other sites

Thankd UEZ

I've added some change to the original.

you need to create an ini file RDP_QC.ini in the same location as the au3 or exe file.

[serveurs]

Server1 = Server1

Server2 = Server2

Server3 = Server3

enjoy !

#include <GUIConstants.au3>

#include <GUIConstantsEx.au3>

#include <WinAPI.au3>

#include <WindowsConstants.au3>

#include <EditConstants.au3>

Opt("GUIOnEventMode", 1)

#Region ### START Koda GUI section ### Form=

$hGUI = GUICreate("Form1", 1401, 801, 193, 115)

GUISetOnEvent($GUI_EVENT_CLOSE, "hGUIClose")

$Connect = GUICtrlCreateButton("Connect", 1272, 16, 115, 33, 0)

GUICtrlSetOnEvent(-1, "ConnectClick")

$Password = GUICtrlCreateInput("", 1272, 200, 115, 23, $ES_PASSWORD)

GUICtrlSetOnEvent(-1, "ConnectClick")

$oRDP = ObjCreate("MsTscAx.MsTscAx.2") ;http://msdn.microsoft.com/en-us/library/aa381344(v=VS.85).aspx

$oRDP_Ctrl = GUICtrlCreateObj($oRDP, 4, 4, 1232, 792)

GUICtrlSetResizing(-1, $GUI_DOCKALL)

GUICtrlSetStyle($oRDP_Ctrl , $WS_VISIBLE)

GUICtrlSetStyle($oRDP_Ctrl , $WS_EX_STATICEDGE)

$oRDP.DesktopWidth = 1240

$oRDP.DesktopHeight = 800

$oRDP.Fullscreen = False

$oRDP.ColorDepth = 16

$oRDP.AdvancedSettings3.SmartSizing = True

$serveur = GUICtrlCreateCombo("", 1272, 50, 120, 23)

GUICtrlSetData(-1, "", "")

GUICtrlSetFont(-1, 9, 800, 0, "Courier new")

GUICtrlSetOnEvent(-1, "ConnectClick")

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

Call("Load_srv")

While 1

Sleep(100)

WEnd

Func ConnectClick()

$host = GUICtrlRead($serveur,1) ;<<<<<<< enter here the host name or ip address

if $host <> "" Then

$oRDP.Server = $host

$oRDP.UserName = "" ;<<<<<<< enter here the user name

$oRDP.Domain = ""

$oRDP.AdvancedSettings2.ClearTextPassword = GUICtrlRead($Password)

$oRDP.ConnectingText = "Connecting to " & $host

$oRDP.DisconnectedText = "Disconnected from " & $host

$oRDP.StartConnected = True

$oRDP.connect()

endIf

EndFunc

func Load_srv()

$var = IniReadSection(@ScriptDir & "\RDP_QC.ini","Serveurs")

For $i = 1 To $var[0][0]

;~ MsgBox(4096, "", "Key: " & $var[$i][0] & @CRLF & "Value: " & $var[$i][1])

GUICtrlSetData($serveur,$var[$i][1])

Next

endFunc

Func hGUIClose()

exit

EndFunc

Share this post


Link to post
Share on other sites

Hi referring to the above scripts plss guide me how to execute tasks on the remote system for e.g. taking a basic task as running calc.exe...it would be of grrt help :rambo:

Share this post


Link to post
Share on other sites

Please don't resurrect old threads, especially when you just want to learn something that can be found via the help file. My suggestion, read the help file as this will be a great source of help.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

sorry : but i have timing constraint...i just wanted to have minimum guidance o:)

Edited by ravi88

Share this post


Link to post
Share on other sites

I can give you guidance, what I can't do is speed up the process of you learning it. The help file is a great place to start, trust me. If you have little time, then perhaps an alternative source would be an option?


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#10 ·  Posted

thnx :pirate:

Share this post


Link to post
Share on other sites

#11 ·  Posted

You're welcome. Good luck.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Hi everybody,

I need to resize the "Rdp embedded sessions" in order to resize $oRDP in the same size without borders

Anybody can help me ?

Thanks

I have the following code :

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

$host = "" ;<<<<<<< enter here the host name or ip address

$hGUI = GUICreate("Terminal server", 900, 700, -1, -1, BitOR($GUI_SS_DEFAULT_GUI,$WS_SIZEBOX,$WS_THICKFRAME))

$oRDP = ObjCreate("MsTscAx.MsTscAx.2")
$oRDP_Ctrl = GUICtrlCreateObj($oRDP, 0, 0, 900, 700)

GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlSetStyle($oRDP_Ctrl , $WS_VISIBLE)

s$oRDP.DesktopWidth = 900
$oRDP.DesktopHeight = 700
$oRDP.Fullscreen = False
$oRDP.ColorDepth = 16
$oRDP.AdvancedSettings3.SmartSizing = True
$oRDP.Server = $host
$oRDP.UserName = "" ;<<<<<<< enter here the user name
$oRDP.Domain = ""
$oRDP.AdvancedSettings2.ClearTextPassword = ""
$oRDP.ConnectingText = "Connecting to " & $host
$oRDP.DisconnectedText = "Disconnected from " & $host
$oRDP.StartConnected = True
$oRDP.Connect()

GUISetState(@SW_SHOW, $hGUI)

$oShel = ObjCreate("shell.application")
$oShel_Ctrl = GUICtrlCreateObj($oShel, 0, 0, 900, 700)
GUICtrlSetStyle($oShel_Ctrl , $WS_VISIBLE)



Send("#r")
Send ("C:\Program Files (x86)\scripts\PSTools\******.bat")
Send("{ENTER}")

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            $oRDP.Disconnect()
            Exit
    EndSwitch
WEnd
Edited by Benchozer

Share this post


Link to post
Share on other sites

#13 ·  Posted

Benchozer, did you not see above where people were instructed to start a new thread, rather than resurrecting an old one?? The language has changed a lot since this thread began; what worked then might not be the same now. If you want assistance with your issue, start a new thread and explain in detail what you're trying to do, and what problems you're encountering.


When you're dead, you don't know you're dead - it's only difficult for those that know you. It's the same way when you're stupid...

My Scripts: SCCM UDFInclude Source with Compiled Script, Windows Firewall UDF

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
Sign in to follow this  
Followers 0

  • Similar Content

    • PINTO1927
      png with background transparent into gui without border
      By PINTO1927
      Hi guys, I would like to make a gui borderless viewing a png image with transparent background.
       
      pretty much has to be visible only the png image with no background..you have any simple example?
      Thank's
      GUICtrlCreatePic  
      still it provides the image with the background...
    • OldGuyWalking
      Identifying Button in Toolbar When There is no ControID
      By OldGuyWalking
      I want to click on a button that is inside a custom ToolBar on a nonAutoIT created form.  I've been using MouseClick but that fails if the toolbar is detached or if the form is resized.
      There is no ID associated with the toolbar but there is a handle.  I'm thinking that to get the handle I need a ControlID but that only gets me to the toolbar and I'd then need to have a way to identify the position of a button in order to click on it.  
      I'd found a discussion about identifying the position of a noname button by, I believe, it's Tip text back in December but I can't find it now.  Memory is a bit fuzzy on how I even got to the topic because at the time I was searching for something else.   I'll continue to search but if anyone has seen the topic, or knows of another solution could you please point me in that direction. 
      Thank you.
    • rootx
      Best way to play little video inside a Gui
      By rootx
      I would like to insert a video player inside the gui Autoit, preferably one with a free license such as Media Player Classic or VLC, I saw in the forum but I found examples of many years ago.
      Some examples links or advice would be much help
    • passwd
      Two images in one GUI control with ability to move image
      By passwd
      Hello. I'm trying to make a form with two pictures and one button. But pictures must overlap one another. First picture I'm getting from screenshot of another window, but second picture must be with alfa channel and positioning on that first image.
      Something like that:
      #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <ScreenCapture.au3> Global Const $AC_SRC_ALPHA = 1 $Form1_1 = GUICreate("Document", 701, 671, -1, -1) GUISetBkColor(0xFFFFFF) $Pic1 = GUICtrlCreatePic("", 8, 8, 409, 657) $Button1 = GUICtrlCreateButton("Take Picture", 424, 8, 161, 33) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Generate() EndSwitch WEnd Func Generate() Local $hBMP, $hBitmap, $hGraphic, $WindowToCapture WinActivate("Notepad") $WindowToCapture = ControlGetHandle("Notepad", "", "[CLASS:Edit; INSTANCE:1]") $hBMP = _ScreenCapture_CaptureWnd ( '', $WindowToCapture,4,4,400,470,False) ; Initialize GDI+ library _GDIPlus_Startup() $PicHandle = GUICtrlGetHandle($Pic1) $myGuiHandle = ControlGetHandle("Document", "", $PicHandle) $TransparentButtonTest = GUICreate("", 0, 0, 390, 130, $WS_EX_MDICHILD, $WS_EX_LAYERED, $myGuiHandle) $hImageButton = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\2-f.png") SetBitMap($TransparentButtonTest, $hImageButton, 255) GUISetState() WinActivate("Document") ; Draw bitmap to GUI $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBMP) $hGraphic = _GDIPlus_GraphicsCreateFromHWND(GUICtrlGetHandle($Pic1)) _GDIPlus_GraphicsDrawImage($hGraphic, $hBitmap, 0, 100) ; Clean up resources _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_BitmapDispose($hBitmap) _WinAPI_DeleteObject($hBMP) ; Shut down GDI+ library _GDIPlus_Shutdown() 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 ;==>SetBitmap But the most interesting, that I need to move second picture(png FromFile) by draging it with mouse ontop of first image.
      Can you tell me what I have done wrong and maybe there is some easier ways to do this?
    • Wicked_Caty
      No carriage return in label
      By Wicked_Caty
      My program generates a huge lot of numbers that has to be displayed in a label. Usually there are around 100 thousand and 1 million numbers, so I obviously have certain problems with space. I get the data into the label, but it's all in one line and simply exceeds the label (by a couple of million pixels, but never mind that)... Of course it won't fit into a 200x200 big label either, but it'd look a lot nicer. I don't even need to scroll in it.
      The only thing in need is an automatic @CRLF at the border of the label.
      Something like the style $ES_MULTILINE for the input box.
      Here's the most important stuff from the GUI.
      Local $gui = GUICreate("Crypt", 630, 440) Local $in = GUICtrlCreateInput("", 10, 10, 300, 300, $ES_MULTILINE) ; need something like $ES_MULTILINE just one line later in this code Local $out = GUICtrlCreateLabel("", 320, 10, 300, 300) ; instead of "", please imagine a random number between 1e5 and 1e6 here please ; a lot of buttons that don't matter right now GUISetBkColor(0x111111, $gui) GUICtrlSetBkColor($in, 0xEEEEEE) GUICtrlSetBkColor($out, 0xEEEEEE) ; again a lot of button configuartion that's completely unnecessary right now GUICtrlSetColor($in, 0x111111) GUICtrlSetColor($out, 0x111111) ; same as before GUISetFont(13, 200, 0, "Candara", $gui) GUICtrlSetFont($in, 13, 200, 0, "Candara") GUICtrlSetFont($out, 13, 200, 0, "Candara") ; still configuation for the buttons Local $data0 = "" ; some unimportant variables GUISetState(@SW_SHOW, $gui) ; switch from GUIGetMsg() in an infinite while-loop Thanks!