Re: FPC 2.0.2 Win32 Console Application and GetOpenFileName() Dialog





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 =----
.



Relevant Pages

  • Re: Pocket outlook - AppointmentsCollection class: ListChanged eve
    ... Visual Developer - Device Application Development MVP ... Chris Tacke, Embedded MVP ... Windows Messages. ... could put this code in a windows app but write you're own message pump ...
    (microsoft.public.dotnet.framework.compactframework)
  • Fishy Behavior when using Managed code in Unmanaged environment
    ... We have an MFC application that is compiled under VS 2003 (its a pure ... AND THEN we found this article on MSDN "Windows Forms and Unmanaged ... When you open a Windows Form from a COM client application, ... Is this message pump incompatibility the real reason for our keyboard ...
    (microsoft.public.dotnet.framework.interop)
  • Re: Pocket outlook - AppointmentsCollection class: ListChanged event
    ... It would be a good idea to know something about how a Windows program works ... or you need to build your own message pump. ... Thread timerThread = timer.Start; ... public void SleepIntermittently ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: BackgroundWorker Capability For Non UI Classes
    ... The main thread does have a UI, however the main message pump is a Visual ... however I was concerned that it wasn't a .NET message pump and the client ... BackgroundWorker doesn't require any control's to be created. ... I don't understand your worries about the windows forms dll. ...
    (microsoft.public.dotnet.framework.windowsforms)
  • how to measurewaveIn staggering
    ... detect cases when the main message loop does not idle for a long time. ... System function DialogBox creates its own message loop and my ... Windows CE they are not officially supported. ...
    (microsoft.public.pocketpc.developer)