Silverfrost Forums

Welcome to our forums

64 bit Windows %dw call-back

17 Mar 2010 12:36 #6178

At the beginning of the year we were about to release a new version of our software when we discovered some compatibility issues with Windows 7. From your forum this would not seem to be unique. We followed the advice and after downloading v5.50 several of these issues disappeared. Thank you.

However, we are now left with a few imponderables which appear to be a combination of virtual common usage and 64 bit (Windows 7). The main problem is related to a dialogs we have that uses %dw with call-backs. Today we have managed to 'prove' a similar problem by slightly altering one of your demonstration routines rather than supplying you with our routines. The resultant crash appears like this

http://www.dtmsoftware.com/media/Untitled.jpg

This only occurs on our 64 bit Windows 7 PC (32 bit is fine) and it only happens after the window has been resized followed by selecting Help About. As soon as this dialog is closed and the mouse moved over the graphics area the crash occurs. The code follows.You will notice that only a few lines of code have been changed. It should be possible to copy and paste the code to your existing Resize.f95 file and rebuild as per the demo set. Is this to do with our code or something deeper?

!****************************************************************************
!                                                                           *
! Salford ClearWin+ Example Code                                            *
!*                                                                          *
!* RESIZE.F95 - version 1.0 26/6/99                                                *
!*                                                                          *
!* only compile using FTN95 version 1.6 or higher                           *
!*                                                                          *
!* Example of ClearWin+ Resizable %gr window                                *
!*                                                                          *
!****************************************************************************
!****************************************************************************
!*                                                                          *
!* Resizable window example using windows API calls including:-             *
!*                                        SetWindowPos                      *                 
!*                                        GetWindowRect                     *
!*                                        GetWindowLong                     *
!*                                        SetWindowPos                      *
!*                                        MoveWindow                                  *
!*                                                                          *
!****************************************************************************


module com_res
   use mswin    
   implicit none  
   integer ::hwnd
   integer , dimension(4) ::rect 
        
contains                        
   
   integer function draw_func()
       logical :: dummy      
!      dummy = GetWindowRect(hwnd,rect)  
!      if (.not.dummy) stop
!      call draw_line@(0,0,200,200,rgb@(255,0,0))   
!      call draw_line@(0,200,200,0,rgb@(255,0,0))
       integer :: idwdc
       integer :: idwx
       integer :: idwy
       idwdc = clearwin_info@('GRAPHICS_DC')      
       idwx = clearwin_info@('GRAPHICS_WIDTH')
       idwy = clearwin_info@('GRAPHICS_DEPTH')
       dummy = MoveToEx(idwdc, 0, 0, 0)
       dummy = LineTo(idwdc, idwx, idwy)
       dummy = MoveToEx(idwdc, idwx, 0, 0)
       dummy = LineTo(idwdc, 0, idwy)
      draw_func = 2
   end function draw_func  
 
   integer function resize_func() 
      integer :: s 
      logical :: x     
      integer :: wsm,swpz,swpm 
      integer :: res,i
! get the style of the window
      s = GetWindowLong(hwnd,GWL_STYLE)
      wsm  = WS_MAXIMIZE
      swpz = SWP_NOZORDER 
      swpm = SWP_NOMOVE
      res  = and(s,wsm)
      if(not(res) == 0) then
! the window is not maximized     
         x = SetWindowPos(hwnd,0,0,0,200,200,or(swpz,swpm))
      else
! don't call SetWindowPos because :
! the window is maximized 
         x = MoveWindow(hwnd,rect(1),rect(2),200,200,1)
         if (.not.x)stop
! set the window style as not maximized
         i = SetWindowLong(hwnd,GWL_STYLE,and(s,not(wsm)))
         if(i==0)stop
      endif                       
      resize_func = 1
   end function resize_func              
end module com_res

!      *******************************************
!      *            Main Program                 *
!      *******************************************
winapp 
program resize
   use mswin
   use salf_about
   use com_res
   implicit none
   integer :: ctrl,i
   ctrl = 0
   i = winio@('%ca[Resize me]&')               
   i = winio@('%ww Please select Resize %2nl&')
   i = winio@('%pv&')  
   i = winio@('%sc&',draw_func)        
   i = winio@('%mi[icon_1]&')    
!   i = winio@('%gr[black,metafile_resize,rgb_colours]&',200,200)
   i = winio@('%^dw[full_mouse_input,user_resize]&',200,200,draw_func)
   i = winio@('%mn[&File[E&xit]]&','EXIT')      
   i = winio@('%mn[&Resize]&',resize_func)
   i = winio@('%mn[&Help[About]]&',about_box_cb) 
   i = winio@('%lw%hw',ctrl,hwnd)
end program resize


resources

ICON_1 ICON salflogo.ico
Please login to reply.