I grabbed from example4 (MULTIWIN) and changed it around for my own evil editing purposes.. what I did, I commented out the child1 which uses the same hwnd as the main window, left child2 alone and created a runtime editbox control and put it on the main window.

I am subclassing the edit control, and it seems to work but when I click on my floating child2 system buttons such as the X to close or the _ to minimize around it doesn't get the message.. and yes I don't child2 to be clipped by my main window, I intend for it to be a pop-up frame&client (MDI child). Does it have to do with the HMENU?

what am I doing wrong? Run the program
Posted on 2004-04-06 23:55:20 by drarem
when the editbox doesn't have the focus (comment out the SetFocus in the subclassed proc), the pop-up window does respond to the CLOSE, MINIMIZE, MAXIMIZE, etc.. buttons
Posted on 2004-04-07 00:12:48 by drarem
change this line:
invoke ShowWindow,hWnd,SW_SHOWNORMAL
to:
invoke ShowWindow,hChild2,SW_SHOWNOACTIVATE

delete the following line in WndProc2:
invoke SetFocus,hwndEdit

delete the following line in EditWndProc:
xor eax,eax
Posted on 2004-04-07 02:33:31 by smurf
thanks, it works much better :)

I did it piecemail, I removed the xor eax,eax and the SetFocus.. now it works. Will have to research SW_SHOWNOACTIVE flag.
Posted on 2004-04-07 04:10:11 by drarem
Thanks for your help but now I have a new issue:

It works on windoze 2000 but not on XP. It does the EM_LINEFROMCHAR ok, eax is populated with the correct indexed line number, eg. 0,1,2,etc..
the EM_GETLINE always returns a blank line - in other words, it had no effect on the cmdLine() character buffer.

Here is the creation of the edit box:


.data
hwndEdit dd 0
guiEDIT db "EDIT",0
cmdLine db 128 dup (0)
..

.code
...
szText MainWindowTitle,"Main Window"

invoke CreateWindowEx,WS_EX_LEFT,
ADDR szClassName,
ADDR MainWindowTitle,
WS_OVERLAPPEDWINDOW,
Wtx,Wty,Wwd,Wht,
NULL,NULL,
hInst,NULL
mov hWnd,eax

sub Wwd,32
sub Wht,64
invoke CreateWindowEx,WS_EX_CLIENTEDGE,addr guiEDIT,NULL, WS_CHILD or WS_VISIBLE or ES_MULTILINE or WS_VSCROLL,
12,12,Wwd,Wht,hWnd,NULL,hInstance,NULL

mov hwndEdit,eax
invoke SetWindowLong,hwndEdit,GWL_WNDPROC,addr EditWndProc
mov OldWndProc,eax



and then there's the SendMessage API stuff from the subclassed EditWndProc..




EditWndProc proc hWin :DWORD,
uMsg :DWORD,
wParam :DWORD,
lParam :DWORD

LOCAL NDY:DWORD

.if uMsg==WM_CHAR
mov eax,wParam
push eax
.if al==VK_RETURN
invoke SendMessage, hwndEdit, EM_LINEFROMCHAR, -1, 0
mov NDY,eax

invoke SendMessage,hwndEdit,EM_GETLINE,NDY,addr cmdLine

<===== cmdLine is unchanged, as if the SendMessage,..,EM_GETLINE,.. had no effect on it.
..
..
..

Posted on 2004-04-10 18:28:18 by drarem
;//you need to set the first word in your buffer (cmdLine) to the max size the string you get from the edit box will be. this word will ultimately be overwritten by the string itself.
mov word ptr cmdLine, 128 ;//add this line
invoke SendMessage,hwndEdit,EM_GETLINE,NDY,addr cmdLine

not sure if this will solve ur problem. i dont have windows xp to test it on.
Posted on 2004-04-11 07:38:04 by smurf
wow you are awesome, thanks again :)

I had it prefilled with 127 spaces and a '0' at the end but having it initialized with 0's
and putting the number into the string works great.

Now to test on win2k again =)
Posted on 2004-04-11 18:58:53 by drarem