SendMessage WM_GETTEXT/WM_LBUTTONDOWN

Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
23 posts Page 2 of 3
Contributors
User avatar
M1z23R
VIP - Donator
VIP - Donator
Posts: 622
Joined: Tue Sep 28, 2010 4:55 pm

but those controls can still be clicked and stuff, so idk :/ Can i use this childwindows or what it is called to gettext ?
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

If you know the name of the window that you are trying to find you can use the FindWindow function.
Last edited by mandai on Mon Jul 30, 2012 11:59 pm, edited 1 time in total.
User avatar
MrAksel
C# Coder
C# Coder
Posts: 1758
Joined: Fri Mar 26, 2010 12:27 pm

M1z23R wrote:
but those controls can still be clicked and stuff, so idk :/ Can i use this childwindows or what it is called to gettext ?
What I meant is that some application does not have controls, but it simply draws them on the screen as a image and when the form is clicked it checks if the 'click-point' was within the bounds of that image.
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;


Over 30 projects with source code!
Please give reputation to helpful members!

Image
Image
User avatar
M1z23R
VIP - Donator
VIP - Donator
Posts: 622
Joined: Tue Sep 28, 2010 4:55 pm

Mandai and MrAksel thank you both for code/help. Just one thing in mandai's code, or i did something wrong, still testing it out, when i try to List some window, i get this, and can't get passed through it :/
A QueryInterface call was made requesting the class interface of COM visible managed class 'MS.Internal.AutomationProxies.NonClientArea'. However since this class derives from non COM visible class 'MS.Internal.AutomationProxies.ProxyHwnd', the QueryInterface call will fail. This is done to prevent the non COM visible base class from being constrained by the COM versioning rules.
User avatar
M1z23R
VIP - Donator
VIP - Donator
Posts: 622
Joined: Tue Sep 28, 2010 4:55 pm

MrAksel wrote:
M1z23R wrote:
but those controls can still be clicked and stuff, so idk :/ Can i use this childwindows or what it is called to gettext ?
What I meant is that some application does not have controls, but it simply draws them on the screen as a image and when the form is clicked it checks if the 'click-point' was within the bounds of that image.
how would you perform click, or double click on specific x/y on minimized window ?
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Do you get that exception if you test it with a different window?

If you are looking to send a double click or click at a set X/Y on a control then you will need to use different code.
The controls that support double click events do not have to be marked as invoke-capable.
Code: Select all
    <DllImport("user32.dll")> Shared Function SendMessage(ByVal hWnd As IntPtr, ByVal Msg As UInteger, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr
    End Function

    Const WM_LBUTTONDBLCLK As UInteger = &H203
    Const WM_LBUTTONUP As UInteger = &H202

    Private Sub btnInvoke2_Click(sender As System.Object, e As System.EventArgs) Handles btnInvoke2.Click

        If ListBox1.SelectedIndex > -1 Then

            Dim x As Short = 30
            Dim y As Short = 40

            Dim xBytes As Byte() = BitConverter.GetBytes(x)
            Dim yBytes As Byte() = BitConverter.GetBytes(y)
            Dim xyBytes As Byte() = {xBytes(0), xBytes(1), yBytes(0), yBytes(1)}

            Dim xy As UInteger = BitConverter.ToUInt32(xyBytes, 0)

            Dim hwnd As IntPtr = usableControls(ListBox1.SelectedIndex).Current.NativeWindowHandle

            SendMessage(hwnd, WM_LBUTTONDBLCLK, IntPtr.Zero, New IntPtr(xy))
            SendMessage(hwnd, WM_LBUTTONUP, IntPtr.Zero, New IntPtr(xy))

        End If
    End Sub
User avatar
M1z23R
VIP - Donator
VIP - Donator
Posts: 622
Joined: Tue Sep 28, 2010 4:55 pm

On some applications, it returns error, on some don't. But any way, the thing i want to make is make a program that performs double click on minimized program, on specific coordinates, it is a listview filled with items, and on double click you 'try to enter a room'. And if room is full, try again after 5,0001 secs with double clik. So i think i don't really have to return usable controls as i thought.
User avatar
MrAksel
C# Coder
C# Coder
Posts: 1758
Joined: Fri Mar 26, 2010 12:27 pm

This includes double click and a few other options
You do not have the required permissions to view the files attached to this post.
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;


Over 30 projects with source code!
Please give reputation to helpful members!

Image
Image
User avatar
M1z23R
VIP - Donator
VIP - Donator
Posts: 622
Joined: Tue Sep 28, 2010 4:55 pm

I don't want to send click on a control or what ever, i'll explain this as simple as possible.
Detect double click on application, register mouse x/y coordinates in that moment. And every 5secs automatically do the same i did - double click on x/y on the form. Form's state is minimized, that is my problem. :/
User avatar
MrAksel
C# Coder
C# Coder
Posts: 1758
Joined: Fri Mar 26, 2010 12:27 pm

My application should work on minimized apps too. But i get what you mean.
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;


Over 30 projects with source code!
Please give reputation to helpful members!

Image
Image
23 posts Page 2 of 3
Return to “Tutorial Requests”