Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Problem creating child windows

michael_green
Beginner
550 Views

This stuff is new for me, so please forgive dumb questions ...

In a test program I am trying to learn about creating child windows, based upon a C example I found in the VS2005 documentation ("Using windows/Creating, Enumerating, and Sizing Child windows")

My code is:

case (WM_CREATE)

do i = 0,2

ret = CreateWindowEx(0, &

"ChildWClass"C, &

""C, &

IOR(WS_CHILD,WS_BORDER), &

0,0,0,0, &

ghWndMain, &

(ID_FIRSTCHILD + i), &

ghInstance, &

null)

write(errcode,'(I6)')GetLastError()

end do

It doesn't work, of course, and returns a code of 1406 "Cannot create a top level child window". What am I doing wrong?

With many thanks in advance

Mike

0 Kudos
1 Reply
Jugoslav_Dujic
Valued Contributor II
550 Views
IsWindow(ghwndMain)? 
I betcha not. I have a hunch that you have elsewhere:
ghwndMain = CreateWindowEx(...)
ghwndMain is assigned a value after CreateWindowEx returns, but WM_CREATE is sent during CreateWindowEx. Instead, of ghwndMain, you need to use hWnd (the argument of WndProc)
0 Kudos
Reply