Do_OutpWin proc hParent:DWORD
LOCAL opwc:WNDCLASSEX

; register class
mov opwc.cbSize, sizeof WNDCLASSEX
mov opwc.style, CS_HREDRAW or CS_VREDRAW
mov opwc.lpfnWndProc, offset OpwProc
mov opwc.cbClsExtra, NULL
mov opwc.cbWndExtra, NULL
m2m opwc.hInstance, hInstance
mov opwc.hbrBackground, COLOR_APPWORKSPACE
mov opwc.lpszMenuName, NULL
mov opwc.lpszClassName, offset OutpClass
invoke LoadCursor,NULL,IDC_ARROW
mov opwc.hCursor, eax

invoke RegisterClassEx, ADDR opwc
.if eax==0
szText error,"error loading outpwinclass"
invoke MessageBox,hParent,addr error,addr szDisplayName,MB_OK or MB_ICONERROR
.endif

; create the window
invoke CreateWindowEx,WS_EX_TOOLWINDOW,\
addr OutpClass,
addr OutpName,WS_CHILD,\
0,0,500,40,\
hParent,NULL,hInstance,NULL
mov hOutpWin,eax

ret
Do_OutpWin endp

I was trying to make this output window for my editor, and have trapped my error. The reason its not working is the class isnt getting registered, hence the invoke MessageBox tells me that eax==0 after i call registerclassex. Anyone have an idea on why this class isnt getting registered?

Thanks
Posted on 2001-07-21 11:06:25 by karl
add this where you fill your windowclass:
mov   opwc.hIcon,NULL
and then it should work :alright:
Posted on 2001-07-21 11:23:29 by savage
Nope, no luch there either, sill getting the damn messagebox

What else u think it could be?
Posted on 2001-07-21 11:26:15 by karl
Maybe you should set the hIconSm member to NULL as well. As the structure is local, this member can be anything and registerclassex will see it as an invalid handle..

Thomas
Posted on 2001-07-21 11:56:57 by Thomas
Since your structure is located on the stack it will be filled with junk. You have to set all unused members to 0s. I recommend putting this right after the definition:


push edi
xor eax, eax
mov ecx, sizeof opwc
lea edi, [opwc]
rep movsb
pop edi


This successfully clears the WNDCLASSEX structure before you fill it in. Put it right after your LOCAL declaration.
Posted on 2001-07-21 13:06:04 by comrade
Okay, I've tried and tried, and this program is crashing. I'm even using the proc RegisterWinClass, that my program uses to register the main window. I'm getting an invalid page fault, and when i open up the debugger it says stack overflow. I'm getting really confused at this point.

I have zipped it up. Very small, not anything at all really added to the prostart code except optwin.asm. Someone help me please ;)

Thanks
Posted on 2001-07-21 15:14:44 by karl
here it is.. my computer froze and said "not enough memory", sorry
Posted on 2001-07-21 15:19:18 by karl
Hi Karl
Just dl your code.

You must add a ret here and there to avoid those nasty
GPF's

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

invoke DefWindowProc,hWin,uMsg,wParam,lParam

ret <----

OpwProc endp
Posted on 2001-07-21 19:42:38 by Unregistered
Thanks! That fixed the crash, but the window doesnt show up, all though the class for the output win now does register successfully. Hmm, still no window showing tho... right now, its sized to take up the whole client area, but i'll fix that once i can get it to pop up.. Any suggestions on whats wrong now?
Posted on 2001-07-21 20:04:12 by karl
You also need to set some styles when you
create your output win

WS_CHILD or WS_VISIBLE or WS_CAPTION

Shold solve your problem
Posted on 2001-07-21 20:36:18 by Unregistered
Holy shit it works!! ;)
Thanks SOOOO much
Now, another question I know that you can answer ;) how do make it dock to the bottom? just like the output win on yer IDE, I love your setup!!

THanks
Posted on 2001-07-21 20:43:23 by karl
In RadASM I am using a MDi window. Normaly a window
cannot be a child of another window. (Will not get focus).
The docked windows in RadASM is a fake created by drawing
a caption and a close button. Else there is only a matter of
resizing.
Posted on 2001-07-21 20:55:56 by Unregistered
Thanks!!

Works like a charm now..
Posted on 2001-07-21 22:53:20 by karl