🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Finding Windows

#17011
From: Keneth Wagner
Date: Mon, 14 Apr 2003 09:15
106 lines
4606 bytes
Ok, i have two toolbar inside the mainform.  With the EnumChildWindows i am
able to get all the components inside the mainform, that is ok.  The
difference between the Toolbars is not important right now because i can
make the difference with the buttons each toolbar has inside.  The problem
is that i can not get the buttons inside the toolbar.
I tried to use the same function "EnumChildWindow" calling it with the
Handle of the toolBar, but nothing happens.  what I'm doing wrong?.  The
function don't execute itself when the handle is from a toolbar.  Even i
tried to get the menu of the application because i can get the functions i
need to run from there, but i am stock in there too.  The last i tried to do
was send a message to windows with a hotkey but i still don't know how to
put, by example,  the shortcut Ctrl+'N' for send it with the SendMessage()
function.
Excuse me for my poor knowledge in this, but is the first time i try to do
something like this.  I have an application that its suppose to do a test of
some hardware in an automatic way, but first i have to configurate the
hardware using a configuration tool, and will be great for me to make the
configuration (using the other program) automatically too.

Ok, so, I can not do this via DDE, so the only way for me is this.  This is
most for knowledge than because i have to.  I never was working like this
with the api.  Some recomendation? or can you tell me why (even the spy and
WinSight32) I'm not able to see or get the button handles inside the
toolbars?.  Thanks a lot for your answer.

-- Here is part of the code I have, the call from a button, and two
EnumChildProc, one for all the componetns and other when is a toolbar ----

//--------------------------------------------------------------------------
-
void __fastcall TForm1::Button9Click(TObject *Sender)
{
    bool ItsWorking;
    HWND bt=0;
    RECT lParam;
    long param;



ItsWorking=EnumChildWindows(MainHandle,WNDENUMPROC(EnumChildProc),(LPARAM)
&lParam);
    if(ItsWorking){
        ShowMessage("OK");
    }
}
//--------------------------------------------------------------------------
-
BOOL CALLBACK EnumChildProc(
    HWND hwndChild,
    LPARAM lParam
)

{
    LPRECT rcParent;
    int i, idChild;
    char strString[20];
    bool Working;

    idChild = GetWindowLong(hwndChild, GWL_ID);

    GetClassName(hwndChild,strString,20);
    if(AnsiString(strString) == "TToolBar"){

Working=EnumChildWindows(MainHandle,WNDENUMPROC(EnumChildProcNew),(LPARAM)
&lParam);
    }
    ShowMessage(AnsiString(strString) + " Actual Class.");
    return TRUE;

}

BOOL CALLBACK EnumChildProcNew(
    HWND hwndChild,
    LPARAM lParam
)

{
    LPRECT rcParent;
    int i, idChild;
    char strString[100];

    idChild = GetWindowLong(hwndChild, GWL_ID);

    GetClassName(hwndChild,strString,100);
    ShowMessage(AnsiString(strString) + " Inside if  the Tool Bar.");
    return TRUE;
}


"Ed Mulroy [TeamB]" <ed@mulroyREMOVETHESECHARS.org> schrieb im Newsbeitrag
news:3e96ae95$1@newsgroups.borland.com...
> I don't know how to tell which toolbar is the one you want.  You're going
to
> have to examine any differences between them to see how you can tell them
> apart.
>
> Try running WinSight32 or Spy when the program with the tool bars is
active
> and examining their characteristics.
>
> .  Ed
>
> > Keneth Wagner wrote in message
> > news:3e96ad0d@newsgroups.borland.com...
>
>
Technical Details
Message-ID: <3e9a7c53$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.frii.net!newsfeed.frii.net!news.compaq.com!uunet!sac.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3e9540f0@newsgroups.borland.com> <3e959b94@newsgroups.borland.com> <3e96ad0d@newsgroups.borland.com> <3e96ae95$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,56e464a3a8a5bbaa
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-04-14 02:36:59 PST
From: "Keneth Wagner" <Keneth_w@msn.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3e9540f0@newsgroups.borland.com> <3e959b94@newsgroups.borland.com> <3e96ad0d@newsgroups.borland.com> <3e96ae95$1@newsgroups.borland.com>
Subject: Re: Finding Windows
Date: Mon, 14 Apr 2003 11:15:32 +0200
Lines: 108
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
NNTP-Posting-Host: 213.157.9.171
Message-ID: <3e9a7c53$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1050311763 213.157.9.171 (14 Apr 2003 02:16:03 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.frii.net!newsfeed.frii.net!news.compaq.com!uunet!sac.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail