Macro - Extracting a number from a string

Dear group, 

I got the String from PslSourceString.Description[1]. This string contains the resource ID from MFC application. How could I extract this number from this text? 

The containing numbers could have 1 to more than 5 digits. Also the text in front of the number is not the same[2]

 

[1] E. g. : Zeichenkette 15002 in String Table

 

[2] Examples: 

3 Replies Latest Replies: 13 Jul 2018 1:26 PM by Achim Herrmann
  • Instead of interpreting the

    PslSourceString.Description

    property you can directly access the numerical or alpha-numerical resource ID using

    PslSourceString.Resource.ID

  • In reply to Achim Herrmann:

    I've troubles to identify my MFC IDs correctly:

    How2 get the ID of the checkbox in the dialog? 
    The ID of the MFC container (dialog) is correct with PslSourceString.Resource.ID
    But how2 get the ID of the checkbox? 

    Also in strings...

    How2 get the ID of the string? 

    BTW: PslSourceString.Resource.IDName seems to be always empty. 

  • In reply to Alexander Sailer:

    For standard resources in dialogs like the checkbox please use

        PslSourceString.ID

    In MFC StringTable resources that are internally organized in blocks with 16 entries you have to calculate the ID

        If PslSourceString.ResType = "StringTable" Then
            MsgBox "ID: " & ((PslSourceString.Resource.ID - 1) * 16 + PslSourceString.ID)
        End If

    It is true that PslSourceString.Resource.IDName is empty in binary MFC and other resources, but when parsing the RC file this will be set with the mnemonic name from the RC file. The allows you to have both the numerical ID and the mnemonic ID.


Related