Jump to content
Sign in to follow this  
erto

From VB.NET To Autoit

Recommended Posts

erto

Hi everyone, first post here :D

Hope someone can give me an hand to convert this script to autoit, i'm not a VB.NET expert, or better i'm totally noob :D

Declare Function GetDesktopWindow Lib "user32" () As Long
Declare Function UpdateWindow Lib "user32" Alias "UpdateWindow" (ByVal hwnd As Long) As Long
Declare Function GetWindowDC Lib "user32" (ByVal hwnd As IntPtr) As IntPtr
<Runtime.InteropServices.DllImport("user32.dll", CharSet:=Runtime.InteropServices.CharSet.Auto)> _
Private Shared Function GetClientRect(ByVal hWnd As System.IntPtr, _
   ByRef lpRECT As RECT) As Integer
  ' Leave function empty
End Function
Public Declare Function DrawText Lib "user32" Alias "DrawTextA" (ByVal hdc As Long, ByVal lpStr As String, ByVal nCount As Long, ByVal lpRect As RECT, ByVal wFormat As Long) As Long
Declare Function ReleaseDC Lib "user32.dll" _
   (ByVal hWnd As IntPtr, ByVal hDC As IntPtr) As Integer
Structure RECT
  Dim Left As Long
  Dim Top As Long
  Dim Right As Long
  Dim Bottom As Long
End Structure
Private Shared layhWnd As System.IntPtr
Private Shared layhdc As System.IntPtr
Private Shared layrect As New RECT
Private Shared Sub DrawOverlay(ByVal OverlayString As String)
Dim Processes = Process.GetProcessesByName("InsertNameHere")
Dim deviceContext As Graphics = Graphics.FromHwnd(Processes(0).MainWindowHandle)
Dim drawFont As New Font("Arial", 14, FontStyle.Bold)
Dim myBrush As New Drawing2D.LinearGradientBrush(deviceContext.ClipBounds, Color.Black, Color.SkyBlue, Drawing2D.LinearGradientMode.Horizontal)
Dim drawFormat As New StringFormat()
drawFormat.FormatFlags = StringFormatFlags.NoFontFallback
deviceContext.DrawString(OverlayString, drawFont, myBrush, 100, 100, drawFormat)
End Sub

Thanks

Share this post


Link to post
Share on other sites
water

Welcome to AutoIt and the forum!

Can you give us some more information? What does the code to? Why do you want to translate it to AutoIt? What have you tried so far?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
erto

Hi and thanks

That code interfaces with Direct3D applications that use a exclusive mode feature. I have read the rules, i'm not break any rules because it's not related to bot, games automation etc

That code use DrawTextA in user32.dll for interfaces with Direct3D applications

I want to traslate in autoit because i can't manage the VB.NET code, but i don't have a good knowledge for make this by myself

Edited by erto

Share this post


Link to post
Share on other sites
water

But if you can't manage the VB code and don't know enough about AutoIt how do you want to manage the translated AutoIt function?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Myicq

Without being an expert on VB.NET it seems like the function draws a text as graphics.

I would say you are jumping into deep water without getting feet wet first. But hey, even difficult topics will learn you something.

You can study using DLLs with AutoIT, there are tutorials around.

Or make a shortcut, and call other tools like f.ex ImageMagick if the desired output is graphics in someway.

Perhaps give more details on application and use ?


I am just a hobby programmer, and nothing great to publish right now.

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  

×