Jump to content

From VB.NET To Autoit


erto
 Share

Recommended Posts

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

Link to comment
Share on other sites

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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.

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