BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Delphi program to interact with other application

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> comp.lang.pascal.delphi.misc
View previous topic :: View next topic  
Author Message
Shiva MahaDeva
Guest





PostPosted: Thu Feb 26, 2004 4:00 pm    Post subject: Delphi program to interact with other application Reply with quote



I'm looking for a Delphi program to send data to another application
(simulating control_c control_v).
Thankx.
Back to top
J French
Guest





PostPosted: Thu Feb 26, 2004 4:02 pm    Post subject: Re: Delphi program to interact with other application Reply with quote



On 26 Feb 2004 08:00:12 -0800, [email]contracer11 (AT) uol (DOT) com.br[/email] (Shiva MahaDeva)
wrote:

Quote:
I'm looking for a Delphi program to send data to another application
(simulating control_c control_v).
Thankx.

RegisterWindowMessage ?

Back to top
IByte
Guest





PostPosted: Thu Feb 26, 2004 8:04 pm    Post subject: Re: Delphi program to interact with other application Reply with quote



Shiva MahaDeva wrote:
Quote:
I'm looking for a Delphi program to send data to another application
(simulating control_c control_v).
Thankx.

Try looking for a file called SndKey32.pas on your Delphi CD. It
contains a function to simulate keypresses (SendKeys) like Control+C /
Control+V and to switch to the desired windows (AppActivate, but you
might also want to look into the SetWindowPos Win API function).
I use it in one of my own utilities, something a bit like Windows's
Character Map.

Regards,
IByte


Back to top
Rushikesh Joshi
Guest





PostPosted: Fri Feb 27, 2004 6:30 am    Post subject: Re: Delphi program to interact with other application Reply with quote

[email]contracer11 (AT) uol (DOT) com.br[/email] (Shiva MahaDeva) wrote in message news:<ddf392ea.0402260800.789bc28 (AT) posting (DOT) google.com>...
Quote:
I'm looking for a Delphi program to send data to another application
(simulating control_c control_v).
Thankx.

I am not know more about Delphi Code. But I have did same in one of my
task.
You can able to know the handle of the destination window on which you
want to raise the Ctrl + C & Ctrl + V keyboard events.

If you know VB Or VC, you also can do same as I have. code is as
follows ...


''VB Code
''Make a new project and in form module copy past following code
Option Explicit

'Api Declaration to Get Process ID of running Apps from handle of that
Window
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal
hwnd As Long, lpdwProcessId As Long) As Long

Private Function RaiseKeyboardEvent(DestWinHandle as long) as Long
Dim PID As Long, rt As Long

rt = GetWindowThreadProcessId(DestWinHandle, PID)

If rt <> 0 Then
''This will active your destination window
Call AppActivate(PID)
DoEvents
''This will raise Keyboard Ctrl + C event
''On more helo goto MSDN and look for SendKeys function opr method
Call SendKeys("^(C)")
Call SendKeys("^(V)")
End If

End Function

''Now pass your destination windows handle (Long value only) to
RaiseKeyboardEvent function to get your result

I definately sure it works or make some help for you.

Hey, would you help me as u are know delphi programming.

I have a application wrote in Delphi. There is a Program Executable in
Windows. When I have open the Executable file in Binary View I found
some entries like Borland & Delphi. I am not know more about delphi.
But the components using in
this program is like TStringGrid, TComboBox, TStringList etc ...
Now I need some help about TStringGrid. I am know the handle of
that TStringGrid. Now, is it possible to develop a program which able
to read this grid. In more I know some methods like SendMessage, in
which I have to pass handle of that window and some WindowMessage,
WParam & LParam.
I know C,C++,VC++,VB languages greatly. Or it is poosible in other
languages else i have mentioned also welcomed. Or any idea hint.
Your help is greatly appreciated.


Thanks
Rushikesh Joshi

Back to top
J French
Guest





PostPosted: Fri Feb 27, 2004 6:40 am    Post subject: Re: Delphi program to interact with other application Reply with quote

On 26 Feb 2004 08:00:12 -0800, [email]contracer11 (AT) uol (DOT) com.br[/email] (Shiva MahaDeva)
wrote:

Quote:
I'm looking for a Delphi program to send data to another application
(simulating control_c control_v).
Thankx.

Ah, I misread the post
- you want to paste into a 3rd party App

You'll need to find the appropriate window handle
Then send it a WM_PASTE message (text only I think)
- or possibly WM_SETTEXT

Another way is to put focus on the appropriate window and simulate the
keys using Keybd_Event


Back to top
J French
Guest





PostPosted: Fri Feb 27, 2004 7:31 am    Post subject: Re: Delphi program to interact with other application Reply with quote

On 26 Feb 2004 22:30:30 -0800, [email]rushi_asi (AT) yahoo (DOT) com[/email] (Rushikesh Joshi)
wrote:

<snip>

Quote:
Hey, would you help me as u are know delphi programming.

I have a application wrote in Delphi. There is a Program Executable in
Windows. When I have open the Executable file in Binary View I found
some entries like Borland & Delphi. I am not know more about delphi.
But the components using in
this program is like TStringGrid, TComboBox, TStringList etc ...
Now I need some help about TStringGrid. I am know the handle of
that TStringGrid. Now, is it possible to develop a program which able
to read this grid. In more I know some methods like SendMessage, in
which I have to pass handle of that window and some WindowMessage,
WParam & LParam.

It is probably Delphi, although I believe C++ Bulider uses Delphi's
visual component libraries

A TStringGrid holds its data internally within Delphi
- when Editing it appears to put a form of Edit box over the cell
(actually a TCustomMaskEdit)
- that responds to WM_GETTEXT

However, the normal Cells are 'painted' so there is no real data
directly behind them
I do not think that what you want to do will be easy

Back to top
Rushikesh Joshi
Guest





PostPosted: Fri Feb 27, 2004 1:56 pm    Post subject: Re: Delphi program to interact with other application Reply with quote

Hi J French,

Thanks to reply, as you are told the grid is paint, But i have
found there is some events fired like mouse_down, key_down etc...
And in more the rows are also able to select & able to raise some
key press events on this rows. I have some API's related to Grids to
insert the rows.
I will give to review that APIs, Please see it and tell me it is work
on TStringGrid or not.

http://www-306.ibm.com/software/data/db2/db2olap/v81docs/api/api_c/apigrid/decls/egadefs.htm

Here at this link you will found some Functions Reference & examples.

Thanks
Rushikesh Joshi
Back to top
J French
Guest





PostPosted: Fri Feb 27, 2004 2:04 pm    Post subject: Re: Delphi program to interact with other application Reply with quote

On 27 Feb 2004 05:56:05 -0800, [email]rushi_asi (AT) yahoo (DOT) com[/email] (Rushikesh Joshi)
wrote:

Quote:
Hi J French,

Thanks to reply, as you are told the grid is paint, But i have
found there is some events fired like mouse_down, key_down etc...
And in more the rows are also able to select & able to raise some
key press events on this rows. I have some API's related to Grids to
insert the rows.
I will give to review that APIs, Please see it and tell me it is work
on TStringGrid or not.

http://www-306.ibm.com/software/data/db2/db2olap/v81docs/api/api_c/apigrid/decls/egadefs.htm

That stuff does not look like a TStringGrid

I had a look at the Delphi Library source of TStringGrid before my
last post, and could not see any 'message based' ways of extracting
the data
- although I might have missed something

Back to top
Duncan McNiven
Guest





PostPosted: Fri Feb 27, 2004 3:02 pm    Post subject: Re: Delphi program to interact with other application Reply with quote

On Fri, 27 Feb 2004 14:04:04 +0000 (UTC), [email]erewhon (AT) nowhere (DOT) com[/email] (J French) wrote:

Quote:
I had a look at the Delphi Library source of TStringGrid before my
last post, and could not see any 'message based' ways of extracting
the data
- although I might have missed something

I don't think you did. I too looked at the TStringGrid source and it led nowhere. Of
course, it would be possible to provide a list of messages the grid handles, if the OP is
sufficiently interested/masochistic.

Anyway, there is no way of knowing if the grid is owner drawn or not, so even if there
were some message-based means of reaching the strings behind the grid, there is no
guarantee that these are the same as are shown to the user. Indeed, there may not be any
strings behinf the grid - they may be prepared on-the-fly. So I think the OP is on a
hiding to nothing, unless they are really lucky. A better bet may be to contact the
original developer and get some hooks built in, or to look for the source of the data
rather than the displayed data.

--
Duncan

Back to top
Rushikesh Joshi
Guest





PostPosted: Mon Mar 01, 2004 1:42 pm    Post subject: Re: Delphi program to interact with other application Reply with quote

[email]erewhon (AT) nowhere (DOT) com[/email] (J French) wrote in message news:<403f4e5d.197596032 (AT) news (DOT) btclick.com>...
Quote:
On 27 Feb 2004 05:56:05 -0800, [email]rushi_asi (AT) yahoo (DOT) com[/email] (Rushikesh Joshi)
wrote:

Hi J French,

Thanks to reply, as you are told the grid is paint, But i have
found there is some events fired like mouse_down, key_down etc...
And in more the rows are also able to select & able to raise some
key press events on this rows. I have some API's related to Grids to
insert the rows.
I will give to review that APIs, Please see it and tell me it is work
on TStringGrid or not.

http://www-306.ibm.com/software/data/db2/db2olap/v81docs/api/api_c/apigrid/decls/egadefs.htm

That stuff does not look like a TStringGrid

I had a look at the Delphi Library source of TStringGrid before my
last post, and could not see any 'message based' ways of extracting
the data
- although I might have missed something


Hi J French

Thanks to reaply me, sir as u ahve told me that stuff don't like
TStringGrid. I ahve refered the Deplhi 7.0 Book. I have not found any
idea about TStringGrid.
But my friend as i have used the Spy++ (A Class/Handle) tracker from
Microsoft is give me the class as TStringGrid.

It is possible that the grid which I look is 3rd party component
please once look at,
http://www.link-rank.com/tour4.htm

And i also have send you some snap on your email account so give me
your feed back

Thanks
Rushikesh Joshi

Back to top
J French
Guest





PostPosted: Tue Mar 02, 2004 10:39 am    Post subject: Re: Delphi program to interact with other application Reply with quote

On 1 Mar 2004 05:42:37 -0800, [email]rushi_asi (AT) yahoo (DOT) com[/email] (Rushikesh Joshi)
wrote:

<snip>

Quote:
Hi J French

Thanks to reaply me, sir as u ahve told me that stuff don't like
TStringGrid. I ahve refered the Deplhi 7.0 Book. I have not found any
idea about TStringGrid.
But my friend as i have used the Spy++ (A Class/Handle) tracker from
Microsoft is give me the class as TStringGrid.

It is possible that the grid which I look is 3rd party component
please once look at,
http://www.link-rank.com/tour4.htm

And i also have send you some snap on your email account so give me
your feed back

I've looked at that site
- and do not really understand what you are after

The site appears to be about a product that adds 'skins' to Delphi VCL
components.

That page appears to be demonstrating what the program looks like when
it is re-configuring a TCustomGrid
Are you trying to read that program ?

If Spy reports the Class as TStringGrid, then that is almost certainly
what it is
- I see you use VB - I checked out the behaviour of TStringGrid using
a little snooper of mine that I wrote in VB
GetCursorPos
WindowFromPoint
GetClassName
WM_GETTEXT

Delphi Pro comes with the source of its components, so one can drill
right down into the code to see how it works
- I and a few others have looked into the source of TStringGrid, and
it does not appear to expose its data

my name is Jerry French
and my Email address is Mail[AT]MyName[DOT]co[DOT]uk

- unfortunately my former Email address attracted so much spam, that I
now resort to such attempts to avoid getting more.

Back to top
Rushikesh Joshi
Guest





PostPosted: Fri Mar 05, 2004 11:52 am    Post subject: Re: Delphi program to interact with other application Reply with quote

[email]erewhon (AT) nowhere (DOT) com[/email] (J French) wrote in message news:<40445f3e.529647367 (AT) news (DOT) btclick.com>...
Quote:
On 1 Mar 2004 05:42:37 -0800, [email]rushi_asi (AT) yahoo (DOT) com[/email] (Rushikesh Joshi)
wrote:

snip

Hi J French

Thanks to reaply me, sir as u ahve told me that stuff don't like
TStringGrid. I ahve refered the Deplhi 7.0 Book. I have not found any
idea about TStringGrid.
But my friend as i have used the Spy++ (A Class/Handle) tracker from
Microsoft is give me the class as TStringGrid.

It is possible that the grid which I look is 3rd party component
please once look at,
http://www.link-rank.com/tour4.htm

And i also have send you some snap on your email account so give me
your feed back

I've looked at that site
- and do not really understand what you are after

The site appears to be about a product that adds 'skins' to Delphi VCL
components.

That page appears to be demonstrating what the program looks like when
it is re-configuring a TCustomGrid
Are you trying to read that program ?

If Spy reports the Class as TStringGrid, then that is almost certainly
what it is
- I see you use VB - I checked out the behaviour of TStringGrid using
a little snooper of mine that I wrote in VB
GetCursorPos
WindowFromPoint
GetClassName
WM_GETTEXT

Delphi Pro comes with the source of its components, so one can drill
right down into the code to see how it works
- I and a few others have looked into the source of TStringGrid, and
it does not appear to expose its data

my name is Jerry French
and my Email address is Mail[AT]MyName[DOT]co[DOT]uk

- unfortunately my former Email address attracted so much spam, that I
now resort to such attempts to avoid getting more.


Hi Jerry French
I have mailed you some other details on your address
mail(at)jerryfrench(dot)co(dot)uk
Is this mail address is ok or not.

Mail Message is like

Hi Jerry French

Here I have attached the snap of the software with Spy++,
Look in the image of Red Rectangle i can found the grid is used
in that software is displays
TStringGrid class.
Also in previous conversation you have told me the TStringGrid is
just paint on screen. But I have found some events like
Click,Key_Press and also full row/cell select. Actually I am raise the
click event on this grid from other application which i have developed
using VB.
Now the software which contains this TStringGrid is not using any
other component and as you have told me in last that you can view in
the code, but as this applicaiton is developed from other and I am not
able to know the code.
It is possible that the grid which I look is 3rd party component
please again once look at,
http://www.link-rank.com/tour4.htm. They have some TStringGrid.

Attachment: TSTringGrid.JPG
//or you can found it at
http://c.1asphost.com/rushikeshjoshi/TStringGrid.jpg
http://c.1asphost.com/rushikeshjoshi/TStringGrid.bmp

You can reply me on my mail address (rushi_asi (AT) hotmail (DOT) com)or append
in google groups

Thanks
Rushikesh




Thanks
Rushikesh

Back to top
J French
Guest





PostPosted: Fri Mar 05, 2004 12:54 pm    Post subject: Re: Delphi program to interact with other application Reply with quote

On 5 Mar 2004 03:52:55 -0800, [email]rushi_asi (AT) yahoo (DOT) com[/email] (Rushikesh Joshi)
wrote:

<snip>

Quote:

Hi Jerry French
I have mailed you some other details on your address
mail(at)jerryfrench(dot)co(dot)uk
Is this mail address is ok or not.

I've not seen the mail yet
- but I get a lot of Spam, and my Spam trap sometimes catches valid
stuff - I'll keep an eye open

Quote:
Mail Message is like

Hi Jerry French

Here I have attached the snap of the software with Spy++,
Look in the image of Red Rectangle i can found the grid is used
in that software is displays
TStringGrid class.
Also in previous conversation you have told me the TStringGrid is
just paint on screen.

It really is just painted on the Screen, in VB terms it is a
PictureBox on which everything is created using Print, PSet and Line
- except for one thing, the active Entry cell
- that is a form of Textbox

Quote:
But I have found some events like
Click,Key_Press and also full row/cell select.

A picturebox will have a Click and a KeyPress
- the full row select is interesting
- I think that is an enhancement to the standard TStringGrid
- you may be able to use cut and paste ... maybe

Quote:
Actually I am raise the
click event on this grid from other application which i have developed
using VB.

That might be interesting - especially if it moves the EditBox
- or highlights something for Cut and Paste

Quote:
Now the software which contains this TStringGrid is not using any
other component and as you have told me in last that you can view in
the code, but as this applicaiton is developed from other and I am not
able to know the code.

It looks like a descendant of a TStringGrid
- in Delphi you can very easily enhance a component to give it extra
properties and methods

Quote:
It is possible that the grid which I look is 3rd party component
please again once look at,
http://www.link-rank.com/tour4.htm. They have some TStringGrid.

That is - but now I know what you are after

Quote:

Attachment: TSTringGrid.JPG
//or you can found it at
http://c.1asphost.com/rushikeshjoshi/TStringGrid.jpg
http://c.1asphost.com/rushikeshjoshi/TStringGrid.bmp

Those have given me a pretty good idea of what you are after

This is getting rather a long way away from Delphi, so it might be an
idea to continue this in a VB NG - eg:

comp.lang.basic.visual.misc

It is not reasonable to hijack an NG for an off topic subject
- also you (we) might find someone with some ideas
- also ... we might get some verbal abuse here !

Personally I would be inclined to look into this App's data files
- unless you want to pick a line, 'scrape' it into another App and act
on that
- which looks to me like what you are after

Back to top
Duncan McNiven
Guest





PostPosted: Fri Mar 05, 2004 2:31 pm    Post subject: Re: Delphi program to interact with other application Reply with quote

On Fri, 5 Mar 2004 12:54:37 +0000 (UTC), [email]erewhon (AT) nowhere (DOT) com[/email] (J French)
wrote:

Quote:
- also ... we might get some verbal abuse here !

We don't often get abuse here, but I can't think of any of the regular
posters that have shown obvious expertise in this area. Normally this
would mean the post just gets ignored.

OP: One thing to check is whether you can click on the grid to edit it
in the original app. If you can, you could try to similate a "click to
edit then copy to clipboard" sequence from VB. If you can't edit the
grid in the original app, though, I think you will have problems getting
to the data behind the grid.

If you can click to edit, it might help for you to have a minimal Delphi
app with an editable string grid to experiment on. A grid with handlers
for all possible events, and run-time setting of major properties, could
make the reverse-engineering easier, and would only take a couple of
minutes to put together.

Quote:
Personally I would be inclined to look into this App's data files

Agreed. If the data is in the files, this will be FAR easier than
reading the grid.

--
Duncan


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> comp.lang.pascal.delphi.misc All times are GMT
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.