Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
S

Seek51

@Seek51
About
Posts
2
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Send String/Text to a other window [vb.net / API]
    S Seek51

    The problem is, it didn't fail. So i ask, if i use the right api call. Or is there a better way to copy a string to a other textbox on a foreight form/app, then the "SendMessageW" API call?

    .NET (Core and Framework) csharp json

  • Send String/Text to a other window [vb.net / API]
    S Seek51

    Hello, I want to send a message/test to a other windows. It should save me many time in putting me many time strings/textes in MS Project, Outlook, ... ... Therefore i want to use the Windwos API in VB.net. I tried it in this way, but it doesn't work. I get the windows handle, but the text isn't set at notepad or in a other window.

    Private Sub tmr_Worktimer_Tick(sender As Object, e As EventArgs) Handles tmr_Worktimer.Tick
    If IsKeyPressed(Keys.VK_SHIFT) Then
    Dim aPoint As New POINTAPI
    GetCursorPos(aPoint)
    Dim hWnd As IntPtr = WindowFromPoint(aPoint.x, aPoint.y)
    SetForegroundWindow(hWnd)
    SetWindowTextUnicode(hWnd, WM_SETTEXT, IntPtr.Zero, "Test")
    End If
    End Sub

    My API Calls are:

    Public Structure Keys
    Const VK_BACK As Short = &H8 ' Backspace key
    Const VK_TAB As Short = &H9 ' Tab key
    Const VK_RETURN As Short = &HD ' Enter key
    Const VK_SHIFT As Short = &H10 ' Shift key
    Const VK_CONTROL As Short = &H11 ' STRG key
    Const VK_MENU As Short = &H12 ' Alt key
    Const VK_CAPITAL As Short = &H14 ' Caps Lock
    Const VK_ESCAPE As Short = &H1B ' Escape
    Const VK_SPACE As Short = &H20 ' Space
    Const VK_PRIOR As Short = &H21 ' PageUp
    Const VK_NEXT As Short = &H22 ' PageDown
    End Structure

    Public Function GetAsyncKeyState(ByVal vKey As Int32) As Short
    End Function
    

    Public Function IsKeyPressed(ByVal KeyToCheck As Short) As Boolean
    Dim res As Short
    res = GetAsyncKeyState(KeyToCheck)
    If res < 0 Then ' -32768 Then
    IsKeyPressed = True
    Else
    IsKeyPressed = False
    End If
    End Function

    Public Structure POINTAPI
        Dim x As Integer
        Dim y As Integer
    End Structure
    
        
    Public Function GetCursorPos(ByRef lpPoint As POINTAPI) As  Boolean
    End Function
    
        
    Public Function WindowFromPoint(xPoint As Integer, yPoint As Integer) As IntPtr
    End Function
    
        
    Public Function SetForegroundWindow(hWnd As IntPtr) As Boolean
    End Fun
    
    .NET (Core and Framework) csharp json
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups