The MASM Forum

General => The Campus => Topic started by: xandaz on November 30, 2020, 04:48:49 AM

Title: Edit control gets locked after file in Streamed in. Why?
Post by: xandaz on November 30, 2020, 04:48:49 AM
  Hey... i'm getting pretty desperate at this. After the file is loaded into the richedit control it gets lock and can't do any input. Any ideas why. The file was opened with GENERIC_READ ..._WRITE and FILE_SHARE_READ ..._WRITE. I'm getting pretty disgusted with my lowly skills...thanks in advance
Title: Re: Edit control gets locked after file in Streamed in. Why?
Post by: guga on November 30, 2020, 05:14:18 AM
Quote from: xandaz on November 30, 2020, 04:48:49 AM
  Hey... i'm getting pretty desperate at this. After the file is loaded into the richedit control it gets lock and can't do any input. Any ideas why. The file was opened with GENERIC_READ ..._WRITE and FILE_SHARE_READ ..._WRITE. I'm getting pretty disgusted with my lowly skills...thanks in advance

Post the code you are doing so other can help. :thumbsup:
Title: Re: Edit control gets locked after file in Streamed in. Why?
Post by: xandaz on November 30, 2020, 05:36:27 AM
   the code is kinda wide... thanks for helping out. i've been trying UnlockFile among other things...
Title: Re: Edit control gets locked after file in Streamed in. Why?
Post by: jj2007 on November 30, 2020, 10:52:41 AM
And we have to guess what all this code does???

loop_3:
                    push    ecx
                    invoke  SendMessage,hMdi,WM_MDIGETACTIVE,0,0
                    mov     hCurrentWindow,eax
                    .if     kc_flag==IDYES
                            invoke  GetWindowLong,hCurrentWindow,GWL_USERDATA
                            mov     edi,eax
                           .if     [eax.MdiStruct.hFile]!=0
                                invoke  hFilePositive
                            .endif
                    .endif                           
                     invoke  SendMessage,hMdi,WM_MDIDESTROY,hCurrentWindow,0
                     dec     noMdiChild
                     dec     MdiId
                     dec     RichEditId
                     dec     ToolbarId
                     pop     ecx
                     loop    loop_3
Title: Re: Edit control gets locked after file in Streamed in. Why?
Post by: xandaz on December 01, 2020, 12:01:02 AM
   Sorry for being so lowly gifted. Don't Bother peeking into the code. It has become too complex. Thanks anyway
Title: Re: Edit control gets locked after file in Streamed in. Why?
Post by: jj2007 on December 01, 2020, 12:03:35 AM
That has nothing to do with "lowly gifted". It has a lot to do with the total absence of comments. A few months from now, you will not be able to understand your own code.
Title: Re: Edit control gets locked after file in Streamed in. Why?
Post by: Vortex on December 01, 2020, 01:49:46 AM
Jochen mentioned about a very important principle of coding. Commenting can even take precedence over algorithm design as nobody can keep in my mind all the details of coding sessions.
Title: Re: Edit control gets locked after file in Streamed in. Why?
Post by: TimoVJL on December 01, 2020, 03:21:51 AM
Remember to CloseHandle() after streaming.
Title: Re: Edit control gets locked after file in Streamed in. Why?
Post by: xandaz on December 01, 2020, 04:34:34 AM
   should i close handle right after. Can't i do it when session ends? Thanks
Title: Re: Edit control gets locked after file in Streamed in. Why?
Post by: TimoVJL on December 01, 2020, 04:52:12 AM
After streaming file handle is useless.
Title: Re: Edit control gets locked after file in Streamed in. Why?
Post by: xandaz on December 01, 2020, 08:41:02 AM
    i thought i should keep the handle opened for future operations. Isn't that the standard procedure?
Title: Re: Edit control gets locked after file in Streamed in. Why?
Post by: xandaz on December 02, 2020, 07:08:23 AM
   Hey guys. Actually closing the handles simplified my task. ty guys. you're the best