RE: wwwlib eventloop setup.

LM:

Here was what I would do.  Obtain the default windows event loop handler for
the
server via

	// put my window handler in place of the app default, 'insert in the proc
chain basically
	originalappproc =
(WNDPROC)SetWindowLong(GetWinHandle(main.Window),GWL_WNDPROC,(long)
myAsyncWindowProc);

	then Intercept all of the events in myAsyncWindowProc, filter out the ones
you want, and
	send the rest back to the originalappproc.

	Something like this should work:

	PRIVATE LRESULT CALLBACK myAsyncWindowProc(HWND hwnd, UINT uMsg, WPARAM
wParam, LPARAM lParam)
	{
		if (!CallWindowProc(libwwwwinproc,hwnd,uMsg,wParam,lParam))
    			return (DefWindowProc(hwnd, uMsg, wParam, lParam));

	}

or something like this.  this may not be entirely correct, but it should
give you
some ideas.  Think hook & filter.

FYI, this is also a great way to integrate your own functions right in
myAsyncWindowProc.  For
example a client thread wants to q a request.  This is a great thing about
libwww, even though
its not multi-threaded, you can handle tons of requests in a single 'server
thread' just
by hook the event loop and intercepting client thread requests.  Thus you
don't have the overhead
of thread switching in the libwww library itself (obviously the client
threads still switch).

Hope that helps.

regards,

Fred Covely
fcovely@covely.com
(B)760-631-8157
(C)760-717-9689

-----Original Message-----
From: www-lib-request@w3.org [mailto:www-lib-request@w3.org]On Behalf Of
Lucas Meijer
Sent: Friday, April 20, 2001 8:29 AM
To: www-lib@w3.org
Subject: wwwlib eventloop setup.


Hi All,

  Forgive me if this is not the appropriate list to send this
question to. I've search trough all docs&facs but can't work this out:

I want to use wwwlib in a plugin I'm writing for some serverapplication.

I've studied most of the examples, and they all go into a eventloop sooner
or later.

Since I'm writing this as a plugin, I can only react on 'idle' events I
get from my server sytem, and if I were to go into an eventloop I would
block the server from doing all its regular stuff..

I've been trying to find the way I'm supposed to do this, but have been
unsuccesfull. Can I use www-lib in such a way that I can periodically send
it Update()'s instead of going control to the eventloop and reacint on
events?

Any insights, or pointers to info on this topic would be warmly welcomed.

Thanks,

  Lucas

Received on Friday, 20 April 2001 13:02:52 UTC