Вообщем это второй пример из книжки Васильченко использую Vs 2008 c PGIVisual Fortran 32 bit
| Код | module GUI_parameters use dfwin integer*4 hInst character*100 ClassName, WndName Integer*4 hWndMain end module GUI_parameters
integer*4 function WinMain(hInstance, hPrevInstance, lpszCmdLine, nCmdShow) !DEC$ ATTRIBUTES STDCALL, ALIAS: '_WinMain@16' :: WinMain use GUI_parameters integer*4 hInstance, hPrevInstance, nCmdShow, lpszCmdLine type(T_MSG) mesg lpszCmdLine =lpszCmdLine nCmdShow = nCmdShow hPrevInstance = hPrevInstance hInst = hInstance call OnInit(iret) if(iret.eq.0)then iq = MessageBox(NULL,"Невозможно зарегестрировать клас окна..."//" ПРограмма остановлена."C, "Ошибка"C, & INT4(IOR(MB_OK, MB_ICONSTOP))) WinMain = 0 return endif hWndMain = CreateWindowsEx(0, & ClassName, & WndName, & INT(WS_OVERLAPPEDWINDOW), & 0, & 0, & 350, & 150, & NULL, & NULL, & hInst, & NULL) iret = ShowWindow (hWndMain , SW_SHOWNORMAL) do while (GetMessage(mesg, Null,0 ,0 ).NE.0) i = TranslateMessage(mesg) i = DispatchMessage(mesg) end do WinMain = 0 return end subroutine OnInit(iret) use GUI_parameters integer*4 iret type(T_WNDCLASSEX) wc interface integer*4 function MainWndProc(hWnd, mesg, wParam, lParam) !DEC$ ATTRIBUTES STDCALL, ALIAS : '_MainWndProc@16' :: MainWndProc use GUI_parameters integer*4 hWnd, mesg, wParam, lParam end function MainWndProc end interface ClassName= "MinimalApp"C WndName = "Вычисление интеграл"C wc%cbSize =sizeof(wc) wc%style = IOR(CS_VREDRAW, CS_HREDRAW) wc%lpfnWndProc = LOC(MainWndProc) wc%cbClsExtra = 0 wc%cbWndExtra = 0 wc%hInstance = hInst wc%hIcon = LoadIcon(NULL, IDI_APPLICATION) wc%hCursor = LoadCursor(NULL, IDC_ARROW) wc%hbrBackground = GetStockObject(LTGRAY_BRUSH) wc%lpszMenuName = NULL wc%lpszClassName = LOC(ClassName) wc%hIconSm= LoadIcon(NULL, IDI_APPLICATION)
iret = RegisterClassEx(wc) return end integer*4 function MainWndProc(hWnd, mesg, wParam, lParam) !DEC$ ATTRIBUTES STDCALL, ALIAS : '_MainWndProcc@16' :: MainWndProc use GUI_parameters integer*4 hWnd, mesg, wParam, lParam select case(mesg) case(WM_DESTROY) call PostQuitMessge(0) MainWndProc=0 return case default MaainWndProc = DefWindowProc(hWnd, mesg, wParam, lParam) return end select return end
|
при компиляции возникает следующая проблема Argument number 1 to registerclassex: type mismatch Argument number 1 to registerclassex: type mismatch Illegal use of derived type Illegal argument to %VAL or %LOC Argument number 1 to registerclassex: type mismatch Argument number 1 to registerclassex: type mismatch Illegal use of derived type Illegal argument to %VAL or %LOC
все на 77 строке т.е. на iret = RegisterClassEx(wc)
|