hi

i want to create a richedit on a winsock event (FD_ACCEPT)
but the createwindowexa crash.
here is my code :
@msg_sock	:

...
mov eax,lParam
cmp ax,FD_ACCEPT
jz @SockAccept
...
@SockAccept :
mov linger_.l_onoff, 1
mov linger_.l_linger, 0
invoke setsockopt, hSock, SOL_SOCKET, SO_LINGER, addr linger_, sizeof linger_
cmp eax,0
jnz @bug
mov sizesin_in,sizeof sin_in
invoke accept, hSock, addr sin_in, addr sizesin_in
cmp eax,INVALID_SOCKET
jz @bugSock
mov hSockClient,eax
invoke CreateWindowExA, WS_EX_CLIENTEDGE, addr RichEdit, 0, WS_CHILD or WS_VISIBLE or ES_MULTILINE \
or ES_WANTRETURN or ES_NOHIDESEL or WS_HSCROLL or WS_VSCROLL, \
0, 0, 600, 200, hwnd, 300, hInstance, 0
cmp eax,0
jz @bug
mov hChatEdit1,eax
ret

I've Already loaded Riched20.dll in initialisation and I've put "RICHED20A" for Class.

Why FD_ACCEPT or any other winsock message can't accept richedit creation??? (i've try with FD_CONNECT, FD_READ)

thank you
Posted on 2001-11-24 16:43:25 by gael
oups "RICHEDIT20A" for class
Posted on 2001-11-24 16:56:25 by gael
I don't know if this is the problem but make sure you load the riched20.dll before you try and create a rich edit control.



szText ReDLL,"RICHED20.DLL"
invoke LoadLibrary,ADDR ReDLL


Regards,

hutch@movsd.com
Posted on 2001-11-24 16:56:36 by hutch--
but I've already loaded riched20.dll here :


.DATA

RichEdit db "RICHEDIT20A",0
DllRichEdit db "RichEd20.dll",0

.CODE
invoke GetModuleHandleA, 0
mov hInstance,eax
invoke DialogBoxParamA, hInstance, addr DialogBox, 0, addr DialProc, 0
invoke ExitProcess, 0

DialProc proc uses ebx ecx hwnd:DWORD, uMsg:DWORD, wParam:DWORD, lParam:DWORD
mov eax,uMsg
cmp eax,WM_COMMAND
jz @msg
cmp eax, WM_SOCKET
jz @msg_sock
cmp eax,WM_INITDIALOG
jz @ini
...

@ini :
...
invoke LoadLibraryA, addr DllRichEdit ; [COLOR=red]<< HERE[/COLOR]
cmp eax,0
jz @bug
...
ret

@msg :
mov eax,wParam
cmp eax, 101
jz @listen
ret
@listen :
...listen here...
ret

@msg_sock :
mov eax,lParam
and eax,0FFFF0000h
cmp eax,0
jnz @bug
mov eax,lParam
cmp ax,FD_ACCEPT
jz @SockAccept
cmp ax, FD_CONNECT
jz @SockCon
cmp ax, FD_READ
jz @SockRead
cmp ax, FD_CLOSE
jz @SockClose
jmp @bugSock

@SockAccept :
mov linger_.l_onoff, 1
mov linger_.l_linger, 0
invoke setsockopt, hSock, SOL_SOCKET, SO_LINGER, addr linger_, sizeof linger_
cmp eax,0
jnz @bug
mov sizesin_in,sizeof sin_in
invoke accept, hSock, addr sin_in, addr sizesin_in
cmp eax,INVALID_SOCKET
jz @bugSock
mov hSockClient,eax

invoke LoadLibraryA, addr DllRichEdit ; [COLOR=red]<< HERE[/COLOR]
invoke CreateWindowExA, WS_EX_CLIENTEDGE, addr RichEdit, 0, WS_CHILD or WS_VISIBLE or ES_MULTILINE \
or ES_NOHIDESEL or WS_HSCROLL or WS_VSCROLL, \
0, 0, 600, 200, hwnd, 0, hInstance, 0
cmp eax,0
jz @bug
mov hChatEdit1,eax
ret

If i replace Richedit20A class by EDIT, BUTTON class it work fine.
If i create Richedit in initialisation (@ini after LoadLibraryA) it work fine.

If i try to create by clicking on a button it work fine.

It seems that it's related to winsock message. FD_ACCEPT, FD_READ or FD_CONNECT.

I've version 5.30.23.1200 of riched20.dll in French win2k version.

:mad:
Posted on 2001-11-24 19:35:52 by gael