- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am programming a dialogue based application with VS2010 and IVF Composer 2013 and Window 8.1
When extending a dialog with a new contol, VS automatically suggest a name for this new control, for example "IDC_BUTTON1". As I prefer my own naming convetion, I change this to, lets say "IDC_Update_1. The problem is now that VS2013 does not update the resource.h file and I got errors by compiling. I edited the resource file and could compile and link without errors. However, at run time the control does not work because it has not been assigned a handle.
Reselecting control ID used to work automatic and well with VS2005, is there anything I can do to force VS2013 to update resource files correctly ?
Thrust someone can help..
reidar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
is the resource.h file added as part of the project? Also there is a custom build step needed to create the Fortran include file resource.fd from the .h file. You should find some help in https://software.intel.com/en-us/forums/topic/507847
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
is the resource.h file added as part of the project? Also there is a custom build step needed to create the Fortran include file resource.fd from the .h file. You should find some help in https://software.intel.com/en-us/forums/topic/507847
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Have you edited the RESOURCE.H file outside the VS environment at any time?
I believe that that could cause problems with updating and in my experience the only way to get a clean RESOURCE.H file is to reconstruct it.
If the RESOURCE.H file actually contains your new control ID in a #Define line in the file, then the problem is with the DEFTOFD.EXE not running automatically to recreate an updated RESOURCE.FD file. This can be corrected by adding a custom build step to the RESOURCE.H file as suggested earlier. Though that leaves unexplained why the DEFTOFD step is now not automatically applied.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
After you edit (rename) the ID and File |Save/SaveAll, if you perform a Clean on the project, then Build, is the .fd header file properly created?
I've notice in VS C++ projects, when renaming ID fields, that occasionally I must perform a clean in order to get the new names incorporated into the project.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is a sample program which replaces deftohd; it reads resource.h and locres.h and creates a custom .fd file which is explicitly INCLUDEd in a module with global access within my project. I did this out of frustration with deftofd's poor performance over many years and many versions of VS and IVF. No deftohd = no such problems any more. I run this tool from a batch file (one click) external to VS, only needed when a resource item has changed.
[fortran]
! ResImport.f90
!
MODULE subs
USE kernel32
USE ifwin
CONTAINS
FUNCTION open_the_file (fullpath, rwmode) RESULT (ihandl)
IMPLICIT NONE
INTEGER :: access, ihandl
CHARACTER(LEN=*),INTENT(IN) :: fullpath, rwmode
IF (rwmode == 'R') THEN
access = GENERIC_READ
ELSE
access = IOR(GENERIC_READ,GENERIC_WRITE)
END IF
ihandl = CreateFile (fullpath, &
access, &
FILE_SHARE_READ, &
NULL_SECURITY_ATTRIBUTES, &
OPEN_ALWAYS, &
FILE_ATTRIBUTE_NORMAL, &
NULL )
IF (ihandl == INVALID_HANDLE_VALUE) THEN
END IF
END FUNCTION open_the_file
SUBROUTINE rw_file (rwmode, ihandl, nbytes, loc_pointer, offset)
IMPLICIT NONE
CHARACTER(LEN=1), INTENT(IN) :: rwmode
INTEGER, INTENT(IN) :: ihandl, nbytes, loc_pointer
INTEGER, INTENT(IN), OPTIONAL :: offset
INTEGER :: nact
! position pointer if offset is provided
IF (PRESENT(offset)) nact = SetFilePointer (ihandl, offset, NULL,FILE_BEGIN)
IF (rwmode == 'R') THEN
IF (.NOT.ReadFile (ihandl, & ! file handle
loc_pointer, & ! address of data
nbytes, & ! byte count to read
LOC(nact), & ! actual bytes read
NULL_OVERLAPPED)) THEN
END IF
ELSE
IF (.NOT.WriteFile(ihandl, & ! file handle
loc_pointer, & ! address of data
nbytes, & ! byte count to write
LOC(nact), & ! actual bytes written
NULL_OVERLAPPED)) THEN
END IF
END IF
END SUBROUTINE rw_file
SUBROUTINE Set_eof (ihandl)
IMPLICIT NONE
INTEGER, INTENT(IN) :: ihandl
INTEGER :: rslt
rslt = SetEndOfFile (ihandl)
END SUBROUTINE Set_eof
SUBROUTINE close_file (ihandl)
IMPLICIT NONE
INTEGER,INTENT(INOUT) :: ihandl
LOGICAL :: rslt
IF (ihandl > 0) rslt = CloseHandle (ihandl)
ihandl = 0
END SUBROUTINE close_file
END MODULE subs
PROGRAM ResImport
USE subs
IMPLICIT NONE
INTEGER :: j, ihandl, nc, ncout, kount, ier
CHARACTER(LEN=80) :: root = ' '
CHARACTER(LEN=200) :: fullpath, line_in, line_out
CHARACTER(LEN=2), PARAMETER :: crlf = CHAR(13)//CHAR(10)
CHARACTER(LEN=26), PARAMETER :: intpar = ' INTEGER, PARAMETER :: '
CHARACTER(LEN=12), PARAMETER :: freeform = '!MS$FREEFORM'
CHARACTER(LEN=40), DIMENSION(2), PARAMETER :: headerfile = &
(/'english\locres.h', 'source\resource.h'/)
INTEGER, PARAMETER :: ncol = 40
! root path from command line
nc = IARGC()
IF (nc == 0) STOP ' No command-line arguments for root path'
CALL GetArg (1, fullpath, nc)
IF (nc == 0) STOP ' Null command line'
! create the output file
fullpath(nc+1:nc+1) = CHAR(0)
ihandl = open_the_file (fullpath, 'W')
IF (ihandl == INVALID_HANDLE_VALUE) STOP ' cannot create output file'
WRITE (*,'(//,5X,"Output file ",A)') fullpath(1:nc)
CALL rw_file ('W', ihandl, 12, LOC(freeform))
CALL rw_file ('W', ihandl, 2, LOC(crlf))
! extract the root path for the source files from the command line
DO j = LEN_TRIM(fullpath), 1, -1
IF (fullpath(j:j) == '\') EXIT
END DO
root = fullpath(1:j)
! read each of the 'c' format resource files
DO j = 1, 2
fullpath = TRIM(root)//TRIM(headerfile(j))
nc = LEN_TRIM(fullpath)
fullpath(nc+1:) = ' '
WRITE (*, '(/,5X,2A)') "Reading "//fullpath(1:nc)
OPEN (3, FILE=fullpath, STATUS='OLD', IOSTAT=ier)
SELECT CASE (ier)
CASE (29)
WRITE (*,'(5X,"file not found")')
STOP
CASE (1:28, 30:)
WRITE (*, '(5X,"file open error =",I8)') ier
STOP
END SELECT
line_out = ' ! '//fullpath(1:nc)
CALL rw_file ('W', ihandl, 2, LOC(crlf))
CALL rw_file ('W', ihandl, nc+6, LOC(line_out))
CALL rw_file ('W', ihandl, 2, LOC(crlf))
kount = 0
DO WHILE (.NOT.EOF(3))
READ (3,'(A)') line_in
IF (INDEX(line_in, 'ifdef') > 0) EXIT
IF (line_in(1:1) /= '#') CYCLE
line_out = ' '
line_in(1:8) = ' '
line_in = ADJUSTL(line_in)
nc = INDEX(line_in,' ') ! first space delimits the variable name
IF (nc > 0) THEN
line_out = line_in(1:nc)
line_in(1:nc) = ' ' ! remove the variable name
line_in = ADJUSTL(line_in)
nc = LEN_TRIM(line_in)
ncout = LEN_TRIM(line_out)
line_out(ncout+1:) = " "
line_out(ncol+1:ncol+nc+2) = '= '//line_in(1:nc)
ncout = LEN_TRIM(line_out)
CALL rw_file ('W', ihandl, 26, LOC(intpar) )
CALL rw_file ('W', ihandl, ncout, LOC(line_out) )
CALL rw_file ('W', ihandl, 2, LOC(crlf) )
kount = kount + 1
END IF
END DO
CLOSE (3) ! done with this source file
WRITE (*,'(15X,I6," items found")') kount
END DO
! final cleanup of output file
CALL rw_file ('W', ihandl, 2, LOC(crlf))
CALL Set_eof (ihandl)
CALL close_file (ihandl)
END PROGRAM ResImport
[/fortran]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you all for your response !
My problem was solved by introducing a "custom build step" defined as a property of the resource.h file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@paul - I do not have any problems with deftofd what goes wrong? I am guessing you had some problems back in the annals of time perhaps? I ask this question in case there is some creature lurking in the long grass that might rear it head and bite me at some point.....
For the record In my sources I have a module that holds the fd include and I then use this module thus the fd file include only occurs in one location. I think this is more efficient and logical. I hate include files....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@app4619 -- my (historical) problems with deftofd were similar to the OP's experience that resource changes were not being tracked from an editing session into the code, with omissions that were sporadic. This persisted for so long (tried all the usual tricks, custom build step, etc) that I gave up on deftohd, made my own tool for this, turned out to be very simple and now works always. Since I have been doing this for over 5 years, it could well be the case that ancient problems have long been fixed (or maybe not?). I also haven't had a toothache since my teeth were extracted, etc. so this logic is not water-tight, hard to prove that a non-negative is equivalent to a positive. It seems we use exactly the same approach to INCLUDE the .fd once, into a module USEd globally; and this is the only INCLUDE in the code.

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