🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #11577

FindWindow(), SendDlgItemMessage() and gaining access to external dialog at run-time....

#11577
From: Mike Collins
Date: Thu, 29 Jan 2004 20:59
32 lines
2355 bytes
Hi all,

I'm just about to start looking at this problem so I just need a few
pointers, nothing to indepth :-)

I have a DLL which was not written by myself and I don't have access to
source (written in MSVC++).  When I load the DLL and call certain function
it displays a dialog box.  I need to gain access to the dialog at run-time
to enable / disable certain buttons, set text etc.

Not 100% sure if it's possible but my line of thought is this:

1) At design-time run a program like ExeScope or ResHacker to examine the
DLL's resource section in order to look at the resource script for the
dialog box get the ID's of the controls that I need to access.
2) At run-time call FindWindow() to get a Handle to the dialog.
2) Since I have a handle to the dialog and the ID of the control I should be
able to use SendDlgItemMessage() to 'issue' command to the various controls?

- so, is this the right line of thought or am I missing something?  If it is
as I think, any pointers on which messages to send to enable / disable
buttons, set text in buttons and edit box's, based on the fact that it's all
been written in VC++.

Finally, is there anyway to 're-direct' what happens when a certain control
is accessed i.e. I want to re-direct one of the buttons on this dialog so
when the user clicks on it, my own code is executed instead of the DLL's
code.

Thanks in advance for any help,

Mike C
Technical Details
Message-ID: <4019701c@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,4eefc5cc424422c6,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-01-29 13:10:40 PST
Reply-To: "Mike Collins" <mikec@kr8.co.uk>
From: "Mike Collins" <mikec@kr8.co.uk>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: FindWindow(), SendDlgItemMessage() and gaining access to external dialog at run-time....
Date: Thu, 29 Jan 2004 20:59:00 -0000
Lines: 34
Organization: kr8
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 81.2.78.34
Message-ID: <4019701c@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1075408924 81.2.78.34 (29 Jan 2004 12:42:04 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail