UnloadMode 
Author Message
 UnloadMode

In VB, when a form unloads (closes), you can use the 'UnloadMode' to find
out what is closing the dialog (The user, system, task manager etc.) In
PBDLL, CBMSG gives us %WM_CLOSE, but I can't find any way of determining
just WHAT is requesting the close.

Any ideas on how to implement this in PBDLL ??

Alan



Wed, 24 Apr 2002 03:00:00 GMT  
 UnloadMode
Alan,

At API level, a %WM_CLOSE is a "Close Request" event.    VB most
probably does it's own event tracking to provide the functionality you
are referring.

If someone clicks on the X (the close button), or uses the system-menu
CLOSE function, your window/dialog procedure (or DDT dialog callback)
will receive a %WM_SYSCOMMAND message, and that will have a wParam =
%SC_CLOSE parameter.  Sometime after receiving that message, your code
receives a %WM_CLOSE message.  If required, you can query the user and
abort the %WM_CLOSE event if you so wish.

IOW,  %WM_SYSCOMMAND|%SC_CLOSE precedes %WM_CLOSE, and is in direct
response to a close directive, whereas (as you have noted), %WM_CLOSE
can arrive from alternative sources other than the user clicking on
the close button.

If windows is shutting down, your code receives %WM_QUERYENDSESSION
and %WM_ENDSESSION messages.

Other than closing down in response to a click on one of your own
app-specific buttons, you can tell if your window is shutting down
from a user click, Windows shutdown, or just window destruction.

Other than %WM_QUIT, anyone know of any other methods do distinguish
window closures apart?

Quote:

>In VB, when a form unloads (closes), you can use the 'UnloadMode' to find
>out what is closing the dialog (The user, system, task manager etc.) In
>PBDLL, CBMSG gives us %WM_CLOSE, but I can't find any way of determining
>just WHAT is requesting the close.

>Any ideas on how to implement this in PBDLL ??

Lance
powerbasic Support

-------------------------------------------------------------------------
PowerBASIC, Inc.      | 800-780-7707 Sales | "We put the Power in Basic!"
316 Mid Valley Center | 831-659-8000 Voice | http://www.powerbasic.com



Thu, 25 Apr 2002 03:00:00 GMT  
 UnloadMode
Lance, you are a diamond....

works like a dream !!!


Quote:
> Alan,

> At API level, a %WM_CLOSE is a "Close Request" event.    VB most
> probably does it's own event tracking to provide the functionality you
> are referring.

> If someone clicks on the X (the close button), or uses the system-menu
> CLOSE function, your window/dialog procedure (or DDT dialog callback)
> will receive a %WM_SYSCOMMAND message, and that will have a wParam =
> %SC_CLOSE parameter.  Sometime after receiving that message, your code
> receives a %WM_CLOSE message.  If required, you can query the user and
> abort the %WM_CLOSE event if you so wish.

> IOW,  %WM_SYSCOMMAND|%SC_CLOSE precedes %WM_CLOSE, and is in direct
> response to a close directive, whereas (as you have noted), %WM_CLOSE
> can arrive from alternative sources other than the user clicking on
> the close button.

> If windows is shutting down, your code receives %WM_QUERYENDSESSION
> and %WM_ENDSESSION messages.

~~~cut~~~


Thu, 25 Apr 2002 03:00:00 GMT  
 UnloadMode
Lance,
  As I mentioned in another thread you can't abort DDT in the %WM_CLOSE event.
It's possible to do this using the SDK format because "you" are responsible
for destroying the Dialog.

  In DDT you can abort in the WM_SYSCOMMAND -> SC_CLOSE by returning a non
zero value.

James

Quote:

>Alan,

>At API level, a %WM_CLOSE is a "Close Request" event.    VB most
>probably does it's own event tracking to provide the functionality you
>are referring.

>If someone clicks on the X (the close button), or uses the system-menu
>CLOSE function, your window/dialog procedure (or DDT dialog callback)
>will receive a %WM_SYSCOMMAND message, and that will have a wParam =
>%SC_CLOSE parameter.  Sometime after receiving that message, your code
>receives a %WM_CLOSE message.  If required, you can query the user and
>abort the %WM_CLOSE event if you so wish.

>IOW,  %WM_SYSCOMMAND|%SC_CLOSE precedes %WM_CLOSE, and is in direct
>response to a close directive, whereas (as you have noted), %WM_CLOSE
>can arrive from alternative sources other than the user clicking on
>the close button.

>If windows is shutting down, your code receives %WM_QUERYENDSESSION
>and %WM_ENDSESSION messages.

>Other than closing down in response to a click on one of your own
>app-specific buttons, you can tell if your window is shutting down
>from a user click, Windows shutdown, or just window destruction.

>Other than %WM_QUIT, anyone know of any other methods do distinguish
>window closures apart?


>>In VB, when a form unloads (closes), you can use the 'UnloadMode' to find
>>out what is closing the dialog (The user, system, task manager etc.) In
>>PBDLL, CBMSG gives us %WM_CLOSE, but I can't find any way of determining
>>just WHAT is requesting the close.

>>Any ideas on how to implement this in PBDLL ??

>Lance
>PowerBASIC Support

>-------------------------------------------------------------------------
>PowerBASIC, Inc.      | 800-780-7707 Sales | "We put the Power in Basic!"
>316 Mid Valley Center | 831-659-8000 Voice | http://www.powerbasic.com




Thu, 25 Apr 2002 03:00:00 GMT  
 UnloadMode
Hi James,

You are correct, thanks for pointing my error out.  <smacking own
hand.. Ouch!>

Cheers,
Lance.


Quote:
>Lance,
>  As I mentioned in another thread you can't abort DDT in the %WM_CLOSE event.
>It's possible to do this using the SDK format because "you" are responsible
>for destroying the Dialog.

>  In DDT you can abort in the WM_SYSCOMMAND -> SC_CLOSE by returning a non
>zero value.



Fri, 26 Apr 2002 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 
 

 
Powered by phpBB® Forum Software