Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

SetScrollinfo

steve_konarski
Beginner
1,353 Views

I am trying to use SETSCROLLINFO in a fortran windows routine at the beginning of the routine I have

"use dfwinty"

and vinfo and hinfo are specified as a type (T_SCROLLINFO) structures ,

the calls to setscrollinfo are

ret= SetScrollinfo( hWnd, SB_VERT, vinfo,.TRUE.)

ret = SetScrollinfo( hWnd, SB_VERT, vinfo,.TRUE.)

when i compile i get

Error: This name does not have a type, and must have an explicit type. [SETSCROLLINFO]
i= SetScrollinfo( hWndd, SB_HORZ, hinfo,.TRUE.)

steve Konarski

0 Kudos
7 Replies
anthonyrichards
New Contributor III
1,353 Views

You will find its interface in the USER32 moddule, so add

USE USER32

to your program, alongside USE DFWINTY

0 Kudos
steve_konarski
Beginner
1,353 Views

Thanks - i am already using USER32 but prob got an old version (6.01) and the interface for setscrollinfo and getscrollinfo are not there have yopu the interface for these two functions - regards steve konarski

0 Kudos
steve_konarski
Beginner
1,353 Views

I tried

interface
integer function SetScrollInfo( hwnd, mesg, wParam, lParam )
!DEC$ IF DEFINED(_X86_)
!DEC$ ATTRIBUTES STDCALL, ALIAS : '_SetScrollInfo@16' :: SetScrollInfo
!DEC$ ELSE
!DEC$ ATTRIBUTES STDCALL, ALIAS : 'SetScrollInfo' :: SetScrollInfo
!DEC$ ENDIF
integer hwnd
integer mesg
type (T_SCROLLINFO) wParam
logical lParam
end function
end interface

but it did not work

and got

Error: The type of the actual argument differs from the type of the dummy argument. [HINFO]
i= SetScrollinfo( hWndd, SB_HORZ, hinfo,.TRUE.)

0 Kudos
anthonyrichards
New Contributor III
1,353 Views

Here is what's in USER32.F90 in my version of CVF (6.6C):

FUNCTION SetScrollInfo( arg1, &
arg2, &
arg3, &
arg4)
USE DFWINTY
integer(SINT) :: SetScrollInfo ! int
!DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'SetScrollInfo' :: SetScrollInfo
integer(HANDLE) arg1 ! HWND arg1
integer(SINT) arg2 ! int arg2
!DEC$ ATTRIBUTES REFERENCE, IGNORE_LOC, ALLOW_NULL :: arg3
TYPE(T_SCROLLINFO) arg3 ! LPCSCROLLINFO arg3
integer(BOOL) arg4 ! BOOL arg4
END FUNCTION
END INTERFACE

Note that arg4 is actually INTEGER (BOOL here does NOT mean LOGICAL!),. HANDLE, SINT and BOOL are all = 4 in DFWINTY, so arg1, arg2 and arg4 are all INTEGER(4).

The 'IGNORE_LOC, ALLOW_NULL' directive I have never seen before. I guess it means that without it, arg3 should be an integer pointer to the T_SCROLLINFO type arg3 structure, which would otherwise be obtained using LOC(arg3). You could try this if the above interface does not solve your problem.

0 Kudos
Jugoslav_Dujic
Valued Contributor II
1,353 Views
That's because of INTERFACE scoping rules -- you have to have declaration of T_SCROLLINFO visible within the interface:
interface
integer function SetScrollInfo( hwnd, iSb, SI, bRedraw)
!DEC$ ATTRIBUTES STDCALL, ALIAS : '_SetScrollInfo@16' :: SetScrollInfo
!if T_SCROLLINFO is not defined in your DFWINTY,
!substitute a module of your own:

USE DFWINTY, ONLY: T_SCROLLINFO
integer hwnd
integer iSb
!DEC$ATTRIBUTES REFERENCE:: SI
type(T_SCROLLINFO) SI
logical bRedraw
end function
end interface
0 Kudos
Steven_L_Intel1
Employee
1,353 Views
IGNORE_LOC and ALLOW_NULL were added to allow us to rewrite the interface to be better typed. In MSFPS, and earlier versions of CVF/.DVF, some arguments (arrays and character, epecially) were declared as addresses by value rather than actual type by reference. So as not to break existing code, IGNORE_LOC says that if the code uses LOC(arg) to pass arg, where arg is the right type, ignore the LOC. ALLOW_NULL allows you to pass NULL for arguments that can be omitted that way (such as arg3 above).

These and DECORATE would not be in CVF 6.1, I believe.
0 Kudos
steve_konarski
Beginner
1,353 Views

Thjanks for the help - I managed to get the program working by using loc(hinfo) and loc(vinfo) in the call to setscrollinfo

steve

0 Kudos
Reply