>And I was wondering if there were some way you
>could use Prima to start up a compiled Windows program in a manner that
>would be perfectly normal except that the window would have a different
>title (in the blue bar on the top). As always, thank you for answering my
>questions.
Joel -
I looked in the Prima source, and while Dmitry has given us some
platform-specific functionality, this does not appear to be part of it.
However, I whipped up a little something that can change the name after the
called program is started, using Win32::API. You need to know what the
original text is for this to work. I don't know how to get the windows
process ID for a windows process started this way, but if we had that, I'm
sure there's a way to get the window handle from the process ID.
If you need any more help or suggestions regarding this code, please send me
a message off-list, since this is not Prima code.
use strict;
use Win32::API;
# the definition actually calls for a 'PP' (two pointers to strings)
# but we need to pass NULL as the first, so 'NP' is what actually works
Win32::API->Import('user32', 'FindWindow', 'NP', 'N') or die $^E;
# again, 'NIPP' would be correct, but since the third parameter is not used
# we make it a 'N' so we can send NULL
Win32::API->Import('user32', 'SendMessage', 'NINP', 'N') or die $^E;
# change these values to whatever you want
my $filename = "test.txt";
my $newtext = "Success!";
# start the new process and then sleep - if we don't sleep,
# FindWindow gets called before the new window is visible
system("start notepad $filename");
sleep 1;
my $Handle = FindWindow(
0, # window class - not used
"$filename - Notepad"
);
SendMessage(
$Handle,
12, # WM_SETTEXT
0, # this parameter is not used for WM_SETTEXT
$newtext
);
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
Received on Thu 12 Aug 2004 - 17:22:19 CEST
This archive was generated by hypermail 2.2.0 : Sat 19 Mar 2011 - 18:35:05 CET