Announcement

Collapse
No announcement yet.

Trouble with RC file

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

  • #21
    Steve, this was when the resource items were large, right?

    BTW, to clarify Semen's comment on ASCIIZ strings for the lurkers here...

    ASCIIZ strings that are LOCAL to a sub or function are stored on the stack for the duration of the sub/function. Therefore, LOCAL ASCIIZ strings are limited to the amount of free space in the stack frame - in the order of 1Mb or less depending on other local storage.

    If a larger ASCIIZ string is required, make the variable GLOBAL or STATIC instead (these are not stored on the stack).

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

    Comment


    • #22
      Lance,

      Yes, sorry, I should have mentioned that, I tested it with 2 files
      that totaled 15 meg. MASM does not use PBRES of course so the
      problem is related to the resource file format. I used the version
      of RC.EXE from the SDK.

      I guess that the resource functions LoadIcon etc.. fail due to
      the size of the binary resources so the only solution I can see
      in a hurry is to put the large resource files in a DLL.

      Regards,

      [email protected]

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

      www.masm32.com

      Comment


      • #23
        Steve,
        Does it make any difference where you have the binary data in the resource file?
        If the icon data preceeeds the binary data does it still fail?

        James


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

        Comment


        • #24
          James,

          I actually tried changing the order by putting the normal
          resources before and after but the Load#### functions failed
          when the large binary resources were included.

          Now I wondered as you have the expertise with the Borland
          resource editor and resource compiler if there is a way of
          doing this using the Borland tools. Somewhere it rings a bell
          to be able to bind a binary file to the end of a compiled EXE
          file but it is too long ago since I have seen it.

          I think in the short term that the only solution Edwin has is to
          put the binary resources in a DLL that uses no other resources.

          Regards,

          [email protected]

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

          www.masm32.com

          Comment


          • #25
            I suggested this to Edwin on the 18th, but no answer has yet been forthcoming as to whether he tried it out...

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

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

            Comment


            • #26
              Hmmm... Steve you have jolted by memory too - I remember that the "problem" required a "patch" app to be run against the compiled resource (or EXE?), but required Windows NT to solve the particular problem.

              Now If only I could remember wher this patch exactly solved (something do do with 64k boundaries, dword alignment, or...?)

              I'll see if I can find this info.


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

              Comment


              • #27
                I found it in MSDN, but is applies to 16-bit code accessing 32-bit resources, so this is probably not the answer to Edwin's problem.
                http://support.microsoft.com/support.../Q182/8/19.ASP



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

                Comment


                • #28
                  Folks --
                  what we discuss ?
                  Up to now Edwin doesn't show real not workable sample.
                  A sample, which he posted, really works after correction of code, at least on my PC.

                  He posted: RC file
                  FILE1 RCDATA "c:\windows\system\MSVBVM50.DLL"
                  FILE2 RCDATA "c:\windows\system\MSVBVM60.DLL"
                  HYPERHAND CURSOR "Hpoint.cur"

                  Code:
                     #Compile Exe
                     #Dim All
                     #Register None
                     #Resource "myrc.pbr"
                     #Include "win32api.inc"
                  
                     Function PbMain
                        Dim HYPERHAND As Long
                        HYPERHAND = LoadCurSor(GetModuleHandle(ByVal 0&), "HYPERHAND")
                        MsgBox Str$(HYPERHAND)
                        If HYPERHAND Then DeleteObject HYPERHAND
                     End Function
                  I understand that he made a mistake, when prepared demo-sample, so let's wait.


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

                  Comment


                  • #29
                    Hi
                    Earlier I tried to insert in RC a file 1500 bmp, each size 60kb and 1500 wav,each size 60 kb .PBRES has not apprehended it.
                    Now I make such data in hand-operated, in =hand-operated= format.

                    I think, that it is impossible to use a card file of the large size for PBRes.

                    V.Shulakov

                    ------------------
                    Spherical Panorama Inc. Virtual Reality for: Real Estate, Tourism Advertisment.

                    Comment


                    • #30
                      Semen,
                      I tried your example (copied)
                      It didn't work.
                      This is my resource:

                      Code:
                      FILE1 RCDATA "c:\windows\system\MSVBVM50.DLL"
                      FILE2 RCDATA "c:\windows\system\MSVBVM60.DLL"
                      
                      HYPERHAND CURSOR "Hpoint.cur"
                      Btw, i used the Gethinst() earlier wich is the same as your 'GetModuleHandle(ByVal 0&)'

                      This can't be a winapi.inc problem?
                      I use the last available one (see files section on pb)

                      Thanks,



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

                      Comment


                      • #31
                        Lance,

                        Yes i tried reordering and different files.
                        The first example used totaly diff. files the the example i put in the zip.
                        The BC5 ide shows the cursor from the res file properly.

                        Note that there's another entry made by the RC compiler.
                        The cursor_group, this is another RC_ index but this might be a problem somehow???

                        I can't imagne of a real RES problem under 32bits, it looks if i use the wrong command or it's a PB<>res problem?
                        There's also a suggestion to use loadimage, this is something i gonna try.

                        The DLL suggestion is something i certainly would do AFTER there's no other solution.
                        All RC_DATA in the DLL, cursor and icons in the exe.

                        Thanks,

                        BTW,
                        This is what i did in VB6, it DOES load the cursor!!

                        Code:
                        Option Explicit
                            
                        'Public Declare Function LoadImage Lib "user32" Alias "LoadImageA" (ByVal hInst As Long, ByVal lpsz As String, ByVal un1 As Long, ByVal n1 As Long, ByVal n2 As Long, ByVal un2 As Long) As Long
                        'Public Declare Function LoadIcon Lib "user32" Alias "LoadIconA" (ByVal hInstance As Long, ByVal lpIconName As String) As Long
                        Public Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
                        'Public Declare Function LoadCursor Lib "user32" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As String) As Long
                        Public Declare Function GetLastError Lib "kernel32" () As Long
                        'Public Declare Function FindResource Lib "kernel32" Alias "FindResourceA" (ByVal hInstance As Long, ByVal lpName As String, ByVal lpType As String) As Long
                        
                        Const IMAGE_CURSOR = 2
                        Const RT_CURSOR = 1&
                        Const RT_RCDATA = 10&
                            
                        Sub Main()
                        
                        'G:\TEMP>rc -r -v 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 G:\TEMP\RCa34745 -g G:\TEMP\RDa34745 -DRC_INVOKED -D_WIN32
                        '-pc\:/ -E -I. -I .
                        '
                        'MYRC.RC.
                        'Writing RCDATA:FILE1,   lang:0x409,     size 1355776.
                        'Writing RCDATA:FILE2,   lang:0x409,     size 1384448.
                        'Writing CURSOR:1,       lang:0x409,     size 748
                        'Writing GROUP_CURSOR:HYPERHAND, lang:0x409,     size 20
                        
                            Dim a As Long
                            Dim HYPERHAND As Long
                            Dim fRes As IPictureDisp
                            
                            Set fRes = LoadResPicture("HYPERHAND", vbResCursor)
                            
                            'HYPERHAND = LoadCursor(App.hInstance, "HYPERHAND")
                            'If Not HYPERHAND Then HYPERHAND = LoadImage(App.hInstance, "HYPERHAND", IMAGE_CURSOR, 0, 0, 0)
                            
                            MsgBox Str$(fRes) & "," & Str$(HYPERHAND) & "," & GetLastError()
                            
                            If HYPERHAND Then DeleteObject HYPERHAND
                            
                        End Sub

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

                        Comment


                        • #32
                          Tried it with PB5 and NO winapi.inc, no succes..

                          Code:
                          $Compile Exe
                          $Dim All
                          $Resource "myrc.pbr"
                          
                          DECLARE FUNCTION LoadCursor LIB "USER32.DLL" ALIAS "LoadCursorA" (BYVAL hInstance AS LONG, lpCursorName AS ASCIIZ) AS LONG
                          'DECLARE FUNCTION LoadImage LIB "USER32.DLL" ALIAS "LoadImageA" (BYVAL hInst AS LONG, lpsz AS ASCIIZ, BYVAL un1 AS LONG, BYVAL n1 AS LONG, BYVAL n2 AS LONG, BYVAL un2 AS LONG) AS LONG
                          DECLARE FUNCTION DeleteObject LIB "GDI32.DLL" ALIAS "DeleteObject" (BYVAL hObject AS LONG) AS LONG
                          
                          Function WinMain ( ByVal hCurInstance  As Long, _
                                             ByVal hPrevInstance As Long, _
                                             lpszCmdLine         As ASCIIZ PTR, _
                                             ByVal nCmdShow      As Long ) As Long
                          
                                Dim HYPERHAND As Long
                                HYPERHAND = LoadCursor( hCurInstance, "HYPERHAND")
                          
                          '      HYPERHAND = LoadImage( GetModuleHandle(ByVal 0&), "HYPERHAND", %IMAGE_CURSOR, 0, 0, 0 )
                          
                                MsgBox Str$(hCurInstance) & "," & Str$(HYPERHAND)
                          
                                If HYPERHAND Then DeleteObject HYPERHAND
                          
                          End Function
                          Btw, i've seen a c example to include these things in a more binary way (using labels:/DATA)
                          Maybe someone has an example to load things as RC_DATA or sort of?
                          (It's no hobby project!)



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

                          Comment


                          • #33
                            Edwin --
                            you reply suprised me so, that I decided to test again.
                            Compiled under Win2000. Works.
                            Rebooted to Win95b. W/o recompiling. Not works !
                            (Do you use 95b ?)
                            Windows-98SE. Works.

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

                            Comment


                            • #34

                              This is the line from my RC file,

                              2 RCDATA DISCARDABLE "Files.bin"
                              If the resource is discardable, you need to LockResource (and reload it if a null pointer comes back) before using it, so you don't try to use a discarded resource.

                              This might explain the different performance on different hardware.

                              MCM


                              Michael Mattias
                              Tal Systems (retired)
                              Port Washington WI USA
                              [email protected]
                              http://www.talsystems.com

                              Comment


                              • #35
                                Michael,

                                The RC_DATA seems to work (no problem found yet)
                                The icons and cursors aren't loadable AFTER ADDING big RC_DATA resources.

                                Semen,
                                In my 'system' : 4.00.950 B

                                Just one light in the darkness:

                                When files are smaller then ~1Mb, you may append a lot of these sizes, this does not have impact on the cursor.
                                I appended that much that the exe resulted in ~8Mb.
                                (But i do know about problems with much larger files tough!)

                                But this is at least solveable using a filesplit method (wich su**s of course)

                                Hope to here about a fix soon..

                                Thanks,




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

                                Comment


                                • #36
                                  A fix to what? What product have you identified the problem in?

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

                                  Comment


                                  • #37
                                    Sorry Lance.
                                    I wasn't talking about bugs.
                                    It just might be a setting in the rc file or something else. (API?)

                                    But it's weird that PB exe's have a problem while in VB the same res file does work.

                                    I have no other sollution found yet.


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

                                    Comment


                                    • #38
                                      Sorry PB,

                                      I can't help it, i studied the problem for days now.
                                      It seems that the combination PB exe <> big RC files doesn't work.
                                      VB does it well, borland can read the RES file properly.

                                      What to do?
                                      I can write work arounds but it should be possible to include larger RC files, it costs me to much time.

                                      Please help..

                                      Thanks,

                                      BTW, Semen said that this is a problem in Win95 (only).


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

                                      Comment


                                      • #39
                                        Edwin, if you care to email the code and the necessary resource files to me, and I'll take a look.

                                        However, before you do this, there are still a few things for you to try, because you have not given us all of the information on the problem yet:

                                        1. Have you searched MSDN for any suggestions? http://msdn.microsoft.com

                                        2. If you use another large resource in your resource (ie, not an RC_DATA resource) does it work?

                                        3. When the API's you use to load data from the embedded resource fail, what does GetLastError() return?

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

                                        Comment


                                        • #40
                                          I am a little surprised at the continuing questions here, Semen
                                          has addressed the problem as a Windows version type and the test
                                          piece I wrote in MASM, (READ Microsoft Assembler) has exactly
                                          the same limitation as the PowerBASIC version I tested so the
                                          problem has nothing to do with PowerBASIC or the utility PBRES.

                                          I also use win95c so as Semen has demonstrated, if you use and
                                          earlier versions, the technique disables the Load#### functions
                                          and as Microsoft Assembler is clearly not written by PowerBASIC,
                                          the problem is elsewhere.

                                          MASM uses the Microsoft linker from the DDK and the resource
                                          conversion utility called CVTRES.EXE that converts the RES file
                                          into an object module for linking.

                                          Now the right person to complain to about this failing is Steve
                                          Ballmer. If you did get a reply back, I imagine you would be told
                                          to BUY the later version that did not have the problem. If you wish
                                          to use an earlier version as I do, you need to find a work around
                                          to fix the problem.

                                          Regards,

                                          [email protected]

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

                                          www.masm32.com

                                          Comment

                                          Working...
                                          X