Announcement

Collapse
No announcement yet.

Trouble with RC file

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

  • Semen Matusovski
    replied
    Edwin --
    I'm sure that this is exactly OS version problem.
    It looks that somewhere in API functions is used only 20 bits to store the length of resource.
    So maximum size of single resource under Win95 is 1048575bytes.


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

    Leave a comment:


  • Lance Edmonds
    replied
    Another idea would be to try EnumResourceNames() on the problematic resource file...

    James, your "shot in the dark" theory on unicode could be a good place to start researching the problem...

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

    Leave a comment:


  • jcfuller
    replied
    Lance,
    I'm just shooting in the dark here but it may have something to do with
    Unicode and the way VB handles it in resources???

    James


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

    Leave a comment:


  • Lance Edmonds
    replied
    I realize that the problem appears to be an O/S version issue, but Edwin's comments that VB does not have the same problem intrigues me.

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

    Leave a comment:


  • Steve Hutchesson
    replied
    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]

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

    Leave a comment:


  • Lance Edmonds
    replied
    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>

    Leave a comment:


  • Guest's Avatar
    Guest replied
    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).


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

    Leave a comment:


  • Guest's Avatar
    Guest replied
    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.


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

    Leave a comment:


  • Lance Edmonds
    replied
    A fix to what? What product have you identified the problem in?

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

    Leave a comment:


  • Guest's Avatar
    Guest replied
    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,




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

    Leave a comment:


  • Michael Mattias
    replied

    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


    Leave a comment:


  • Semen Matusovski
    replied
    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.

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

    Leave a comment:


  • Guest's Avatar
    Guest replied
    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!)



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

    Leave a comment:


  • Guest's Avatar
    Guest replied
    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

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

    Leave a comment:


  • Guest's Avatar
    Guest replied
    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,



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

    Leave a comment:


  • Vladimir Shulakov
    replied
    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

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

    Leave a comment:


  • Semen Matusovski
    replied
    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.


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

    Leave a comment:


  • Lance Edmonds
    replied
    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>

    Leave a comment:


  • Lance Edmonds
    replied
    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>

    Leave a comment:


  • Lance Edmonds
    replied
    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>

    Leave a comment:

Working...
X