Results 1 to 6 of 6

Thread: subclassing problem.. Crash / Error on ending program... [ Solved ]

  1. #1

    Thread Starter
    Frenzied Member wpearsall's Avatar
    Join Date
    Feb 2002
    Location
    England / UK
    Posts
    1,065

    subclassing problem.. Crash / Error on ending program... [ Solved ]

    Hi guys, this should be a simple question to answer [i hope]...

    When the EXPLORER.EXE task crashes, when it restores [Due to another explorer.exe being initiated via taskmanager etc...]

    the message 49252 gets sent to the open forms..... as the systray etc restores itself.

    now, i use an systray icon in my app, so, i have decided to take advantage of this, to always restore my icon, when explorer crashes [IE: like yahoo, MSN, and most other app's (ZA Pro, Norton AV ETC)], as i hate having to end the process / restart the app to get the icon back for hidden apps, which i am sure users of my app will be like..

    anyhow, i have got this working, via subclassing my main form, but, when i end my program, it is causing an error, which closes out the VB IDE, when in edit, and sends an invalid process termination message when run as an EXE.

    now, i am guessing i havent unsubclassed my form correctly, however, i unsubclass before removing my program icon, and it removes my program icon perfectly fine,

    anyhow:

    I call in form load: modIcon.AddIcon
    and in form queryunload: modicon.DeleteIcon

    Add icon then calls subclass form
    and delete icon then calls to unsubclass the form

    now, if anyone can see what i've done wrong here, that would be brilliant [as i aint the best with subclassing etc]

    i have got the icon to re-add in my other app, but only really because i call to update the icon from a peice of already inserted subclassing, so i am thinkin it has to be something i got wrong on my subclassing...

    Thanks..
    Attached Files Attached Files
    Last edited by wpearsall; Aug 12th, 2003 at 12:24 AM.
    Wayne

  2. #2
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    try making a new app that only contains the re-adding icon and subclassing part. if it doesn't crash then it is something with the main program. also try stepping through the code (using F8) to determine if it is crashing at the unsubclass point or anything else.
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  3. #3

    Thread Starter
    Frenzied Member wpearsall's Avatar
    Join Date
    Feb 2002
    Location
    England / UK
    Posts
    1,065
    ok, now i know what it is (or rather, was),,, damn End statement after i unloaded all ma forms..

    tnx..
    Wayne

  4. #4
    Frenzied Member moinkhan's Avatar
    Join Date
    Jun 2000
    Location
    Karachi, Pakistan
    Posts
    2,011
    OK!! I will post it as another thread as well..
    But i m having the problem in subclassing.. I want to capture WM_CLOSE message and want to do something other than just closing.. then i want to close the form as well. ... everything goes right..other than when i try to close the form.. i don't want it's default proc to handle this message so i skip calling it.. but when i use SendMessage to close my form.. it's closing my whole application... and if i use DestroyWindow then it's not returning resources to the system... so form is out but resources are still there...
    Do u have any idea?

  5. #5

    Thread Starter
    Frenzied Member wpearsall's Avatar
    Join Date
    Feb 2002
    Location
    England / UK
    Posts
    1,065
    cant u use the unload / query unload of the form?

    it normally always handles any close method? [to help stop destroying the application from running, since lots of apps need to delete / write files etc, as they close]
    Wayne

  6. #6
    Frenzied Member moinkhan's Avatar
    Join Date
    Jun 2000
    Location
    Karachi, Pakistan
    Posts
    2,011
    No!! I want to overload a default behavior of window's closing..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width