The MASM Forum

General => The Campus => Topic started by: xandaz on November 16, 2020, 08:43:39 AM

Title: MDI muilti edit control app crashes. why
Post by: xandaz on November 16, 2020, 08:43:39 AM
    Hey. I'm making a multiple document interface app with multiple edit controls. the application crashes sometimes when loading the text files. does anyone know anything about this? thanks in advance :thumbsup:
Title: Re: MDI muilti edit control app crashes. why
Post by: jj2007 on November 16, 2020, 09:18:35 AM
You are kidding, xandaz... "help, my program crashes" without any code???
Title: Re: MDI muilti edit control app crashes. why
Post by: xandaz on November 16, 2020, 09:18:30 PM
   sorry.... i thought someone might have been through the same issue. I'll givre you the code right away.
Title: Re: MDI muilti edit control app crashes. why
Post by: jj2007 on November 16, 2020, 10:21:28 PM
The culprit is LoadIconW in mdichild.asm
If you replace that with LoadIcon, 0, IDI_HAND you've got an icon but RegisterClass fails for other, unknown reasons.

I can't tell you more because I don't have the energy to deal with a project that has no comments and is distributed over a dozen files. Sorry to be rude but you should rethink your approach to programming.

Title: Re: MDI muilti edit control app crashes. why
Post by: xandaz on November 16, 2020, 11:27:59 PM
   ok ... i'll think about that. Thanks JJ.
Title: Re: MDI muilti edit control app crashes. why
Post by: HSE on November 17, 2020, 12:34:09 AM
Hi Xandaz!

Look like something is pointing nowhere.

I only can see a window popup without any parent  :biggrin:
Title: Re: MDI muilti edit control app crashes. why
Post by: daydreamer on November 17, 2020, 03:03:24 AM
I only get an empty messagebox with OK button
invoke with a missing addr to filename in CreateFile or somewhere else?

you could check for invoke's that return eax==NULL afterwards with Messagebox =found one problem with failed api call

or use debugger to singlestep the suspicious area

well I prefer m2m macro,than bare metal push/pops because if forget one push or one pop get unbalanced stack
Title: Re: MDI muilti edit control app crashes. why
Post by: jj2007 on November 17, 2020, 03:39:19 AM
Quote from: daydreamer on November 17, 2020, 03:03:24 AM
invoke with a missing addr to filename in CreateFile or somewhere else?

If you had read my answer above, you would know that it's "somewhere else"

@xandaz: If you comment out this line, you will see a window; however, there are heap errors afterwards - test the Open menu.

        invoke  InitCommonControlsEx,addr iccx
        ; invoke  ManageOpenMode,0
Title: Re: MDI muilti edit control app crashes. why
Post by: HSE on November 17, 2020, 04:10:34 AM
Hi Xandaz!

You have:
        invoke  ManageOpenMode,0
        invoke  WinMain,hInstance,0,0,SW_SHOWNORMAL


and must be:        invoke  WinMain,hInstance,0,0,SW_SHOWNORMAL
        invoke  ManageOpenMode,0

Title: Re: MDI muilti edit control app crashes. why
Post by: jj2007 on November 17, 2020, 04:14:25 AM
@HSE: That doesn't solve it. Of course, the call does no harm right before ExitProcess, but check the Open menu.
Title: Re: MDI muilti edit control app crashes. why
Post by: xandaz on November 17, 2020, 04:41:53 AM
    the manageopenmode was put there test purposes only.
Title: Re: MDI muilti edit control app crashes. why
Post by: HSE on November 17, 2020, 04:44:02 AM
Quote from: jj2007 on November 17, 2020, 04:14:25 AM
@HSE: That doesn't solve it. Of course, the call does no harm right before ExitProcess, but check the Open menu.
Ok. ManageOpenMode crash before WinMain.
Title: Re: MDI muilti edit control app crashes. why
Post by: jj2007 on November 17, 2020, 06:09:39 AM
Quote from: xandaz on November 17, 2020, 04:41:53 AM
    the manageopenmode was put there test purposes only.

Even if you comment it out, the program crashes when you use the Open menu.