Hi,
Any example would contain lots of C code. I can give an overview which would
be probably more useful:
The main problem is getting your GUI talking to the threaded backend - this
is true of any language toolset - in this case the front end is in Perl,
while most of the backend is in C (contained in XS or dll's). I create two
semaphore controlled queues, one input queue and one output queue - when the
queue is full the calling thread will block. To 'talk' from perl to C, I
create a simple XS function that adds items to this queue, unless the queue
is full, the function wont block. To 'talk' from C to Perl, I use the
windows function sendmessage that causes an event to fire in the GUI and
another XS function is used to take items from the queue.
When the application starts I pass the window handles(s) of my application
to the C backend (eg $window->{-handle}) and when I need to fire an event in
the GUI I use:
SendMessage(winHand,512,&message,0);
Which fires the mouse move event for the passed in window handle. You can
then use simple logic to work out if the event came from a genuine mouse
move, or from the C backend. If from the C backend, you call a funtion that
gets the items from the queue.
Hope that helps,
Cheers,
jez.
----- Original Message -----
From: "Harlan Carvey" <[EMAIL PROTECTED]>
To: "Jez White" <[EMAIL PROTECTED]>; "Alex Lee"
<[EMAIL PROTECTED]>; "Win32-GUI List"
<perl-win32-gui-users@lists.sourceforge.net>
Sent: Monday, November 29, 2004 2:41 AM
Subject: Re: FW: [perl-win32-gui-users] Website - Code snippets gallery
Jez,
Do you have examples of this?
Thanks,
Harlan
--- Jez White <[EMAIL PROTECTED]> wrote:
Hi,
> I can put together GUIs...been doing it in Java,
Tk,
> and using Win32::GUI. One thing I'd be interested
in
> would be how to write a Windows app that has a GUI
> that responds when you click buttons, but the
> underlying activities/background processes
continue to
> run.
This is doable by using threads - you will probably
better of using the
latest version of Perl (5.8.4?) as you can, since
threading is generally
weak in early versions. Win32::gui seems fine with
threads since I've been
able to create C threads (via an xs module) which
were able to fire events
in the GUI via windows SendMessages.
Cheers,
jez.
=====
------------------------------------------
Harlan Carvey, CISSP
"Windows Forensics and Incident Recovery"
http://www.windows-ir.com
http://groups.yahoo.com/group/windowsir/
"Meddle not in the affairs of dragons, for
you are crunchy, and good with ketchup."
"The simplicity of this game amuses me.
Bring me your finest meats and cheeses."
------------------------------------------