Click here to Skip to main content
15,850,214 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
PinnedHOW TO ANSWER A QUESTION Pin
Chris Maunder16-Jul-09 4:09
cofounderChris Maunder16-Jul-09 4:09 
PinnedHow to get an answer to your question Pin
Chris Maunder16-Jul-09 4:05
cofounderChris Maunder16-Jul-09 4:05 
QuestionAdvice on a product to convert PDF to TIFF or JPEG. Pin
PhilMcGahan9hrs 36mins ago
PhilMcGahan9hrs 36mins ago 
QuestionC#, WPF project Pin
Member 1621198528-Feb-24 3:50
Member 1621198528-Feb-24 3:50 
AnswerRe: C#, WPF project Pin
Richard Deeming28-Feb-24 4:22
mveRichard Deeming28-Feb-24 4:22 
AnswerRe: C#, WPF project Pin
Gerry Schmitz28-Feb-24 8:04
mveGerry Schmitz28-Feb-24 8:04 
AnswerRe: C#, WPF project Pin
jschell28-Feb-24 13:22
jschell28-Feb-24 13:22 
RantForm Cancel Property paired up with Button DialogResult Property is Diabolical! Pin
Brian L Hughes27-Feb-24 18:04
Brian L Hughes27-Feb-24 18:04 
QuestionGantt chart for management app c# Windows Forms Pin
Ionut Ciocan20-Feb-24 13:17
Ionut Ciocan20-Feb-24 13:17 
AnswerRe: Gantt chart for management app c# Windows Forms Pin
jeron120-Feb-24 13:33
jeron120-Feb-24 13:33 
QuestionVisual Studio 2022 and Angular Language Service Pin
Z.C.M.8-Feb-24 12:19
professionalZ.C.M.8-Feb-24 12:19 
AnswerRe: Visual Studio 2022 and Angular Language Service Pin
Gerry Schmitz9-Feb-24 10:58
mveGerry Schmitz9-Feb-24 10:58 
GeneralRe: Visual Studio 2022 and Angular Language Service Pin
jschell9-Feb-24 13:08
jschell9-Feb-24 13:08 
GeneralRe: Visual Studio 2022 and Angular Language Service Pin
Gerry Schmitz10-Feb-24 10:34
mveGerry Schmitz10-Feb-24 10:34 
GeneralRe: Visual Studio 2022 and Angular Language Service Pin
Z.C.M.12-Feb-24 4:30
professionalZ.C.M.12-Feb-24 4:30 
GeneralRe: Visual Studio 2022 and Angular Language Service Pin
Gerry Schmitz12-Feb-24 8:51
mveGerry Schmitz12-Feb-24 8:51 
QuestionHow to refer to the AspNetUser table(which is the default table created upon using AspNetCore.Identity;) in my Job Table in .NET Core 6 Pin
Member 139757394-Feb-24 5:53
Member 139757394-Feb-24 5:53 
AnswerRe: How to refer to the AspNetUser table(which is the default table created upon using AspNetCore.Identity;) in my Job Table in .NET Core 6 Pin
Richard Deeming5-Feb-24 0:03
mveRichard Deeming5-Feb-24 0:03 
QuestionNeed to publish? Pin
Richard Andrew x644-Feb-24 4:05
professionalRichard Andrew x644-Feb-24 4:05 
AnswerRe: Need to publish? Pin
Dave Kreskowiak4-Feb-24 8:44
mveDave Kreskowiak4-Feb-24 8:44 
GeneralRe: Need to publish? Pin
Richard Andrew x644-Feb-24 13:32
professionalRichard Andrew x644-Feb-24 13:32 
QuestionCan anyone recommend a tool to... Pin
Richard Andrew x643-Feb-24 15:42
professionalRichard Andrew x643-Feb-24 15:42 
AnswerRe: Can anyone recommend a tool to... Pin
Gerry Schmitz3-Feb-24 16:26
mveGerry Schmitz3-Feb-24 16:26 
GeneralRe: Can anyone recommend a tool to... Pin
Richard Andrew x644-Feb-24 4:04
professionalRichard Andrew x644-Feb-24 4:04 
QuestionSend String/Text to a other window [vb.net / API] Pin
Seek514-Dec-23 22:01
Seek514-Dec-23 22:01 
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.



BASIC
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:
BASIC
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

 <DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)>
    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
	
	    <System.Runtime.InteropServices.StructLayout(Runtime.InteropServices.LayoutKind.Sequential)>
    Public Structure POINTAPI
        Dim x As Integer
        Dim y As Integer
    End Structure
	
	    <DllImport("user32.dll", ExactSpelling:=True, SetLastError:=True)>
    Public Function GetCursorPos(ByRef lpPoint As POINTAPI) As <MarshalAs(UnmanagedType.Bool)> Boolean
    End Function
	
	    <DllImport("user32.dll")>
    Public Function WindowFromPoint(xPoint As Integer, yPoint As Integer) As IntPtr
    End Function
	
	    <DllImport("user32.dll")>
    Public Function SetForegroundWindow(hWnd As IntPtr) As Boolean
    End Function
	
	    Friend Const WM_SETTEXT As Integer = 12

    <DllImport("user32.dll", EntryPoint:="SendMessageW", CharSet:=CharSet.Unicode)>
    Public Function SetWindowTextUnicode(ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As IntPtr, ByVal lParam As String) As IntPtr
    End Function



Any ideas? Is there a other way to send the string/text?

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.