More or less out of curiosity I started to try my luck with a full window-application. I used my old files from CVF as source and here is what I came up with - together with some weird error messages. This sample code will open a Window an write 'Hello world' to it.
!
! Programm Hellowin nach 'Windows-Programmierung',S.48
!
integer function winmain (hInstance, hPrevInstance, szCmdLine, nCmdShow)
!DEC$ ATTRIBUTES STDCALL, DECORATE, ALIAS:”WinMain” :: WinMain
use MyDFWINTY
implicit none
include <windows.ins>, nolist
interface
integer(HANDLE) function WndProc(hwnd, message, wPAram, lParam)
integer hwnd, message, wParam, lParam
end function WndProc
end interface
character*10 :: szAppName = 'HelloWin'
integer(HANDLE) hInstance, hPrevInstance
integer(3) szCmdLine
integer(3) nCmdShow
integer(HANDLE) hwnd
! wparam,lparam
integer irslt
logical lrslt
type (T_WNDCLASS) wndclass
type (T_MSG) msg
wndclass%style = ior(CS_Hredraw,CS_Vredraw)
wndclass%lpfnWndProc = loc(WndProc)
wndclass%cbClsExtra = 0
wndclass%cbwndextra = 0
wndclass%hInstance = hinstance
wndclass%hIcon = LoadIcon (NULL, IDI_APPLICATION)
wndclass%hCursor = LoadCursor (NULL, IDC_ARROW)
wndclass%hbrBackground = GetStockObject (WHITE_BRUSH)
wndclass%lpszMenuName = NULL
wndclass%lpszClassName = loc(szAppName)
irslt = RegisterClass (wndclass)
if (irslt.eq.0) then
irslt = MessageBox(NULL,'Fensterregistrierung fehlgeschlagen',szAppName,MB_IconError)
winmain = 0 ! <---- ERROR 1037
return
endif
hwnd = CreateWindowEX( CW_USEDEFAULT, &
szAppName, &
'Das erste echte Programm'C, &
int4(WS_OVERLAPPEDWINDOW), &
CW_USEDEFAULT, &
CW_USEDEFAULT, &
CW_USEDEFAULT, &
CW_USEDEFAULT, &
NULL, &
NULL, &
hInstance, &
NULL) ! <--- ERROR 283
lrslt = ShowWindow(hwnd,SW_SHOWNORMAL)
lrslt = UpdateWindow(hwnd)
do while (GetMessage(msg,NULL,0,0))
irslt = Translatemessage (msg)
irslt = Dispatchmessage (msg)
enddo
winmain = msg%wParam ! <---- ERROR 1037
return
end
On compiling I get three error messages, I indicated the flagged lines.
(twice) error 1037 - Variables with the EXTERNAL attribute, such as (RESULT of WINMAIN), cannot be in assignment expressions (with '=')
and
error 283 - INT4 must appear in a type declaration because IMPLICIT NONE has been used
I fail to see what would be wrong. Anybody else?
Cheers
Norbert