Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) 
Author Message
 Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)

Is there a way to determine if you entered this routine from the
Control Box X (top right close program) or if windows is shutting
down?

Many Thanks

Tim



Sun, 28 Dec 2003 06:46:41 GMT  
 Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
In MSDN (standard VB help), search for QueryUnload .. it lists the various
UnloadModes along with their respective VB constants


Quote:
> Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)

> Is there a way to determine if you entered this routine from the
> Control Box X (top right close program) or if windows is shutting
> down?

> Many Thanks

> Tim



Sun, 28 Dec 2003 06:56:51 GMT  
 Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)

Yep.
UnloadMode is surprisinly the mode that your app is unloading in. :)

select case UnloadMode
        case 0 : msgbox("User quits")
        case 1 : msgbox("Program quits via code")
        case 2 : msgbox("OS is closing")
        case 3: msgbox("Taskman closing us")
        case 4: msgbox("MDIMain closing")
        case 5: msgbox("Owner closing")
end select

You should yield to 2, 3, 4 and 5, because the system is rarely
kidding. 0 and 1 is ok to cancel.

Quote:
>Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)

>Is there a way to determine if you entered this routine from the
>Control Box X (top right close program) or if windows is shutting
>down?

>Many Thanks

>Tim

Regards, Frank.


Sun, 28 Dec 2003 07:04:36 GMT  
 Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
 Thanks alot Frank;

Tim



Quote:
>select case UnloadMode
>    case 0 : msgbox("User quits")
>    case 1 : msgbox("Program quits via code")
>    case 2 : msgbox("OS is closing")
>    case 3: msgbox("Taskman closing us")
>    case 4: msgbox("MDIMain closing")
>    case 5: msgbox("Owner closing")
>end select



Sun, 28 Dec 2003 07:33:51 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Converting integers and long integers to byte arrays

2. Long = Integer * Integer Overflow error

3. Integer VB Vrs Integer SQL Arrrgggggggg

4. Integer or "integer"??

5. Cancel As Integer

6. Equivalent of Form_Unload(Cancel as Integer)

7. Simulating grid_RowColChange(cancel as integer) question

8. How do you use new Bitmap(Integer,Integer,Integer,PixelFormat,IntPtr)?

9. public sub SetMousePos(X as integer, Y as Integer) ?????

10. Which is better Ctype(mystring,Integer) or Integer.Parse(Mystring) ??

11. string to integer? integer to string?

12. How do I extract the lower 8 Bits or upper 8 Bits as an Integer from a 16 Bit Integer

 

 
Powered by phpBB® Forum Software