Results 1 to 2 of 2

Thread: VB.NET To C++

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    340

    VB.NET To C++

    I have some VB.NET codes that I want to try as a native language (C++). I know there's no converter, because of the .NET framework codes, but I was hoping someone that knows both VB.NET and C++ could take a look at it and convert it for me. It's only about 10 lines of code, not including API. Here it is:

    Code:
    Dim hDC As IntPtr
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
        Private Declare Function GetDC Lib "user32" (ByVal hWnd As IntPtr) As IntPtr
        Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As IntPtr, ByVal X As Int32, ByVal Y As Int32) As Int32 Public Declare Function SleepEx Lib "kernel32" Alias "SleepEx" (ByVal dwMilliseconds As Integer, ByVal bAlertable As Boolean) As Integer
    Code:
     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            SendKeys.Flush()
            Dim hWnd As IntPtr = FindWindow(vbNullString, "Untitled - Notepad")
            hDC = GetDC(hWnd)
            Activate_Notepad()
            Threading.Thread.Sleep(1000)
    
            Do
                If GetPixel(hDC, 379, 174) = 13693949 Then
                    SleepEx(TextBox1.Text, False)
                    SendKeys.SendWait("{W}")
                    Exit Do
                End If
            Loop
        End Sub
    Code:
    Private Sub Activate_Notepad()
            For Each Process As Process In Process.GetProcesses
                If Process.MainWindowTitle = "Untitled - Notepad" Then
                    AppActivate(Process.Id)
                    Exit For
                End If
            Next
        End Sub
    Thank you!

    Also, could you pre-compile it as an exe for me?

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    340

    Re: VB.NET To C++

    Anyone?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width