CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2007
    Location
    France
    Posts
    329

    error RC2108 : expected numerical dialog constant

    Hello,

    I have this error on the EDITEXT line when I try to compile this resource file.
    I checked MSDN, the definition of EDITTEXT seems to be fine.
    If I remove "pass", I get a second error too: error RC2116 : expecting number for ID
    I use rc.exe on VS2022.

    Code:
    #include <windows.h>
    
    IDD_PASSWORD_DIALOG DIALOG 0, 0, 200, 100
    STYLE DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
    CAPTION "Enter Password"
    FONT 8, "MS Sans Serif"
    #define IDC_PASSWORD 1012
    
    
    BEGIN
        EDITTEXT        IDC_PASSWORD,"pass",10,10,180,20,ES_PASSWORD | WS_BORDER | WS_TABSTOP
        PUSHBUTTON      IDOK,"OK",10,40,90,20,WS_TABSTOP
        PUSHBUTTON      IDCANCEL,"Cancel",100,40,90,20,WS_TABSTOP
    END
    Last edited by MasterDucky; November 2nd, 2023 at 04:49 AM.

  2. #2
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,821

    Re: error RC2108 : expected numerical dialog constant

    EDITTEXT doesn't take a name as the 2nd param. It's format is:

    Code:
    EDITTEXT id, x, y, width, height [, style [, extended-style]]
    See https://learn.microsoft.com/en-us/wi...ittext-control
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  3. #3
    Join Date
    Dec 2007
    Location
    France
    Posts
    329

    Re: error RC2108 : expected numerical dialog constant

    Yes, but the ID was defined above.

    And even if I just put a number in the place of IDC_PASSWORD I get the same error.

  4. #4
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,821

    Re: error RC2108 : expected numerical dialog constant

    This should compile:

    Code:
    EDITTEXT        IDC_PASSWORD, 10, 10, 180, 20, ES_PASSWORD | WS_BORDER | WS_TABSTOP
    You can't use "pass" as I'm guessing for a title with EDITTEXT. EDITTEXT doesn't take a title as a param.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  5. #5
    Join Date
    Dec 2007
    Location
    France
    Posts
    329

    Re: error RC2108 : expected numerical dialog constant

    Code:
    PUSHBUTTON		IDOK,"OK",10,40,90,20,WS_TABSTOP
    It wont compile, I get error on next line:. error RC2116 : expecting number for ID

  6. #6
    Join Date
    Dec 2007
    Location
    France
    Posts
    329

    Re: error RC2108 : expected numerical dialog constant

    I found it:

    Its text first, ID after.

    Code:
    PUSHBUTTON        "OK", IDOK,10,40,90,20,WS_TABSTOP
    Thanks for the help!

  7. #7
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,382

    Re: error RC2108 : expected numerical dialog constant

    Quote Originally Posted by MasterDucky View Post
    I found it:

    Its text first, ID after.

    Code:
    PUSHBUTTON        "OK", IDOK,10,40,90,20,WS_TABSTOP
    Thanks for the help!
    I wonder, do you create your resource file from scratch? Without using the Resource Editor?
    Victor Nijegorodov

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured