Announcement

Collapse
No announcement yet.

Trouble with RC file

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Trouble with RC file

    I'm losing my data.

    When i include larger files, included icons and/or cursors might disappear.
    The handle returns '0' !

    PBRES problem?


  • #2
    Edwin -
    how much ? More than 1300-1400 Kb (total) ?

    ------------------

    Comment


    • #3
      Yes but,

      I just tried the BRC compiler and using the tool from JC fuller to add the resource afterwards, still the same results!
      It cannot be the PBRES util.

      Code:
      (RC1)
      #include "D:\TEMP\myrc2.rc" //Project's default RC.
      
      (RC2)
      
      // RTFINFO RCDATA "C:\PBWORK\CDINTRO\Sample2.rtf"
      RTFINFO RCDATA "C:\PBWORK\easyset\CONTENTS.rtf"
      
      FILE1 RCDATA "C:\APP\APP.EXE"
      FILE2 RCDATA "C:\APP\APP.INI"
      FILE3 RCDATA "C:\APP\APP.PFS"
      
      HYPERHAND CURSOR "C:\PBWORK\CDINTRO\H_point.cur"
      This is a serious problem for me.
      I used 32x32x16 icons.
      The cursor = standard (766 bytes)
      App.exe = ~2.5mb
      + ~100K stuff


      ------------------

      Comment


      • #4
        If you have Visual Studio, then you should be able to open the compiled EXE and inspect the resources it contains. This should at least verify if the binary resource file is bing linked correctly.

        This may also be possible with Resource Workshop (I don't have it installed currently to check this).

        Also, have you tried to compile the .RC from the command-line, so you can check that the .RES file is being built correctly? For example, if you use a script or batch file to do the RC compilation, then you could could be missing (an important) compilation error (because the console could be closed too quickly to see the error message), and you may then be unaware that you are really using a .RES file from a previous compilation attempt, ie, the file may be from before you added additional items to the .RC file.

        Just a thought, and maybe worth a try.



        ------------------
        Lance
        PowerBASIC Support
        mailto:[email protected][email protected]</A>
        Lance
        mailto:[email protected]

        Comment


        • #5
          In this case i did it manually (after doing it auto.)

          So, i see all errors.
          Below, BRC and RC logs.

          Code:
          D:\TEMP>brc -32 -r -v myrc.rc
          Borland Resource Compiler  Version 5.20
          Copyright (c) 1990, 1997 Borland International.  All rights reserved.
          Lines: Current 0, Total 0
          New File: myrc.rc
          Lines: Current 1, Total 0
          New File: D:\TEMP\myrc.rc
          Lines: Current 1, Total 1
          New File: D:\TEMP\myrc2.rc
          Lines: Current 3, Total 3
          Compiling RCDATA: RTFINFO
          Lines: Current 5, Total 5
          Compiling RCDATA: FILE1
          Lines: Current 6, Total 6
          Compiling RCDATA: FILE2
          Lines: Current 7, Total 7
          Compiling RCDATA: FILE3
          Lines: Current 9, Total 9
          Compiling CURSOR: HYPERHAND
          Lines: Current 0, Total 11
          New File: myrc.rc
          Lines: Current 0, Total 12
          New File:
          
          D:\TEMP>
          
          D:\TEMP>c:\PBDLL60\Bin\Rc.exe -v -r myrc.rc
          Microsoft (R) Windows 32 Resource Compiler, Version 4.00 - Build 1367
          Copyright (C) Microsoft Corp. 1985-1994. All rights reserved.
          
          Using codepage 1252 as default
          Creating MYRC.RES
          RC: RCPP -CP 1252 -f D:\TEMP\RCa56631 -g D:\TEMP\RDa56631 -DRC_INVOKED -D_WIN32
          -pc\:/ -E -I. -I .
          
          MYRC.RC.
          Writing RCDATA:RTFINFO, lang:0x409,     size 16625.
          Writing RCDATA:FILE1,   lang:0x409,     size 2596375.
          Writing RCDATA:FILE2,   lang:0x409,     size 206.
          Writing RCDATA:FILE3,   lang:0x409,     size 345000.
          Writing CURSOR:1,       lang:0x409,     size 748
          Writing GROUP_CURSOR:HYPERHAND, lang:0x409,     size 20
          
          D:\TEMP>
          
          piece of the res file, it seems that the cursor is very small in rescode.
          This doesn't look good. (i think)
          
          
                                     ­  ­  ­  Ó  +  Ç  Ç        _   _   ³   ³   °`
            °Ó   Ó  Ó  Ó¤  Ó  ß   ß   ß   ß   ¾          ¶   0      H Y P E R H A N D
                0                @   ý  

          ------------------

          Comment


          • #6
            wait a minute!

            What's this?

            > Writing CURSOR:1, lang:0x409, size 748
            > Writing GROUP_CURSOR:HYPERHAND, lang:0x409, size 20

            GROUP_CURSOR???
            As you can see, the amount of bytes is 20, just as i saw in my RES file (See prev. post)



            ------------------

            Comment


            • #7
              So I gather you used Resource Workshop to create the RC file? That may explain why the MS resource compiler has problems.

              You should always use the RC compiler that matches the resource editor you used to create the script in the first place.

              For example, a common problem I come across in Tech Support is the use of RC.EXE (that ships with PB/DLL) on a script that was created with Visual Studio. In this case, the RC.EXE supplied with Visual Studio should be used to compile the script.


              ------------------
              Lance
              PowerBASIC Support
              mailto:[email protected][email protected]</A>
              Lance
              mailto:[email protected]

              Comment


              • #8
                Wait a minute, it's not solved yet..

                I didn't use any other tools than my own '10 tools' (fingers).

                The rc is created in notepad.
                I tried BRC (borland res compiler only, stripped from an old delphi 2 version.
                I also tried RC.
                Both have the same problem.

                All info/code i used is posted above.
                This is it.

                What's wrong, why is the cursor_group appended and why is my cursor not retrievable?

                Thanks,



                ------------------

                Comment


                • #9
                  Excellent question...

                  Because noone is able to duplicate your problem without actually having the files (at least, I've never heard of this problem before), we are only going to be grasping at straws.

                  Have you tried substituting other files, rearranging the ordinal order of the resource items, or...

                  As RC from PB/DLL and BRC.EXE both have a problem, then it is *something* either in your script or in the data used to build the script. I note that the cursor filename contains an underscore... what happens if this underscore is removed?

                  Substituting another cursor file is definitely something that seems worth trying, as your file is truncated at 20 bytes for an apparently unknown reason.


                  ------------------
                  Lance
                  PowerBASIC Support
                  mailto:[email protected][email protected]</A>
                  Lance
                  mailto:[email protected]

                  Comment


                  • #10
                    i tried everything.
                    also double entries of the same cursor,
                    Qua data it seems to be inserted.
                    The group_cursor (and group_icon if you have one) is aut. inserted for some reason.
                    It looks if the loadcursor api is taking this one but can't load.
                    So, I think that there are 2 entries in the resources.
                    I have BC5, i'm not familiar with it, does this have a resource viewer?

                    This is a stripped version.
                    if i remove file1, wich is 2.5mb, all others are ok.

                    HYPERHAND CURSOR "Hpoint.cur"

                    RTFINFO RCDATA "C:\PBWORK\easyset\CONTENTS.rtf"

                    FILE2 RCDATA "C:\APP\APP.INI"
                    FILE3 RCDATA "C:\APP\APP.PFS"
                    FILE1 RCDATA "C:\APP\APP.EXE"

                    It's really weird, i really need it this way..


                    ------------------

                    Comment


                    • #11
                      EB,

                      Just grasping at straws here, but does the icon in question open and display correctly in the icon editor? Resource Workshop has an icon editor, just maybe the file is glitched on the hard drive. Just a thought.

                      Cheers,
                      Cecil

                      ------------------

                      Comment


                      • #12
                        I just did use BC5.
                        i compiled the resource from the ide to a res file.

                        Now i'm thinking about my code:

                        Code:
                        Function WinMain ( ByVal hCurInstance  As Long, _
                                           ByVal hPrevInstance As Long, _
                                           lpszCmdLine         As ASCIIZ PTR, _
                                           ByVal nCmdShow      As Long ) As Long
                        
                            #Register None
                        
                            Dim hDlg   As Long
                            Dim a As Long
                            Dim Result As Long
                            Dim hRichEdit As Long
                            Dim hCtrl As Long
                            Dim T As String
                        
                            Dim az as asciiz * 20
                            az = "HYPERHAND"
                        
                            HYPERHAND = LoadCurSor( hCurInstance, az )
                        
                        Msgbox Str$( HYPERHAND )
                        Returns zero.
                        As i said, when i remopve the large file (//), the rest becomes ok.


                        ------------------

                        Comment


                        • #13
                          Just restarted BC5 and opened the .RES file imm.
                          This shows the cursor in the ide, and the others..

                          The .res looks ok.

                          Still no luck in PB..


                          ------------------

                          Comment


                          • #14
                            Here's an example project.

                            It doesn't work also..

                            http://members.tripod.lycos.nl/PBSoft/myrc.zip

                            (~1k)

                            Hope to solve this soon...

                            Thanks,


                            ------------------

                            Comment


                            • #15
                              Edwin --
                              Situation looks absolutelly clear (at least, for me) -- it's not possible to include separate objects larger than 13xx Kb (total size is not important).
                              Plus, PBRES/PB doesn't like something else.
                              Do you plan to rewrite PBRES/PB ?

                              ------------------


                              [This message has been edited by Semen Matusovski (edited May 18, 2000).]

                              Comment


                              • #16
                                When LoadCursor() fails, what does GetLastError() return?

                                Semen's 1.3Mb limit suggestion implies a stack overflow or stack limit is occuring somewhere (ie, in the API). If you reduce the size of the RTF file to around 1Mb, you may be able to test this concept further. I've never used such a large resource file - most of mine are well below 1Mb.



                                ------------------
                                Lance
                                PowerBASIC Support
                                mailto:[email protected][email protected]</A>
                                Lance
                                mailto:[email protected]

                                Comment


                                • #17
                                  I have a working example here where I use a 3.8 meg file as a
                                  binary resource and it uses standard RC.EXE syntax and builds
                                  without either error or warning so there is no problem with
                                  either RC.EXE or PBRES.EXE.

                                  The RES and PBR files are both in the 3.8 meg range so the
                                  problem must be somewhere else. It appears to be in the syntax
                                  used in the RC file.

                                  This is the line from my RC file,

                                  2 RCDATA DISCARDABLE "Files.bin"

                                  I routinely use number IDs for resources as the Microsoft
                                  literature says it is more efficient and I have also found it to
                                  be more reliable.

                                  All I can suggest Edwin is that you try using a number ID and see
                                  if that fixes it.

                                  Regards,

                                  [email protected]

                                  ------------------
                                  hutch at movsd dot com
                                  The MASM Forum

                                  www.masm32.com

                                  Comment


                                  • #18
                                    I tried by number too.

                                    Semen, i build the res file as described but for appending i used 2 methods:
                                    The PBRES method and the rsrc tool wich appends Res files afterwards (like in 16bit)
                                    In that case, no PBRES util is used..

                                    The appending of a LARGE file is not the problem.
                                    I have two problems when i use large files:

                                    1) icons are no longer loaded(!)
                                    2) this cursor described above won't load either.

                                    The BC5 ide shows the resources correctly (visually)
                                    Might this be a PB.exe <> res problem??

                                    Lance, i certainly hope you want to take a look about my test zipfile.

                                    At the end i will (of course) compress the data except for the RTF data.
                                    This might result in a correct working exe, but not to be trusted when i append larger files in the future.

                                    Thanks,


                                    ------------------

                                    Comment


                                    • #19
                                      Edwin --
                                      Sorry, I have stupid idea about 1,3 because of ASCIIZ strings.
                                      But look your code.
                                      You should use
                                      a = LoadCursor(GetModuleHandle(ByVal 0), "HYPERHAND" )



                                      ------------------

                                      Comment


                                      • #20
                                        Edwin,

                                        I wrote a test piece and could duplicate you problem exactly with
                                        both icons and cursors. I wrote a small test piece in MASM and it
                                        has exactly the same problem, cannot load menus, icon etc...

                                        The problem is in the resource file format so for a quick work
                                        around, I would suggest putting the resources in a DLL and see if
                                        you can call them from that, this will allow your EXE file to function
                                        normally while using a DLL that does not need other resources.

                                        Regards,

                                        [email protected]

                                        ------------------
                                        hutch at movsd dot com
                                        The MASM Forum

                                        www.masm32.com

                                        Comment

                                        Working...
                                        X