Re: FPC 2.0.2 Win32 Console Application and GetOpenFileName() Dialog
- From: jim <"sjedgingN0sp"@m@xxxxxxx>
- Date: Sat, 11 Mar 2006 09:24:25 -0600
kevin d wrote:
Thank you for your input Marco.
I do have a Petzold Book (Programming Windows 3.1). I have reviewed
the sections that explain about the message pump. I am still a little
confused how that fits into a console application.
When you create the Getopenfile dialog you have to set up an
"openfilename" structure. One of your options when filling in values for
the structure is to give it a pointer to your own function that can
control some of the behavior of the dialogbox while it is open. The
function you create must follow a certain form (see microsoft's
windowproc and dialogproc documentation)
The term message pump is just an abstraction like "window" or
"desktop". If you gave Windows a pointer to your function then it will
call your function before it calls the default function that runs the
dialog box. Each time a call is made to your function one of the
parameters has a code (dword) set to tell you the reason for the call.
This code is called a message.
You are probably only interested in one message. So the body of your
function would consist of something like this:
If message=createwindow then setfocus
Createwindow is a defined windows variable (passed to your function as
a parameter named message) and setfocus is a windows API function. So
most of the time your procedure does nothing - just the one time when it
is called while Windows is setting up the dialog box, it will modify the
dialog box behavior.
If alt-tabbing focusses the modal filedialog, why is it not
automaticaly focused by the call to GetOpenFilename() ?
I don't know - ask Bill Gates and his minions. You would expect that the
default dialog procedure would always set the focus. The point is you
can customize the behavior by putting in a function that will take care
of this.
It's also possible that some flag or variable in the openfilename
structure (record) can be set that will influence the initial behavior.
This is likely the case since that record gets modified in the process
of opening and closing the dialog and that may be why it has focus after
the first time. So you may be able to dump the contents of that record
and compare changes from the first to subsequent calls to the dialogbox
to figure out what you need to change. If that works you don't need to
set up a function to control the dialog box (i.e. message pump) unless
you wish to change some other behavior.
-jim
----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
.
- Follow-Ups:
- References:
- Prev by Date: Re: FPC 2.0.2 Win32 Console Application and GetOpenFileName() Dialog
- Next by Date: Re: AT&T mergers might help software stability
- Previous by thread: Re: FPC 2.0.2 Win32 Console Application and GetOpenFileName() Dialog
- Next by thread: Re: FPC 2.0.2 Win32 Console Application and GetOpenFileName() Dialog
- Index(es):
Relevant Pages
|