- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there,
in my prog I place a number of windows on my screen. For all except one everything works fine, but for the last one CreateWindow neither returns a handle nor an error code. See this excerpt here:
character*30 :: ccDatenfensterClass = 'DatenfensterClass'C
character*30 :: ccKartenfensterClass = 'KartenfensterClass'C
character*30 :: ccKontrollfensterClass = 'KontrollfensterClass'C
character*30 :: ccStatusfensterClass = 'StatusfensterClass'C
----
cWindowClass = ccDatenFensterClass
tWndClass%style = ior(CS_HREDRAW, CS_VREDRAW)
tWndClass%lpfnWndProc = loc(DatenWndProc)
tWndClass%cbClsExtra = 0
tWndClass%cbWndExtra = 0
tWndClass%hInstance = hhInstance
tWndClass%hIcon = NULL
tWndClass%hCursor = LoadCursor (NULL, IDC_ARROW)
tWndClass%hbrBackground = GetStockObject (WHITE_BRUSH)
tWndClass%lpszMenuName = NULL
tWndClass%lpszClassName = loc (cWindowClass)
iRslt = RegisterClass (tWndClass)
! Mitte Oben: "Kartenfenster"
cWindowClass = ccKartenfensterClass
tWndClass.lpfnWndProc = loc (KartenWndProc)
tWndClass.lpszClassName = loc (CWindowClass)
iRslt = RegisterClass (tWndClass)
! Rechte Seite : "Kontrollfenster"
cWindowClass = ccKontrollfensterClass
tWndClass.lpfnWndProc = loc (KontrollWndProc)
tWndClass.lpszClassName = loc (CWindowClass)
iRslt = RegisterClass (tWndClass)
! Unterer Bereich : "Statusfenster"
cWindowClass = ccStatusfensterClass
tWndClass.lpfnWndProc = loc (StatusWndProc)
tWndClass.lpszClassName = loc (CWindowClass)
iRslt = RegisterClass (tWndClass)
------
!--------------------------------------------------------------------
! Einrichten des Kontrollfensters
!--------------------------------------------------------------------
iKontrollTop = 0
iKontrollWidth = (iWinWidth - iKarteWidth) / 2
iKontrollHeight = iWinHeight / 2
iKontrollLeft = iWinWidth - iKontrollWidth
iStyle = ior (WS_CHILDWINDOW, WS_VISIBLE) ! Einrichten als ChildWindow
iiWindowCount = iiWindowCount + 1
iiKontrollHandle = CreateWindow (ccKontrollFensterClass, &
''C, &
iStyle, &
iKontrollLeft, &
iKontrollTop, &
iKontrollWidth, &
iKontrollHeight, &
hWnd, &
iiWindowCount, &
hhInstance, &
NULL)
print *,' iiKontrollHandle = ', iiKontrollHandle
iRslt = ShowWindow(iiKontrollHandle, SW_SHOWNORMAL)
iRslt = UpdateWindow (iiKontrollHandle)
!--------------------------------------------------------------------
! Einrichten des Statusfensters
!--------------------------------------------------------------------
iStatusTop = iWinHeight / 2
iStatusWidth = (iWinWidth - iKarteWidth) / 2
iStatusHeight = iWinHeight / 2
iStatusLeft = iWinWidth - iStatusWidth
iStyle = ior (WS_CHILDWINDOW, WS_VISIBLE) ! Einrichten als ChildWindow
iiWindowCount = iiWindowCount + 1
iiStatusHandle = CreateWindow (ccStatusFensterClass, &
''C, &
iStyle, &
iStatusLeft, &
iStatusTop, &
iStatusWidth, &
iStatusHeight, &
hWnd, &
iiWindowCount, &
hhInstance, &
NULL)
iRslt = GetLastError ()
print *,' LastError = ', iRslt
print *,' iiStatusHandle = ', iiStatusHandle
iRslt = ShowWindow(iiStatusHandle, SW_SHOWNORMAL)
iRslt = UpdateWindow (iiStatusHandle)
The prints in line #104 and #105 both yield zero while the window before that ("Kontrollfenster") works just fine. The debugger shows all parameters as they are expected to be.
Any Idea on where to start to pinpoint this bug?
Cheers
PF
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Got it!
This is not an issue with CreateWindow but with the windows procedure attached to the window to be created.
It happens, when the call to DefWindowProc is not performed for unprocessed messages. I had this call in the wrong line.
Problem solved.
Cheers
PF
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
CreateWindow returns something - what is it? Zero?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes. It returns 0. See attched screenshot of the print to screen.
PF
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Got it!
This is not an issue with CreateWindow but with the windows procedure attached to the window to be created.
It happens, when the call to DefWindowProc is not performed for unprocessed messages. I had this call in the wrong line.
Problem solved.
Cheers
PF

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page