Announcement

Collapse
No announcement yet.

Resourcequestion - value as string

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

  • Resourcequestion - value as string

    I wrote a 'system' where i can obtain a string from a RCDATA using indexes like:

    100L, "HELLO\0"
    101L, "HELLO TOO\0"

    The hello part is used to store flags as well (not shown).
    I just wonder how i can do something like this:

    100L, "1 or 2 or 8"
    Of course, this remains text, i need the or'd flag but in readable text.
    It should be "11"

    I don't think it is possible but would like to try.
    hellobasic

  • #2
    Sigh.. must had a clear mind today, found it myself (PwrDev code):

    Code:
    TEST RCDATA
    {    
         100L,  "1|2|8"
                "\0"
    }
    Code:
    Function Test() As Long
    
        Local T As String
        Local a As Long
        Local dwFlags As Dword
    
        T = VD_RES_LoadDataString( VD_App.hInstance, "TEST", 100 )
    
        For a = 1 To ParseCount( T, "|" )
            dwFlags = dwFlags Or Val( Parse$( T,"|", a ) )
        Next
    
        MsgBox Format$( dwFlags )
    
    End Function
    hellobasic

    Comment


    • #3
      ..
      Last edited by Edwin Knoppert; 13 Dec 2008, 05:39 AM.
      hellobasic

      Comment


      • #4
        Why not just store the OR'd flags as an integer in the resource?
        Code:
        #define flags  1L|2L|8L
        TEST  RCDATA
        begin
            flags
        end
        Something like that, anyway.

        For all I know this might work...
        Code:
        TEST RCDATA
        BEGIN
            1L | 2L | 8L 
        END
        ... but that I've never tried.

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

        Comment


        • #5
          I would need to write me a new system then.
          The above works for me fine, i am using defines and looks good.

          Your code does work as well, the L makes it a dword and is interesting for prefilling structures for example..
          I am using RCDATA a lot, so handy.
          hellobasic

          Comment


          • #6
            >I am using RCDATA a lot, so handy

            Gee, no kidding. Nice to know someone finally got some use out of that that demo I posted almost SIX YEARS AGO. All in all, kind of inspiring. Gives me that warm and fuzzy feeling I crave from time to time.

            User-Defined Resource Demo January 26 2003
            Michael Mattias
            Tal Systems (retired)
            Port Washington WI USA
            [email protected]
            http://www.talsystems.com

            Comment


            • #7
              Oh boy, you really thought..?
              hellobasic

              Comment

              Working...
              X