Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CDialogTemplate

CDialogTemplate

Scheduled Pinned Locked Moved C / C++ / MFC
help
9 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    p_1960
    wrote on last edited by
    #1

    Hi, when im trying to use... CDialogTemplate dlt; LPCTSTR ID=_T("IDD_TESTDLG_DIALOG"); if (!dlt.Load(ID)) return -1; the issue is eventhough the ID is correct but the above if statement returns -1 but if i use if (!dlt.Load(MAKEINTRESOURCE(CTestDlg::IDD))) return -1; the above statement doesn"t return -1.. Please help me regarding the same...

    D O 2 Replies Last reply
    0
    • P p_1960

      Hi, when im trying to use... CDialogTemplate dlt; LPCTSTR ID=_T("IDD_TESTDLG_DIALOG"); if (!dlt.Load(ID)) return -1; the issue is eventhough the ID is correct but the above if statement returns -1 but if i use if (!dlt.Load(MAKEINTRESOURCE(CTestDlg::IDD))) return -1; the above statement doesn"t return -1.. Please help me regarding the same...

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      p_1960 wrote:

      if (!dlt.Load(MAKEINTRESOURCE(CTestDlg::IDD))) return -1;

      You might change this to:

      LPTSTR ID2 = MAKEINTRESOURCE(CTestDlg::IDD);
      if (! dlt.Load(ID2)) return -1;

      and use the preprocessor's output to see if ID2 contains a different value that ID.

      "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      S 1 Reply Last reply
      0
      • D David Crow

        p_1960 wrote:

        if (!dlt.Load(MAKEINTRESOURCE(CTestDlg::IDD))) return -1;

        You might change this to:

        LPTSTR ID2 = MAKEINTRESOURCE(CTestDlg::IDD);
        if (! dlt.Load(ID2)) return -1;

        and use the preprocessor's output to see if ID2 contains a different value that ID.

        "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

        "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

        S Offline
        S Offline
        siva455
        wrote on last edited by
        #3

        Thanks for ur Reply David .... but the issue is with the below lines.. CDialogTemplate dlt; LPCTSTR ID=_T("IDD_TESTDLG_DIALOG"); if (!dlt.Load(ID)) return -1; the above code is returning -1 which is undesirable because ID is correct... the issue is i have id as String like _T("IDD_TESTDLG_DIALOG")(ie im getting the ID of the resource as a String instead of CTestDlg::IDD) ... Please correct me if im wrong....

        D 1 Reply Last reply
        0
        • S siva455

          Thanks for ur Reply David .... but the issue is with the below lines.. CDialogTemplate dlt; LPCTSTR ID=_T("IDD_TESTDLG_DIALOG"); if (!dlt.Load(ID)) return -1; the above code is returning -1 which is undesirable because ID is correct... the issue is i have id as String like _T("IDD_TESTDLG_DIALOG")(ie im getting the ID of the resource as a String instead of CTestDlg::IDD) ... Please correct me if im wrong....

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          The point of the exercise was to compare the two (i.e., ID vs. ID2). MAKEINTRESOURCE() is a macro that the preprocessor will expand, which is why I suggested a temporary variable.

          "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

          "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

          P 1 Reply Last reply
          0
          • D David Crow

            The point of the exercise was to compare the two (i.e., ID vs. ID2). MAKEINTRESOURCE() is a macro that the preprocessor will expand, which is why I suggested a temporary variable.

            "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

            "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

            P Offline
            P Offline
            p_1960
            wrote on last edited by
            #5

            ya..but MAKEINTRESOURECE converts an integer value to a resource type ... but in the case of CDialogTemplate dlt; LPCTSTR ID=_T("IDD_TESTDLG_DIALOG"); if (!dlt.Load(ID)) return -1; i need to pass id as String instead of integer...the doubt it is not working is i send id as string... Sorry for inconvenience caused ....

            D 1 Reply Last reply
            0
            • P p_1960

              ya..but MAKEINTRESOURECE converts an integer value to a resource type ... but in the case of CDialogTemplate dlt; LPCTSTR ID=_T("IDD_TESTDLG_DIALOG"); if (!dlt.Load(ID)) return -1; i need to pass id as String instead of integer...the doubt it is not working is i send id as string... Sorry for inconvenience caused ....

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              p_1960 wrote:

              ya..but MAKEINTRESOURECE converts an integer value to a resource type ...

              It returns a LPTSTR.

              p_1960 wrote:

              i need to pass id as String instead of integer...the doubt it is not working is i send id as string...

              Did you look at the preprocessor's output?

              "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

              "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

              P 1 Reply Last reply
              0
              • D David Crow

                p_1960 wrote:

                ya..but MAKEINTRESOURECE converts an integer value to a resource type ...

                It returns a LPTSTR.

                p_1960 wrote:

                i need to pass id as String instead of integer...the doubt it is not working is i send id as string...

                Did you look at the preprocessor's output?

                "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

                "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                P Offline
                P Offline
                p_1960
                wrote on last edited by
                #7

                ya it"s not recognising the ID which sent as string but it is working fine if i pass ID AS integer.. Pls let me know...

                D 1 Reply Last reply
                0
                • P p_1960

                  ya it"s not recognising the ID which sent as string but it is working fine if i pass ID AS integer.. Pls let me know...

                  D Offline
                  D Offline
                  David Crow
                  wrote on last edited by
                  #8

                  p_1960 wrote:

                  ya...

                  So what is its output?

                  p_1960 wrote:

                  ...it"s not recognising the ID which sent as string but it is working fine if i pass ID AS integer.. Pls let me know...

                  You may want to re-read this thread to understand exactly what it is that I am asking of you.

                  "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

                  "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                  1 Reply Last reply
                  0
                  • P p_1960

                    Hi, when im trying to use... CDialogTemplate dlt; LPCTSTR ID=_T("IDD_TESTDLG_DIALOG"); if (!dlt.Load(ID)) return -1; the issue is eventhough the ID is correct but the above if statement returns -1 but if i use if (!dlt.Load(MAKEINTRESOURCE(CTestDlg::IDD))) return -1; the above statement doesn"t return -1.. Please help me regarding the same...

                    O Offline
                    O Offline
                    Ozer Karaagac
                    wrote on last edited by
                    #9

                    Dialog name IDs should be either a string or a 16-bit unsigned integer. If you remove dialog id definition (#define IDD_TESTDLG_DIALOG number) from the file named "resource.h", it will work. Or you should enter that name with double quotes (like "IDD_TESTDLG_DIALOG") as dialog ID of dialog properties.

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups