- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear everybody:
Is it possible to change the number and the size of parts in the status bar of the main QuickWin window? I have Compaq Visual Fortran 6.6A.
Is it possible to change the number and the size of parts in the status bar of the main QuickWin window? I have Compaq Visual Fortran 6.6A.
Link Copied
- « Previous
-
- 1
- 2
- Next »
28 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve,
That's what I'm having trouble with... Win32 API calls. I don't understand how they are doneor knowhow to take a Win32 object like the statusbar and pop it into QuickWin:(
I'll be honest. I'm a newbie to programming. I'm taking a book (the only one I could find on Visual Fortran) and trying to write anew program with it. This program is a rewrite of an older program written in a very old version of Microsoft Fortran. I've never wrote, messed with,or studieda program with Win32 calls in it. This is my first time everdealing withthis. It's something I've heard about but have somehow missed until now. Now, there is this new method of programming, OOP, which is a part of .NET and developers are making Win32 API calls. This Win32 API thing reminds me of a trip to StarBucks. There are hundreds eventhousands ofways to have yourbeverage prepared. It blows the mind all the options that you have available to you... more options than you could reasonablyput into a manual. The same thing is true of Win32 API from what I've been told.
Believe me when I say I have purchased books and books and books... spent hundreds... trying toincrease mydeveloping knowledge from what I was shown in college. It just seems that all my efforts to keep up with the times are fruitless. All the books I have now are out dated in view of the fact that they do not cover OOP or Win32 API. They were all purchased on the basis of what companies were using in-house... out-dated systems. Now, I'm dealing with something that is not out-dated for the first time... and I'm unprepared :(
Sorry... I'm venting... I know this isn't a forum for cheese and wine, but I'm frustrated. Everyone makes it sound so simple to just pop in some code and shazam it works.I wish I could do the same. I'm new to this.I'm the little dog trying to communicatewith and understandthe big dogs who know their stuff.
Moral of the story... I could really use the help. It is my intention to become one of the big dogs in time, and like you help thelittle dogs get over hurdles by contributing to this forum.
Regards,
Chad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well, you are certainly jumping into the harder parts of Win32 UI work by trying to change the QuickWin status bar.
If all you want to do is a dialog, see the User manual chapter on using dialogs with module IFLOGM. I would maintain, based on what you describe, that QuickWin is not what you want to use. Start with a pure Win32 application - the project wizard will create a simple one for you - and extend it as needed. Lawrence's book is very good at this.
But you are right - Win32 is very complex, and if you're new to programming in general, that will make it that much harder. It's rare that you can just plop some code in that you found elsewhere and make it work.
What does this old PowerStation program do? Is it QuickWin?
If all you want to do is a dialog, see the User manual chapter on using dialogs with module IFLOGM. I would maintain, based on what you describe, that QuickWin is not what you want to use. Start with a pure Win32 application - the project wizard will create a simple one for you - and extend it as needed. Lawrence's book is very good at this.
But you are right - Win32 is very complex, and if you're new to programming in general, that will make it that much harder. It's rare that you can just plop some code in that you found elsewhere and make it work.
What does this old PowerStation program do? Is it QuickWin?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Man, I wish it was QuickWin. This would make it easier to modify. From what I can understand of the code left, it was written during a time when there was no GUI and Microsoft Fortran was available. There are statements in the code to actually draw the button and then make it a hotspot. It even monitors the coordinates of the mouse to determine what button was clicked. When the program is run, it has the same look as the MS-DOS editor of old. To complicate things, functions that would normally be a subroutine or another file added on to the project are actually compiled into individual programs. Instead of having one project with several files or modules within it, I have a project calling several files to perform various functions.
My task is to take this spaghetti code and get it back to something more manageable and keep it in the same language as originally used, Fortran. Since theredoesn't seem to be a way to actually convert the program from it's current state into a GUI program environment, I'm creating a program from scratch but designing the needed features of the old one into the new one.
The program program basically displays aregion of the world,and the user has the ability to make modifications to the water features on that map. One of the featuresof the program is to inform the user where the mouse islocated in respect to themap coordinates... latitude and longitude. The old program had a block in the upper right corner that displayed the latitude and longitude of the mouse in respect to the world. My thought is to modify the statusbar and display it at the bottom. It's in a different location, but the user will still have the information available.
When I started researching and learning how to put together a GUI application in Fortran, I found out that QuickWin is easier to use to create an application than Win32. I tried to create a Win32 application but got lost in the code. I found out that QuickWin provides a status bar by default, but it didn't seem like it could be modified. That's when I searched the forum and found the posting from Jugoslav. He had written code that allowed him to call the Win32 status bar in a QuickWin application. Unfortunately, the attachment to his message is no longer available, and you had mentioned that he is going to be offline for a while... so... I'm trying to see examples from other developers that show calls to Win32 components in a QuickWin application. I'm hoping that from looking at these examples I could apply the same concepts to calling the status bar in my application. Once successfully called, I can modify it to display the longitude and latitude of the mouse on the map.
Sorry if it sounded like I was trying to create the dialog box in my program. I was only looking to see how that Win32 component was being called and comparing it to the code in Jugoslav's sample for calling the toolbar to see what was similar between the two. That similarity would probably be the likely components that I would need to use in calling the Win 32 status bar in my program.
Regards,
Chad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well, this is not my area of expertise, but I would suggest:
1. Do try to use QuickWin - it will probably help you.
2. Forget for now about the status bar. Put your information somewhere else.
I'll let others suggest how to manage that.
1. Do try to use QuickWin - it will probably help you.
2. Forget for now about the status bar. Put your information somewhere else.
I'll let others suggest how to manage that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you are going to do Win32 API programming, getting the book "Programming Windows 95" by Petzold will help a lot. It's written from the C programmers perspective, but it will give you a better understanding of how the API works. It's almost 10 years old (and the original Programming Windows 3.1 was older still), but not much has changed in the world of Win32 User Interface programming. I don't think there have been any more recent works of note (I guess all the C programmers have moved on to MFC, then ATL/COM, then .Net WinForms, etc.)
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As a work-around, If you want to display your own stuff in the quickwin status bar, include the following interface block into your calling program:
Code:
! internal QuickWin routine to set status bar at screen bottom interface integer*4 function setstatusbar(msg) !DEC$ IF DEFINED (_X86_) !dec$ attributes C, alias: "__QWINTSetStatusBar" :: setstatusbar !DEC$ else !dec$ attributes C, alias: "_QWINTSetStatusBar" :: setstatusbar !DEC$ endif integer msg ! to hold address of string end function setstatusbar end interface
You then compose the message you want to display (a character string) and then use:
CHARACTER*120 STATMESS (for example)
...
...
! Set the status bar
STATMESS='No Input File Chosen..Use ''FILE'' Dialog to Select a File'
STATMESS=ADJUSTL(ADJUSTR(STATMESS))
RETINT=SETSTATUSBAR(%LOC(STATMESS))
STATMESS='No Input File Chosen..Use ''FILE'' Dialog to Select a File'
STATMESS=ADJUSTL(ADJUSTR(STATMESS))
RETINT=SETSTATUSBAR(%LOC(STATMESS))
If you want different sections of the status bar to be independently set, you can divide the character string into sections by defining an array of character strings and just changethe contents of anarray element to suit, then copy the whole character array to a single character variable whose location is then supplied using SETSTATUSBAR.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I began to wonder why the code that Jugislav posted didn't work for you, so I played with it myself. The code posted below works and you are welcome to copy and paste whatever you need. I use CVF 6.6c and I had to do several modifications first.
I had to find an Interface block for CreatStatusWindow, which I found in COMCTL32.F90. You could just add a USE COMCTL32 to get this included automatically in future. Also, WM_CREATESTATUS is not defined in my version, so I made use of the availability of user-defined application-specific messages that WIndows allows, starting at a defined number WM_APP. So I replaced WM_CREATESTATUS with WM_APP+1 as the message sent to cause the status bar to be created.
The subclassing of the QuickWin MDI client window (which 'owns' the status bar window) is done as per Jugoslav's code, with the location of the default (original) window procedure stored in hWndProc in COMMON/ handletoproc/ so that it can be made available to the new window procedure, which I have named MyWndProc. The latter procedure then handles ALL the messages for the QuickWin windows - including the status bar - and, as I posted earlier, MUST contain a CASE DEFAULT call to the original window procedure to pass on all messages that you do not specifically deal with yourself. This is important, otherwise the QuickWIn windows cease to function as all its other messages have nowhere to go to be processed....
The message to create the status bar is handled via the CASE (WM_APP+1) statement in MyWndProc, as you see. I was unsure what 'jwidth' should be as it was not defined in the posted code, but since all the other values derived from it are probably locations in pixel numbers, I just chose a value that ensured that these values were positive. You can play with this value at your will and see what happens. To prove that the code worked, I attach a JPG of the start of the new status bar located below the main QUickWin window..
Finally, make sure all handles are defined as INTEGER*4, and I also recommend always to include IMPLICIT NONE to catch undefined variables and variables used before being defined in your code.
Code:
!Main program containing loop to allow menus to be used USE DFLIB USE DFWIN ! COMMON/HANDLETOPROC/ hWndProc ! LOGICAL CHECKED LOGICAL*4 RESULT, NEWT INTEGER*4 I4, RETINT, HWND, NUMARG, LENGTH INTEGER*2 IVID, ISTATUS INTEGER*4 IST, HSTATUS, HFRAME, HMDI, HWNDPROC, HWNDPREV CHARACTER*120 STATMESS CHARACTER($MAXPATH) DIR, NAME, HELPFIL, BUFFER, NEWTITLE CHARACTER*4 EXT CHARACTER*3 DRIVE CHARACTER*20 RETHANDLE ! interface integer function MyWndProc( hWnd, message, wParam, lParam) !DEC$ IF DEFINED(_X86_) !DEC$ ATTRIBUTES STDCALL, ALIAS : '_MyWndProc@16':: MyWndProc !DEC$ ELSE !DEC$ ATTRIBUTES STDCALL, ALIAS : 'MyWndProc' :: MyWndProc !DEC$ ENDIF integer hWnd, message, wParam, lParam end function end interface ! internal QuickWin routine to set status bar at screen bottom interface integer*4 function setstatusbar(msg) !DEC$ IF DEFINED (_X86_) !dec$ attributes C, alias: "__QW INTSetStatusBar" :: setstatusbar !DEC$ else !dec$ attributes C, alias: "_QWINTSetStatusBar" :: setstatusbar !DEC$ endif integer msg ! to hold address of string end function setstatusbar end interface ![ irrelevant code omitted from here.....] ! Destroy the QUICKWIN Status bar ! hFrame=GETHWNDQQ(QWIN$FRAMEWINDOW) hMDI=FindWindowEx(hFrame,NULL,LOC('MDIClient'C),NULL) hStatus=GetWindow(hMDI,GW_HWNDNEXT) iSt=DestroyWindow(hStatus) iSt=SendMessage(hStatus,WM_CLOSE,0,0) ! ! THEN subclass the window ! get the handle to the window procedure and put it into ! variable HWNDPROC in COMMON/HANDLETOPROC/ HWNDPROC=SetWindowLong(hFrame, GWL_WNDPROC, LOC(MyWndProc)) ! Create a new status window...Define an application specific-message WM_APP+1 ! iSt=SendMessage(hFrame,WM_APP+1,0,0) ! ! Start endless loop to let QuickWin menus take over DO WHILE(.TRUE.) CALL YIELDQQ END DO END !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! MyWndProc !! !! This is the new window procedure !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! integer function MyWndProc ( hWnd, mesg, wParam, lParam ) !DEC$ IF DEFINED(_X86_) !DEC$ ATTRIBUTES STDCALL, ALIAS : '_MyWndProc@16':: MyWndProc !DEC$ ELSE !DEC$ ATTRIBUTES STDCALL, ALIAS : 'MyWndProc' :: MyWndProc !DEC$ ENDIF use dflib use dfwin implicit none INTERFACE FUNCTION CreateStatusWindow( & style, & lpszText, & hwndParent, & wID) USE DFWINTY integer(HANDLE) :: CreateStatusWindow ! HWND !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'CreateStatusWindowA' :: CreateStatusWindow integer(LONG) style ! LONG style !DEC$ ATTRIBUTES REFERENCE, ALLOW_NULL :: lpszText character*(*) lpszText ! LPCSTR lpszText integer(HANDLE) hwndParent ! HWND hwndParent integer(UINT) wID ! UINT wID END FUNCTION END INTERFACE ! ! internal QuickWin routine to set status bar at screen bottom interface integer*4 function setstatusbar(msg) !DEC$ IF DEFINED (_X86_) !dec$ attributes C, alias: "__QWINTSetStatusBar" :: setstatusbar !DEC$ else !dec$ attributes C, alias: "_QWINTSetStatusBar" :: setstatusbar !DEC$ endif integer msg ! to hold address of string end function setstatusbar end interface common/handletoproc/ hWndProc ! locates previous (default) window procedure integer*4 hWnd, hWndloc,hWndProc, hWndcapture, hStatus, isbfieldpos(5), jwidth, ist integer*4 mesg, mesgloc integer*4 wParam, wParamloc integer*4 lParam, lParamloc integer*4 pHI ! pointer to HELPINFO structure needed by WM_HELP command character*20 hWndchar, hFramechar character*20 ictypchar, ictrlchar, itemhandchar, contidchar character($maxpath) message ! integer*4 retint, rethelp, ctrlid, hWndframe ! select case ( mesg ) ! Process the Status bar creation message CASE (WM_APP+1) hStatus=CreateStatusWindow(IOR(WS_CHILD,WS_VISIBLE), 'Text test of status bar'c,hWnd,0) jwidth=400 iSBFieldPos(5)=jWidth-20 iSBFieldPos(4)=jWidth-100 iSBFieldPos(3)=jWidth-180 iSBFieldPos(2)=jWidth-260 iSBFieldPos(1)=160 iSt=SendMessage(hStatus,SB_SETPARTS,5,LOC(iSBFieldPos)) iSt=ShowWindow(hStatus,SW_SHOW) MyWndProc=0 ! DEFAULT PROCESSING case default ! Let the default window proc handle all other messages MyWndProc = CallWindowProc(hWndProc, hWnd, mesg, wPar am, lParam ) end select return end function MyWndProc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry... I've been out of the office the last couple of days... I wanted to post my thanks to the latest responses...
John,
Thanks for the book reference. I'll definitely look into getting it since I need some help in getting a handle on how to call API routines and utilize them in my code.
Anthony,
Thanks for providing the code example of the status bar. You are a life saver! Between this example and other examples I have seen, it will help things click into place on how calls are made to the Win32 objects. Thanks again for your time and assistance on this.
Regards,
Chad

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- « Previous
-
- 1
- 2
- Next »