From dmurdoch at pair.com  Mon Jul 19 15:27:28 2004
From: dmurdoch at pair.com (Duncan Murdoch)
Date: Mon Jul 19 15:27:58 2004
Subject: [Rd] getWindowsHandle()
In-Reply-To: <Pine.GSO.4.58.0407161551420.12812@uni01du.unity.ncsu.edu>
References: <Pine.GSO.4.58.0407151559590.14948@uni01du.unity.ncsu.edu>
	<g5qdf0tqb7dvvrdorqqlbg6ool5309p28c@4ax.com>
	<Pine.GSO.4.58.0407161551420.12812@uni01du.unity.ncsu.edu>
Message-ID: <iiinf0huiif9i780smbhna4ka45i5lkrkl@4ax.com>

On Fri, 16 Jul 2004 16:05:57 -0400 (EDT), Peng Liu
<pliu3@unity.ncsu.edu> wrote :

>On Thu, 15 Jul 2004, Duncan Murdoch wrote:
>
>> You'll need to read Windows documentation.
>> Currently R has no way to get the list of MDI document windows.  I
>> think the function you want is EnumChildWindows, but you might need to
>> use EnumWindows.  I can't remember whether MDI documents are child
>> windows or top level windows.
>
>Hi Dr. Murdoch,
>Thanks for you advice. I checked WIN32API documents and write the
>following codes. So far, the call just gives all the hwnd's of child
>windows. Many window widgets are treated as child windows, such as
>tool bar, shortcut buttons, workspace, and so on. Therefore, the output
>can be a long list. Probably, I need to redefine the maximum number of
>handles. Moreover, it does not make sense to give a list of hwnd's only. I
>will add more information to the output later.

As a general principle, I don't think we should put things in R if
they done more easily in C.  It's relatively tricky to figure out R's
window handles if you start from nothing, so I put in
getWindowsHandle.  But I don't have a clear picture of what you want
the MDI child window handles for.  Is there something you can do with
those with R code?  If not, why not just write code like your C code
whenever you need the child window?

The problem with putting functions into R is that it increases the
maintenance burden.  Functions need to add value to justify this.  I'm
not saying a function like yours wouldn't add value, just that it's
not obvious to me how it would.

Could I suggest that you write all of this up as a package?  Let me
know when you come to something that just can't be done because of
something missing from R itself.

Duncan Murdoch


[Rd] getWindowsHandle()
Duncan Murdoch