Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Handle help? [Delphi]

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
blqxxxxxxx
Cheater
Reputation: 0

Joined: 25 Aug 2009
Posts: 37

PostPosted: Thu Jan 05, 2012 1:34 pm    Post subject: Handle help? [Delphi] Reply with quote

Hello!
I need some help to get a handle. I want to get Skype send message button handle.

I used Spy++ but i didnt have any success.
TChatEntryControlinclude send message button and richviewedit but when I expand the branch I see only TRichViewedit.

Code:
global vars
hwnd,hwnd2 :thandle;
...
hwnd := findwindow('TskMultiChatForm.UnicodeClass',nil);
hwnd2 := findwindowex(hwnd,0,'TChatBackground',nil);
hwnd2 := findwindowex(hwnd2,0,'TPanel',nil);
hwnd2 := findwindowex(hwnd2,0,'TMeControl',nil);
hwnd2 := findwindowex(hwnd2,0,'TChatEntryControl',nil);

_________________
Back to top
View user's profile Send private message
callmenuge
Cheater
Reputation: 0

Joined: 12 Feb 2011
Posts: 42

PostPosted: Fri Jan 06, 2012 2:45 am    Post subject: Reply with quote

There was this nifty FindWindow tool but I can't quite remember the name of it. It had the icon of crosshairs and to use it all you had to do was run the cursor over the button, window, etc.

Edit:

Here's one that is very similar to it: http://www.codeproject.com/KB/dialog/FindWindow.aspx
Back to top
View user's profile Send private message
blqxxxxxxx
Cheater
Reputation: 0

Joined: 25 Aug 2009
Posts: 37

PostPosted: Fri Jan 06, 2012 2:57 am    Post subject: Reply with quote

I used the same tool. In Spy++ have the same tool.
This picture is a result of the useage of this tool

_________________
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Wed Jan 11, 2012 1:05 pm    Post subject: Reply with quote

Is there any reason you need the handle to the control? You can send the current data inside the edit control by sending a WM_KEYDOWN event with RETURN as the key like:

Code:

   // Find main chat window..
   HWND hWndMain = FindWindow( NULL, L"Echo / Sound Test Service" );
   if ( hWndMain == NULL ) return 0;

   // Find the chat entry control..
   HWND hWndChat = FindWindowEx( hWndMain, NULL, L"TChatEntryControl", NULL );
   if ( hWndChat == NULL ) return 0;

   // Find the chat entry control..
   HWND hWndEdit = FindWindowEx( hWndChat, NULL, L"TChatRichEdit", NULL );
   if ( hWndEdit == NULL ) return 0;

   PostMessage( hWndEdit, WM_KEYDOWN, (WPARAM)VK_RETURN, (LPARAM)0 );


I couldn't find the button either possibly it isn't an actual control and it is something manually drawn and handled with a hit-test based on the window sizes. But this is how I could automatically send messages without focus:

Code:

#include <Windows.h>
#include <iostream>

void MySendMessage( HWND hWndControl, const wchar_t* lpMessage )
{
   int nStringLength = wcslen( lpMessage );
   for( int x = 0; x < nStringLength; x++ )
   {
      wchar_t wszCurrChar = lpMessage[x];
      PostMessage( hWndControl, WM_CHAR, (WPARAM)wszCurrChar, (LPARAM)0 );
   }
   PostMessage( hWndControl, WM_KEYDOWN, (WPARAM)VK_RETURN, (LPARAM)0 );
}

int main( int argc, char* argv[] )
{
   // Find main chat window..
   HWND hWndMain = FindWindow( NULL, L"Echo / Sound Test Service" );
   if ( hWndMain == NULL ) return 0;

   // Find the chat entry control..
   HWND hWndChat = FindWindowEx( hWndMain, NULL, L"TChatEntryControl", NULL );
   if ( hWndChat == NULL ) return 0;

   // Find the chat entry control..
   HWND hWndEdit = FindWindowEx( hWndChat, NULL, L"TChatRichEdit", NULL );
   if ( hWndEdit == NULL ) return 0;

   MySendMessage( hWndEdit, L"This is a test message. :)" );

   return 0;
}

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
blqxxxxxxx
Cheater
Reputation: 0

Joined: 25 Aug 2009
Posts: 37

PostPosted: Thu Jan 12, 2012 11:25 am    Post subject: Reply with quote

Thank you for the replay Wiccaan! I am writing a program and I need the handle to simulate clicks. That's why i need the send msg button handle. Do you think is it possible to get it?
_________________
Back to top
View user's profile Send private message
Unbr0ken
Advanced Cheater
Reputation: 2

Joined: 10 Aug 2011
Posts: 67

PostPosted: Fri Jan 13, 2012 1:16 am    Post subject: Reply with quote

blqxxxxxxx wrote:
Thank you for the replay Wiccaan! I am writing a program and I need the handle to simulate clicks. That's why i need the send msg button handle. Do you think is it possible to get it?


I would recommend that, with the use of GetWindowRect() and FindWindow(), you get the screen location of the text box or some other control and then add a number to approximate the position of the send button.

Once this is done, simulate the click...

I don't know if it's the most orthodox way, but that's what I can think of now.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites