flat assembler
Message board for the users of flat assembler.

Index > Windows > create window for "RichEdit20A" problem

Author
Thread Post new topic Reply to topic
vbVeryBeginner



Joined: 15 Aug 2004
Posts: 884
Location: \\world\asia\malaysia
vbVeryBeginner 03 Nov 2004, 03:24
hi,
this should be simple, but i just can't figure out why the rich edit cannot be created?

Code:
section '.data' data readable writeable
  ctlDllNameRe2   db 'riched20.dll',0
       ctlClsNameEdit  db 'EDIT',0
       ctlClsNameRe2   db 'RichEdit20A',0
    


library had been successfully loaded
Code:
invoke       LoadLibrary,ctlDllNameRe2
    


in the WM_CREATE message part
Code:
wmCREATE:
              invoke  CreateWindowEx,WS_EX_CLIENTEDGE,ctlClsNameEdit,NULL,\
                      WS_VISIBLE or WS_CHILD or ES_MULTILINE or WS_VSCROLL or WS_HSCROLL,\
                       CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,\
                  [hWnd],100,[insH],0
                 cmp  eax,NULL
                       jne  @f
             invoke  MessageBox,NULL,wndTitle,wndTitle,MB_OK
             @@:
                     mov  [re2H],eax
             invoke  CreateWindowEx,WS_EX_CLIENTEDGE,ctlClsNameRe2,NULL,\
                       WS_VISIBLE or WS_CHILD or ES_MULTILINE or WS_VSCROLL or WS_HSCROLL,\
                       CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,\
                  [hWnd],101,[insH],0
                 cmp  eax,NULL
                       jne  @f
             invoke  MessageBox,NULL,wndClsName,wndClsName,MB_OK
         @@:
                     jmp  wmBYE
    


the ordinary EDIT control could be created and no message pop up for wndTitle, but message pop up for the wndClsName which notifies that NULL was returned for the ctlClsNameRe2!

did i miss anything? or ... ? i think it is weird.
Post 03 Nov 2004, 03:24
View user's profile Send private message Visit poster's website Reply with quote
vbVeryBeginner



Joined: 15 Aug 2004
Posts: 884
Location: \\world\asia\malaysia
vbVeryBeginner 03 Nov 2004, 07:41
hi,
i found the solution but it looks quite weird and i don't know why!

Code:
        invoke  LoadLibrary,ctlDllNameRe2 ; --------------------> Line A
 invoke  CreateWindowEx,0,\
         wndClsName,wndTitle,\
              WS_OVERLAPPEDWINDOW + WS_VISIBLE,\
         CW_USEDEFAULT,CW_USEDEFAULT,400,240,\
              NULL,NULL,[insH],NULL
               mov  [wndH],eax
     invoke  LoadLibrary,ctlDllNameRe2 ; --------------------> Line B

window_message_loop_start:
....
    


ideally, the api LoadLibrary whether invoke from Line A or Line B should work as expected because the return value is NOT NULL but somehow, if we invoke LoadLibrary after we invoke CreateWindowEx, the below code then won't work! CreateWindowEx would return NULL.

Code:
wmCREATE:
              invoke  LoadLibrary,ctlDllNameRe2 ; --------------------> Line C
         invoke  CreateWindowEx,WS_EX_CLIENTEDGE,ctlClsNameRe2,0,\
                  WS_CHILD + WS_VISIBLE + ES_MULTILINE + WS_VSCROLL + WS_HSCROLL,\
                   0,0,0,0,\
                  [hWnd],200,[insH],0
                 cmp  eax,NULL
                       jne  @f
             invoke  MessageBox,NULL,wndTitle,wndTitle,MB_OK
             @@:
                     mov  [re2H],eax
                     jmp  wmBYE

    


Line A and Line C would works as expected but not Line B
maybe it is a bug on my windows 95?
Post 03 Nov 2004, 07:41
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 03 Nov 2004, 09:42
well, this is the feel of true windows coding - you do it other way than showed in M$ examples and it doesn't work even if it should due to documentation. It is even bigger fun with directX.
Post 03 Nov 2004, 09:42
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
crc



Joined: 21 Jun 2003
Posts: 637
Location: Penndel, PA [USA]
crc 03 Nov 2004, 12:10
Quote:
well, this is the feel of true windows coding - you do it other way than showed in M$ examples and it doesn't work even if it should due to documentation.


Vid is very accurate on this: I spent several hours working to get my Win32 console programs working under all versions of Windows, only to discover that the documentation and the implementation details don't always match up Sad They don't make life easy for us assembly programmers.
Post 03 Nov 2004, 12:10
View user's profile Send private message Visit poster's website Reply with quote
vbVeryBeginner



Joined: 15 Aug 2004
Posts: 884
Location: \\world\asia\malaysia
vbVeryBeginner 04 Nov 2004, 03:19
maybe there should be a site contained information on weird windows api! if it is weird, i guess it should be bug :p
Post 04 Nov 2004, 03:19
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.