- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I succeeded at last applying WinHelp in a context-sensitive mode and used for this the subject: Trouble with context-sensitive help, from hbell November 26,2000. But now I stick in a context-help for the menu items. Glad to find exactly the same subject submitted from Anthony Richards April 25,2001 3:59am. As there is written, the author replaced the default window procedure DefWindowProc with the own one MyWndProc. I can't find DefWindowProc in my QuickWin Project and don't know where to place and call MyWndProc. Is there any example of such a procedure you could send me? I would be very glad about some more detailed information.
Link Copied
13 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tony Richards and I quite struggled to make F1 on QuickWin menus work... If you
wish, I can send you our correspondence (quite lengthy)... maybe I could dig out
sample workspace also. Please drop access to code of QuickWin window procs, you can still install your own
procedure to add or change functionality. The procedure must be of prototype
The window procedure is installed using
IIRC POKER sample illustrates the technique. (Btw, Steve, ain't it a nice theme
for Dr Fortran's article -- I don't recall there was one).
Regards
Jugoslav
wish, I can send you our correspondence (quite lengthy)... maybe I could dig out
sample workspace also. Please drop access to code of QuickWin window procs, you can still install your own
procedure to add or change functionality. The procedure must be of prototype
INTEGER FUNCTION MyWndProc(hWnd, Msg, wParam, lParam) !DEC$ATTRIBUTES STDCALL:: MyWndProc USE DFWIN USE GLOBALS, ONLY: lpfnOldWndProc USE DFWIN SELECT CASE(Msg) CASE(WM_SOMETHING) !Process desired messages here CASE DEFAULT MyWndProc = CallWindowProc(lpfnOldWndProc, hWnd, Msg, wParam, lParam) END SELECT
The window procedure is installed using
hWnd=GETHWNDQQ(...) lpfnOldWndProc=SetWindowLong(hWnd, GWL_WNDPROC, LOC(MyWndProc))
IIRC POKER sample illustrates the technique. (Btw, Steve, ain't it a nice theme
for Dr Fortran's article -- I don't recall there was one).
Regards
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
PROGRAM GLOBEWIRE
!Main program containing loop to allow menus to be used
USE DFLIB
USE DFWIN
USE XFLOGM
!USE DFLOGM
USE INPUTINFO
!
IMPLICIT NONE
!GRAPHICS WINDOW HANDLE USED IN VARIOUS ROUTINES VIA COMMON GRWHND
CHARACTER($MAXPATH) GRTITLE
INTEGER*4 GWINHND
LOGICAL GRTIT
COMMON/GRWHND/ GRTITLE, GWINHND
COMMON/FILEINP/ INFILE,FILENG
COMMON/TOSLIDE/ IIS,JJS,KOUNTS,XYRATS, &
XYZBEGS,XYZENDS,XYZCENS
REAL*8 XYZBEGS(3,80000),XYZENDS(3,80000),XYZCENS(3)
REAL*8 XYRATS
CHARACTER*60 INFILE
INTEGER*2 II,JJ, IIS,JJS, FILENG
INTEGER*4 ISTATUS,FOCRET,KOUNTS
COMMON/IDAXES/I1,I2,I3
COMMON/ROTANGS/A1,A2,A3
COMMON/SCRFORM/XYRAT
COMMON/STARTD/ STARTDIR, ISTARTD
REAL*8 XYRAT
REAL*8 A1,A2,A3, AMAT(3,3)
INTEGER*2 I1, I2, I3, IH, IV
!
COMMON/HANDLETOPROC/ hWndProc
!
LOGICAL CHECKED
LOGICAL*4 RESULT, NEWT
INTEGER*4 I4, RETINT, HWND, HWNDPROC, HWNDPREV, NUMARG
INTEGER*2 IVID
CHARACTER*120 STATMESS
CHARACTER*20 RETHANDLE
CHARACTER($MAXPATH) DIR, BUFFER, NEWTITLE,STARTDIR
INTEGER(4) length, ISTARTD
!
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: "__QWINTSetStatusBar" :: setstatusbar
!DEC$ else
!dec$ attributes C, alias: "_QWINTSetStatusBar" :: setstatusbar
!DEC$ endif
integer msg ! to hold address of string
end function setstatusbar
end interface
EXTERNAL NEWCOVER, OLDCOVER, ORIENT, COLOUR, ROTATE, SAVHPGLFIL
EXTERNAL PROJECTION, GLOBEHELP
!
!
OPEN(UNIT=9,FILE='GLOBEWIRE.LOG',STATUS='UNKNOWN',FORM='FORMATTED')
!
! Set up graphics screen and get screen resolution details
!
CALL SETVID(IVID,XYRAT)
IF(IVID.LT.0) THEN
WRITE(7,*)' FAILED TO SET WINDOW PARAMETERS'
STOP
ENDIF
CALL CHILDMOVE(7,0,0,62,36)
CALL SETTEXTWINDOW(0,0,80,36)
CALL CHILDMIN(7)
!
! Get the location of the current drive and directory from which GLOBEWIRE has been
! started. This will be the directory in which coverage files will be created
! Get current directory on the current drive - load 'DIR' with current drive first
!
DIR = FILE$CURDRIVE
LENGTH = GETDRIVEDIRQQ(DIR)
ISTARTD=0
IF (LENGTH .GT. 0) THEN
STARTDIR=TRIM(ADJUSTL(FILE$CURDRIVE))//TRIM(ADJUSTL(DIR))
ISTARTD=1
WRITE(7,*) 'GLOBEWIRE.. STARTDIR= ',TRIM(ADJUSTL(STARTDIR))
ENDIF
! Set up 'Graphic' menu items
RESULT=INSERTMENUQQ(4,0, $MENUENABLED, '&Graphic'C, NUL)
RESULT=APPENDMENUQQ(4, $MENUGRAYED, '&Projection...'C, PROJECTION)
RESULT=APPENDMENUQQ(4, $MENUGRAYED, 'Screen &Axes..'C, ORIENT)
RESULT=APPENDMENUQQ(4, $MENUGRAYED, '&Line/Background Colour..'C, COLOUR)
RESULT=APPENDMENUQQ(4, $MENUGRAYED, '&Rotate Graphic..'C, ROTATE)
RESULT=APPENDMENU QQ(4, $MENUGRAYED, '&Save Graphic as HPGL file..'C, SAVHPGLFIL)
! add 'Open new file' item to 'FILE' menu
RESULT=INSERTMENUQQ(1,1, $MENUENABLED, '&Add New Coverage...'C, NEWCOVER)
! add 'Add new file' item to 'FILE' menu
RESULT=INSERTMENUQQ(1,2, $MENUENABLED, 'Add &Old Coverage...'C, OLDCOVER)
! add 'Datafiles..' menu as 5th menu, shifting 'State', 'Window' and 'Help'
! up 1 to menus 6, 7 and 8
RESULT=INSERTMENUQQ(5,0, $MENUGRAYED, '&Datafiles...'C,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
PROGRAM GLOBEWIRE
!Main program containing loop to allow menus to be used
USE DFLIB
USE DFWIN
USE XFLOGM
!USE DFLOGM
USE INPUTINFO
!
IMPLICIT NONE
!GRAPHICS WINDOW HANDLE USED IN VARIOUS ROUTINES VIA COMMON GRWHND
CHARACTER($MAXPATH) GRTITLE
INTEGER*4 GWINHND
LOGICAL GRTIT
COMMON/GRWHND/ GRTITLE, GWINHND
COMMON/FILEINP/ INFILE,FILENG
COMMON/TOSLIDE/ IIS,JJS,KOUNTS,XYRATS, &
XYZBEGS,XYZENDS,XYZCENS
REAL*8 XYZBEGS(3,80000),XYZENDS(3,80000),XYZCENS(3)
REAL*8 XYRATS
CHARACTER*60 INFILE
INTEGER*2 II,JJ, IIS,JJS, FILENG
INTEGER*4 ISTATUS,FOCRET,KOUNTS
COMMON/IDAXES/I1,I2,I3
COMMON/ROTANGS/A1,A2,A3
COMMON/SCRFORM/XYRAT
COMMON/STARTD/ STARTDIR, ISTARTD
REAL*8 XYRAT
REAL*8 A1,A2,A3, AMAT(3,3)
INTEGER*2 I1, I2, I3, IH, IV
!
COMMON/HANDLETOPROC/ hWndProc
!
LOGICAL CHECKED
LOGICAL*4 RESULT, NEWT
INTEGER*4 I4, RETINT, HWND, HWNDPROC, HWNDPREV, NUMARG
INTEGER*2 IVID
CHARACTER*120 STATMESS
CHARACTER*20 RETHANDLE
CHARACTER($MAXPATH) DIR, BUFFER, NEWTITLE,STARTDIR
INTEGER(4) length, ISTARTD
!
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: "__QWINTSetStatusBar" :: setstatusbar
!DEC$ else
!dec$ attributes C, alias: "_QWINTSetStatusBar" :: setstatusbar
!DEC$ endif
integer msg ! to hold address of string
end function setstatusbar
end interface
EXTERNAL NEWCOVER, OLDCOVER, ORIENT, COLOUR, ROTATE, SAVHPGLFIL
EXTERNAL PROJECTION, GLOBEHELP
!
!
OPEN(UNIT=9,FILE='GLOBEWIRE.LOG',STATUS='UNKNOWN',FORM='FORMATTED')
!
! Set up graphics screen and get screen resolution details
!
CALL SETVID(IVID,XYRAT)
IF(IVID.LT.0) THEN
WRITE(7,*)' FAILED TO SET WINDOW PARAMETERS'
STOP
ENDIF
CALL CHILDMOVE(7,0,0,62,36)
CALL SETTEXTWINDOW(0,0,80,36)
CALL CHILDMIN(7)
!
! Get the location of the current drive and directory from which GLOBEWIRE has been
! started. This will be the directory in which coverage files will be created
! Get current directory on the current drive - load 'DIR' with current drive first
!
DIR = FILE$CURDRIVE
LENGTH = GETDRIVEDIRQQ(DIR)
ISTARTD=0
IF (LENGTH .GT. 0) THEN
STARTDIR=TRIM(ADJUSTL(FILE$CURDRIVE))//TRIM(ADJUSTL(DIR))
ISTARTD=1
WRITE(7,*) 'GLOBEWIRE.. STARTDIR= ',TRIM(ADJUSTL(STARTDIR))
ENDIF
! Set up 'Graphic' menu items
RESULT=INSERTMENUQQ(4,0, $MENUENABLED, '&Graphic'C, NUL)
RESULT=APPENDMENUQQ(4, $MENUGRAYED, '&Projection...'C, PROJECTION)
RESULT=APPENDMENUQQ(4, $MENUGRAYED, 'Screen &Axes..'C, ORIENT)
RESULT=APPENDMENUQQ(4, $MENUGRAYED, '&Line/Background Colour..'C, COLOUR)
RESULT=APPENDMENUQQ(4, $MENUGRAYED, '&Rotate Graphic..'C, ROTATE)
RESULT=APPENDMENU QQ(4, $MENUGRAYED, '&Save Graphic as HPGL file..'C, SAVHPGLFIL)
! add 'Open new file' item to 'FILE' menu
RESULT=INSERTMENUQQ(1,1, $MENUENABLED, '&Add New Coverage...'C, NEWCOVER)
! add 'Add new file' item to 'FILE' menu
RESULT=INSERTMENUQQ(1,2, $MENUENABLED, 'Add &Old Coverage...'C, OLDCOVER)
! add 'Datafiles..' menu as 5th menu, shifting 'State', 'Window' and 'Help'
! up 1 to menus 6, 7 and 8
RESULT=INSERTMENUQQ(5,0, $MENUGRAYED, '&Datafiles...'C,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
! Insert 'Globewire Help' as item 2 in 'Help' menu, which is now the 8th menu
RESULT=INSERTMENUQQ(8,2, $MENUENABLED, '&Contents'C, GLOBEHELP)
! Delete the default 'Contents' menu item, which is the first item in the 'Help' menu
RESULT=DELETEMENUQQ(8,1)
!
I4=ABOUTBOXQQ(' GLOBE Wireframe Views Version 1.0 copyright Rutherford Appleton Laboratory, 2001 All rights reserved'C)
! Set the status bar
STATMESS='No Input File Chosen..Use ''FILE'' Dialog to Select a File'
STATMESS=ADJUSTL(ADJUSTR(STATMESS))
RETINT=SETSTATUSBAR(%LOC(STATMESS))
! Choose a new title for the applications title bar
NEWTITLE='GLOBEWIRE Display - Rutherford Appleton Laboratory'C
HWND=GETHWNDQQ(QWIN$FRAMEWINDOW)
NEWT=SetWindowText(HWND,NEWTITLE)
!IGNORE DRAG AND DROP FOR THE MOMENT AND FORCE OPENING OF 'WORLD.WIR'
!
! Drag and drop:
! Find out if an input file name was given on the command line and use it
GO TO 1000
APMOD_FILE_INP = .FALSE.
NUMARG=NARGS()
IF(NUMARG.GT.1) THEN
CALL GETARG(1,BUFFER,ISTATUS)
! WRITE(*,*) 'INPUT FILE= ',TRIM(ADJUSTL(BUFFER(1:ISTATUS)))
APMOD_INP=TRIM(ADJUSTL(BUFFER(1:ISTATUS)))//''C
APMOD_FILE_INP = .TRUE.
CHECKED=APMOD_FILE_INP
CALL OPENF(CHECKED)
ENDIF
1000 CONTINUE
APMOD_FILE_INP = .FALSE.
BUFFER=TRIM(STARTDIR)//'WORLD.WIR'
APMOD_INP=TRIM(ADJUSTL(BUFFER))//''C
APMOD_FILE_INP = .TRUE.
CHECKED=APMOD_FILE_INP
CALL OPENF(CHECKED)
! FORCE A ROTATION TO DEFAULT VALUES
!
II=IIS
JJ=JJS
CALL NEWEULMAT(AMAT)
CALL TRANS(AMAT)
! CLEAR THE SCREEN, SCALE THE DRAWING AND DRAW BOX READY FOR PLOT
CALL ZSCALE(II,JJ)
! DRAW NEXT PLOT USING ARRAYS OF TRANSFORMED POINTS,
CALL IGPLOT(II,JJ,ISTATUS)
FOCRET=FOCUSQQ(0)
! UPDATE STATUS BAR
RETINT=SETSTATUSBAR(0)
STATMESS=ADJUSTL(ADJUSTR('Data from '//INFILE(1:FILENG)//' Plotted..'))
IF(II.EQ.1)STATMESS=TRIM(STATMESS)//'+X ACROSS..'
IF(II.EQ.2)STATMESS=TRIM(STATMESS)//'+Y ACROSS..'
IF(II.EQ.3)STATMESS=TRIM(STATMESS)//'+Z ACROSS..'
IF(JJ.EQ.1)STATMESS=TRIM(STATMESS)//'+X UP'
IF(JJ.EQ.2)STATMESS=TRIM(STATMESS)//'+Y UP'
IF(JJ.EQ.3)STATMESS=TRIM(STATMESS)//'+Z UP'
IF(I1.NE.0.OR.I2.NE.0.OR.I3.NE.0) STATMESS=TRIM(STATMESS)//'..ROTATED ABOUT'
IF(I1.EQ.0)STATMESS=TRIM(STATMESS)//' '
IF(I1.EQ.1)STATMESS=TRIM(STATMESS)//' X,'
IF(I1.EQ.2)STATMESS=TRIM(STATMESS)//' Y,'
IF(I1.EQ.3)STATMESS=TRIM(STATMESS)//' Z,'
IF(I2.EQ.0)STATMESS=TRIM(STATMESS)//' '
IF(I2.EQ.1)STATMESS=TRIM(STATMESS)//' X,'
IF(I2.EQ.2)STATMESS=TRIM(STATMESS)//' Y,'
IF(I2.EQ.3)STATMESS=TRIM(STATMESS)//' Z,'
IF(I3.EQ.0)STATMESS=TRIM(STATMESS)//' '
IF(I3.EQ.1)STATMESS=TRIM(STATMESS)//' X,'
IF(I3.EQ.2)STATMESS=TRIM(STATMESS)//' Y,'
IF(I3.EQ.3)STATMESS=TRIM(STATMESS)//' Z,'
! terminate string with a 'null' character
STATMESS=ADJUSTL(ADJUSTR(STATMESS)//''C)
RETINT=SETSTATUSBAR(%LOC(STATMESS))
! UPDATE GRAPHICS WINDOW TITLE BAR
GRTIT=SETWINDOWTEXT(GWINHND,''C)
GRTITLE=ADJUSTL(ADJUSTR('Display of '//INFILE(1:FILENG)))
IF(II.EQ.1)GRTITLE=TRIM(GRTITLE)//' +X Across..'
IF(II.EQ.2)GRTITLE=TRIM(GRTITLE)//' +Y Across..'
IF(II.EQ.3)GRTITLE=TRIM(GRTITLE)//' +Z Across..'
IF(JJ.EQ.1)GRTITLE=TRIM(GRTITLE)//' +X Up'
IF(JJ.EQ.2)GRTITL E=TRIM(GRTITLE)//' +Y Up'
IF(JJ.EQ.3)GRTITLE=TRIM(GRTITLE)//' +Z Up'
IF(I1.NE.0.OR.I2.NE.0.OR.I3.NE.0) GRTITLE=TRIM(GRTITLE)//' ..Rotated about'
IF(I1.EQ.0)GRTITLE=TRIM(GRTITLE)//' '
IF(I1.EQ.1)GRTITLE=TRIM(GRTITLE)//' X,'
IF(I1.EQ.2)GRTITLE=TRIM(GRTITLE)//' Y,'
IF(I1.EQ.3)GRTITLE=TRIM(GRTITLE)//' Z,'
IF(I2.EQ.0)GRTITLE=TRIM(GRTITLE)//' '
IF(I2.EQ.1)GRTITLE=TRIM(GRTITLE)//' X,'
IF(I2.EQ.2)GRTITLE=TRIM(GRTITLE)//' Y,'
IF(I2.EQ.3)GRTITLE=TRIM(GRTITLE)//' Z,'
IF(I3.EQ.0)GRTITLE=TRIM(GRTITLE)//' '
IF(I3.EQ.1)GRTITLE=TRIM(GRTITLE)//
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
IF(I3.EQ.1)GRTITLE=TRIM(GRTITLE)//' X,'
IF(I3.EQ.2)GRTITLE=TRIM(GRTITLE)//' Y,'
IF(I3.EQ.3)GRTITLE=TRIM(GRTITLE)//' Z,'
! terminate string with a 'null' character and then send it to the window
GRTITLE=ADJUSTL(ADJUSTR(GRTITLE)//''C)
GRTIT=SetWindowText(GWINHND,GRTITLE)
! FOCRET=FOCUSQQ(0)
!
! Just for interest, get the handle to the default window procedure,
! using the value for HWND obtained above using HWND=GETHWNDQQ(QWIN$FRAMEWINDOW)
HWNDPROC=GetWindowLong(HWND, GWL_WNDPROC)
WRITE(RETHANDLE,'(I20)')HWNDPROC
! RETINT=MESSAGEBOXQQ(" PROC HANDLE = "//RETHANDLE//''C,"GETWINDOWLONG RESULT"C, &
! MB$OK.OR.MB$ICONEXCLAMATION)
! Set MyWndProc as the new window procedure, saving the pointer to the old or
! previous window procedure in HWNDPREV. HWNDPREV is used in MyWndProc for
! obtaining default processing.
HWNDPREV=SetWindowLong(HWND, GWL_WNDPROC, LOC(MyWndProc))
WRITE(RETHANDLE,'(I20)')HWNDPREV
! RETINT=MESSAGEBOXQQ(" setwindowlong result = "//RETHANDLE//''C,"SETWINDOWLONG RESULT"C, &
! MB$OK.OR.MB$ICONEXCLAMATION)
! Start endless loop to let menus take over
DO WHILE(.TRUE.)
CALL SLEEPQQ(500)
END DO
END
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! MyWndProc
!!
!! This is the my window procedure for intercepting WM_HELP commands
!! issued by pressing the F1 key, and for processing the troublesome WM_ENTERIDLE message
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
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
!
! internal QuickWin routine to set status bar at screen bottom
! (was used for sending diagnostic messages at one stage. No longer used here)
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
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
type T_HELPINFO ! define HELPINFO structure
INTEGER cbSize
INTEGER iContextType
INTEGER iCtrlID
INTEGER hItemHandle
INTEGER dwContextID
TYPE(T_POINT) MousePos
end type
! HELPINFO structure pointed to by WM_HELP command pointer
type (T_HELPINFO):: HI; pointer(pHI, HI)
! Define the WM_HELP parameter here, just in case it is not
! already included in one of the USEd modules. Give it another name
! to avoid a clash if it is already defined locally.
integer(4), parameter:: WM_HELP_ = #0053
!
integer*4 retint, rethelp, ctrlid, hWndframe
!
select case ( mesg )
! WM_ENTERIDLE
case (WM_ENTERIDLE)
! Jugoslav Dujic solved the problem by discovering that the WM_ENTERIDLE
! message was the problem.
! Trap this here to prevent interfering QuickWin Help search
MyWndProc=0
! WM_HELP:
case (WM_HELP_)
! Get HELPINFO data into HI, pointed to by pHI, by setting the pointer pHI to lParam
pHI=lParam
ctrlid=HI%iCtrlID
go to 1000 ! un-comment/comment this to
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
THIS IS DIABOLICAL! WHERE IS MY CODE GOING TO?
HERE IS THE RESTY???
HERE IS THE RESTY???
!
go to 1000 ! un-comment/comment this to skip/execute the diagnostic stuff
! diagnostic stuff used to check on control id's being sent in WM_HELP
! in the HELPINFO structure pointed to by lParam
hWndframe=GETHWNDQQ(QWIN$FRAMEWINDOW)
write(hwndchar,'(i20)') hWnd
write(hframechar,'(i20)') hWndframe
message='Calling window handle= '//hWndchar//', frame window handle ='//hframechar//''C
retint=messageboxqq(message,'WM_HELP COMMAND PROCESSING'C, &
MB$OK.OR.MB$ICONEXCLAMATION)
write(ictypchar,'(i20)') HI%iContextType
write(ictrlchar,'(i20)') HI%iCtrlID
write(itemhandchar,'(i20)') HI%hItemHandle
write(contidchar,'(i20)') HI%dwContextID
message='Context type= '//ictypchar//'Control ID='//ictrlchar//'Handle='//&
itemhandchar//'ContextID='//contidchar//''c
retint=messageboxqq(message,'WM_HELP COMMAND PROCESSING'C, &
MB$OK.OR.MB$ICONEXCLAMATION)
! end diagnostic stuff
1000 continue
rethelp=WINHELP(hWnd, &
! 'C:PROGRAM FILESHELP WORKSHOPPROJECTSGLOBEWIREGLOBEWIRE.HLP'//''C, &
'GLOBEWIRE.HLP'C, &
HELP_CONTEXTPOPUP, ctrlid )
MyWndProc = rethelp
! DEFAULT PROCESSING
case default
! Let the default window proc handle all other messages
MyWndProc = CallWindowProc(hWndProc, hWnd, mesg, wParam, lParam )
end select
return
end function MyWndProc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is a size limit on posts - I don't know exactly what it is.
Steve
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Many thanks, Mr.Dujic and Mr.Richards for your help and suggestions. As you recommended I used the subclass module from the Poker sample and modified it and it works as far as I can see. I also tried to setup the GLOBEWIRE workspace with the source code you included in your e-mails, but there were too many unresolved externals at the moment.
Many thanks again for taking the trouble.
Many thanks again for taking the trouble.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There remains one problem so far in using context-sensitive help for menu items in my QuickWin project. Although the desired help topic is displayed correctly, there appears always a messagebox together with the topic saying that there is no help for this topic. I can't get rid of it. Is there any means to suppress that message?
Thank you very much.
Thank you very much.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I assume that, as in my case, the message box was the result of the QUICKWIN Help file being also called for as a result of F1 being pressed.
I found that intercepting this WM_ENTERIDLE halted the QuickWIn frame windows call to WInHelp that is started at the same time. I do not understand exactly why this behaviour happens, but it solved my problem.
If you are solving the help problem by sub-classing, as recommended in earlier postings to this thread, then you should be intercepting WM_HELP messages to the procedure handling messages for the window with the menu that F1 causes in the window procedure (call it MyWndProc for example) that you have inserted in place of the original one (call it PrevWndProc ). What I found (as a result of Jugoslav Dujic's efforts) was that the WM_ENTERIDLE also had to be intercepted and not passed on to the original window procedure. SO you should have something like
integer*4 pHI ! pointer to HELPINFO structure needed by WM_HELP command ! HELPINFO structure pointed to by WM_HELP command pointer type (T_HELPINFO):: HI; pointer(pHI, HI) ! Define the WM_HELP parameter here, just in case it is not ! already included in one of the USEd modules. Give it another name ! to avoid a clash if it is already defined locally. integer(4), parameter:: WM_HELP_ = #0053 ! integer*4 retint, rethelp, ctrlid, hWndframe ! select case ( mesg ) ! WM_ENTERIDLE case (WM_ENTERIDLE) ! Jugoslav Dujic solved the problem by discovering that the WM_ENTERIDLE ! message was the problem. ! Trap this here to prevent interfering QuickWin Help search MyWndProc=0 ! WM_HELP: case (WM_HELP_) ! Get HELPINFO data into HI, pointed to by pHI, by setting the pointer pHI to lParam pHI=lParam ctrlid=HI%iCtrlID
I found that intercepting this WM_ENTERIDLE halted the QuickWIn frame windows call to WInHelp that is started at the same time. I do not understand exactly why this behaviour happens, but it solved my problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much again for your help. With intercepting the WM_ENTERIDLE command in MyWndProc, the box with the message: "no help available for this item" disappeared.
I'm feeling a bit like in the fairy-tale:" the fisherman and his wife", when I put another question. Is there a possibility to use submenus in a Quickwin project? I mean in the way, that further menu items are displayed automaticly with a menu item highlighted with the mouse.
I'm feeling a bit like in the fairy-tale:" the fisherman and his wife", when I put another question. Is there a possibility to use submenus in a Quickwin project? I mean in the way, that further menu items are displayed automaticly with a menu item highlighted with the mouse.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well, yes, at the same price as F1 -- you have to take care about handling.
Here's a routine that installs submenus to QuickWin main menu. From then on,
you have to process WM_COMMAND in subclassed FrameWindowProc.
The code below installs four submenus, each with nItems, to first four items of 1st drop-down menu. Well, it's little dusty, and it's a bit complicated (in order to make code shorter) but the point is using CreatePopupMenu/ AppendMenu/ ModifyMenu.
Continued i
Here's a routine that installs submenus to QuickWin main menu. From then on,
you have to process WM_COMMAND in subclassed FrameWindowProc.
The code below installs four submenus, each with nItems, to first four items of 1st drop-down menu. Well, it's little dusty, and it's a bit complicated (in order to make code shorter) but the point is using CreatePopupMenu/ AppendMenu/ ModifyMenu.
!================================================================= SUBROUTINE AdditionalMenus() USE COMCTL USE MSFWIN USE MSFLIB USE REGISTRY IMPLICIT INTEGER(h-n) INCLUDE 'Resource.fd' CHARACTER*24:: szMenuName(0:3)=(/'&Topology Analyser 'C, & '&Load Flow 'C, & 'State &Estimation 'C, & 'Voltage &Control 'C/) CHARACTER*32:: szItemName(4,0:3)= & (/'&Voltage level coloring 'C, & '&Area coloring 'C, & '&Feeder coloring 'C, & '&Energization coloring 'C, & '&Display options... 'C, & ' 'C, & ' 'C, & ' 'C, & '&Options... 'C, & '&Show toolbar 'C, & ' 'C, & ' 'C, & '&Voltage quality 'C, & 'Operation planning 'C, & ' 'C, & ' 'C/) INTEGER,PARAMETER:: nItems(0:3)=(/4,1,2,4/) INTEGER,PARAMETER:: IDItem(4,0:3)= & (/ID_BUTTON_PONAP, & ID_BUTTON_POGRA, & ID_BUTTON_POIZV, & ID_BUTTON_POSTA, & ID_BUTTON_TS, & 0,0,0, & ID_BUTTON_ESTOPC, & ID_BUTTON_VREME, & 0,0, & ID_BUTTON_OPTIMALNINAPON, & ID_BUTTON_KVALITETNAPONA, & 0, & ID_BUTTON_OPPLAN/) hMenu=GetMenu(hFrame) hMenu1=GetSubMenu(hMenu,0) DO i=0,3 hAddMenu=CreatePopupMenu() DO j=1,nItems(i) iFlags=MF_BYPOSITION.OR.MF_STRING.OR.MF_EN ABLED IF (i.EQ.0 .AND. j.EQ.4) iFlags=IOR(iFlags,MF_CHECKED) IF (i.EQ.3 .AND. j.EQ.3) iFlags=MF_BYPOSITION.OR.MF_SEPARATOR iSt=AppendMenu(hAddMenu,iFlags,IDItem(j,i),LOC(szItemName(j,i))) END DO iSt=ModifyMenu(hMenu1,i,MF_BYPOSITION.OR.MF_POPUP.OR.MF_STRING.OR.MF_ENABLED, & hAddMenu,LOC(szMenuName(i))) END DO END SUBROUTINE AdditionalMenus
Continued i
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What a preciseness -- only three words got cut by Forum software :-).
All that is left is to process WM_COMMAND message in subclassed frame window proc. ID_ constants above are PARAMETERs (you can add them as resource.fd constants using "Resource symbols" from context-menu for "MyApp resources" in ResourceView, or hard-code them other way).
Regards
Jugoslav
All that is left is to process WM_COMMAND message in subclassed frame window proc. ID_ constants above are PARAMETERs (you can add them as resource.fd constants using "Resource symbols" from context-menu for "MyApp resources" in ResourceView, or hard-code them other way).
SELECT CASE(Msg) ... CASE(WM_COMMAND) SELECT CASE(LOWORD(wParam)) CASE(ID_BUTTON_PONAP) !Do something here CASE(... CASE DEFAULT FrameWindowProc=CallWindowProc(lpfnOldFrameProc, hWnd, Msg, wParam, lParam) ...
Regards
Jugoslav

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