Minimize to tray problem

HappyTomato

New member
Joined
Apr 4, 2006
Messages
4
Programming Experience
1-3
in my application a module calls a form load statement to display a form with something like myform.definstance.showdialog(), then the codes in the myform_load sub-routine loads and the form become visible. i want it so that user can click on the 'minimize to tray' button on the form and the form will disappear and user can resume the form through the tray icon (which is currently displaying properly) .. however the problem i'm having is that once the user clicks on that button, it goes to that sub-routine that handles the button's onclick event, runs a line of code to hide the form, then exit that sub-routine, but when it exits the sub routine, it exits the whole myform module and escapes back to the startup module that called the myform.definstance.show(), thus terminating the application..

any ideas on how i could fix that? any help will be greatly appreciated.. =)
 
I hope this helps, but i noticed you said .DefInstance which means the project has been through the vb6 upgrade wizard and my suggestion is to get rid of that upgrade wizard crap (regarding the DefInstance stuff)

but the attachment here shows real quick how to hide a form and show it again through the NotifyIcon
 
Thanks for ur help, I had a look at your example and i don't get how come ur app doens't terminate when you're hiding the main form (unlike my one..=/ ).. maybe it's because my form is called from a module.... don't know..

I've sorta solved the problem by replacing the myform.definstance.showdialog() with application.run(new myfrm) .. and it seem to be working fine now.. I still don't really understand the fine details as to why it's working, maybe it's because if i do it this way it's holding onto a thread therefore the app wont terminate, whereas the definstance.showdialog() doesn't.. but anyway, at least it works, thanks a lot juggalobrotha ! =)
 
i'm a little confused when you say you're running your form from a module, yet you're using the upgrade wizard's DefInstance crap

zip your project and post it here, perhaps i can explain some of what's going on in your project
 
Back
Top