- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
integer*4 function WinMain( hInstance, hPrevInstance, lpszCmdLine, nCmdShow )
!DEC$ IF DEFINED(_X86_)
!DEC$ ATTRIBUTES STDCALL, ALIAS : '_WinMain@16' :: WinMain
!DEC$ ELSE
!DEC$ ATTRIBUTES STDCALL, ALIAS : 'WinMain' :: WinMain
!DEC$ ENDIF
But the compiler returns error:
Linking...
dfqwin.lib(qwkentry.obj) : error LNK2005: _WinMain@16 already defined in MainProgram.obj
dformt.lib(DFORMAIN.OBJ) : error LNK2001: unresolved external symbol _MAIN__
The WinMain is defined only once in the .f90 file and the interface to WinMain is written once in the .fi file as follows:
!DEC$ FREEFORM
interface
integer*4 function MainWndProc ( hwnd, mesg, wParam, lParam )
!DEC$ IF DEFINED(_X86_)
!DEC$ ATTRIBUTES STDCALL, ALIAS : '_MainWndProc@16' :: MainWndProc
!DEC$ ELSE
!DEC$ ATTRIBUTES STDCALL, ALIAS : 'MainWndProc' :: MainWndProc
!DEC$ ENDIF
integer*4 hwnd
integer*4 mesg
integer*4 wParam
integer*4 lParam
end function
end interface
So I dont understand why I get the compiler error. Perhaps WinMain is also defined in one of the libraries I use? But I use only user32, kernel32, and dialogm. Could you please help?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Using the Menu
To use a menu bar in your Fortran application, you must load the menu resource and use it when creating the main window of the application. Code to do this is created automatically by the Fortran Windows AppWizard. The code that loads the menu resource is:
ghMenu = LoadMenu(hInstance, LOC(lpszMenuName))
The returned menu handle is then used in the call to CreatWindowEx:
ghwndMain = CreateWindowEx( 0, lpszClassName, &
lpszAppName, &
INT(WS_OVERLAPPEDWINDOW), &
CW_USEDEFAULT, &
0, &
CW_USEDEFAULT, &
0, &
NULL, &
ghMenu, &
hInstance, &
NULL &
)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
type (T_WNDCLASS) wc character*100 lpszClassName, lpszIconName, lpszMenuName, lpszAppName
character*100 lpszAcceltabname, lpszChildClassNAme
... ... lpszAcceltabname="MyAccelerator"C lpszClassName ="Myclass"C lpszAppName ="My program"C lpszMenuName ="Mymenu"C lpszIconName ="MyIcon"C ! Register the MAIN window class, if not already ! registered by a previous instance if(hPrevInstance .eq. 0) then wc%lpszClassName = LOC(lpszClassName) wc%lpfnWndProc = LOC(MyWndProc) wc%style = IOR(IOR(CS_VREDRAW , CS_HREDRAW),CS_OWNDC) wc%hInstance = hInstance wc%hIcon = LoadIcon( hInstance, LOC(lpszIconName)) wc%hCursor = LoadCursor( NULL, IDC_ARROW ) wc%hbrBackground = ( COLOR_WINDOW+1 ) wc%lpszMenuName = 0 wc%cbClsExtra = 0 wc%cbWndExtra = 0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I find your quickwin program helpful. Could you please list some codes of menu callback routines for your program? Coming from the world of Lahey, I am new to IVF and programming menus has given me a hard time. A concrete example would definitely help. Thanks in advance.
Mao
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mao

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