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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Converting DWORD

Converting DWORD

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorial
8 Posts 6 Posters 1 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.
  • H Offline
    H Offline
    hrishi321
    wrote on last edited by
    #1

    Hi can any one please tell me how to convert one DWORD to CString in VC++. (Both in Hex and decimal Formate)

    E 1 Reply Last reply
    0
    • H hrishi321

      Hi can any one please tell me how to convert one DWORD to CString in VC++. (Both in Hex and decimal Formate)

      E Offline
      E Offline
      Eugen Podsypalnikov
      wrote on last edited by
      #2

      Try it :) :

      DWORD dwTest(1234);

      CString cszTest;
      cszTest.Format(_T("DEC: %u; HEX: 0x%08x"), dwTest, dwTest);

      virtual void BeHappy() = 0;

      H 1 Reply Last reply
      0
      • E Eugen Podsypalnikov

        Try it :) :

        DWORD dwTest(1234);

        CString cszTest;
        cszTest.Format(_T("DEC: %u; HEX: 0x%08x"), dwTest, dwTest);

        virtual void BeHappy() = 0;

        H Offline
        H Offline
        hrishi321
        wrote on last edited by
        #3

        Hi Thanks for your kind reply.. I tried the way, but i guess it is showing me the memory location DWORD dwTest(0xFFFFFFFF); CString cszTest; cszTest.Format(_T("DEC: %u HEX: 0x%08x"), dwTest, dwTest); cout<<cszTest; I am getting a output of 0036AA20

        CPalliniC C K 3 Replies Last reply
        0
        • H hrishi321

          Hi Thanks for your kind reply.. I tried the way, but i guess it is showing me the memory location DWORD dwTest(0xFFFFFFFF); CString cszTest; cszTest.Format(_T("DEC: %u HEX: 0x%08x"), dwTest, dwTest); cout<<cszTest; I am getting a output of 0036AA20

          C Offline
          C Offline
          Cool_Dev
          wrote on last edited by
          #4

          problem may be with cout and unicode. To ensure it, try with _tprintf(_T("%s", cszTest)); I don't know whether there is any unicode version of cout.

          L 1 Reply Last reply
          0
          • H hrishi321

            Hi Thanks for your kind reply.. I tried the way, but i guess it is showing me the memory location DWORD dwTest(0xFFFFFFFF); CString cszTest; cszTest.Format(_T("DEC: %u HEX: 0x%08x"), dwTest, dwTest); cout<<cszTest; I am getting a output of 0036AA20

            CPalliniC Offline
            CPalliniC Offline
            CPallini
            wrote on last edited by
            #5

            hrishi321 wrote:

            cout< try changing change it to:

            CT2A pszTestA( cszTest );
            cout << (LPCSTR) pszTestA;

            :)

            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
            [My articles]

            In testa che avete, signor di Ceprano?

            1 Reply Last reply
            0
            • H hrishi321

              Hi Thanks for your kind reply.. I tried the way, but i guess it is showing me the memory location DWORD dwTest(0xFFFFFFFF); CString cszTest; cszTest.Format(_T("DEC: %u HEX: 0x%08x"), dwTest, dwTest); cout<<cszTest; I am getting a output of 0036AA20

              K Offline
              K Offline
              KingsGambit
              wrote on last edited by
              #6

              If the project setting is UNICODE, you may have to use as follows: wcout << (LPCTSTR)cszTest; Give it a try if cout is not working :)

              1 Reply Last reply
              0
              • C Cool_Dev

                problem may be with cout and unicode. To ensure it, try with _tprintf(_T("%s", cszTest)); I don't know whether there is any unicode version of cout.

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                Cool_Dev wrote:

                I don't know whether there is any unicode version of cout.

                wcout[^]

                txtspeak is the realm of 9 year old children, not developers. Christian Graus

                C 1 Reply Last reply
                0
                • L Lost User

                  Cool_Dev wrote:

                  I don't know whether there is any unicode version of cout.

                  wcout[^]

                  txtspeak is the realm of 9 year old children, not developers. Christian Graus

                  C Offline
                  C Offline
                  Cool_Dev
                  wrote on last edited by
                  #8

                  yep.. got it from Rajeesh's post :thumbsup:

                  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