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. CString into a non-MFC app

CString into a non-MFC app

Scheduled Pinned Locked Moved C / C++ / MFC
xmlc++wcfcomjson
12 Posts 7 Posters 3 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.
  • J John R Shaw

    CString w/o MFC? No! I Thought I saw CString equivalent here at CP some where, or you could write your own. INTP

    C Offline
    C Offline
    CaesarCZ
    wrote on last edited by
    #3

    Thanks... I found it at http://www.codeproject.com/string/stdstring.asp... seems nice, unfortunately it also uses CArray (I'm currently looking if I might replace it somehow myself). Still if you new a way to add MFCs CArray (and CString eventauly) to a non-mfc project (I guess I'll have to link to the MFC dll anyway... All I need it to do is to be a WinAPI app that makes use of MFC... sounds weird, doesn't it... )

    1 Reply Last reply
    0
    • C CaesarCZ

      Hi, I'd like to use a XML parsing library (http://www.codeproject.com/soap/markupclass.asp) that uses CString (I guess that's the only MFC thing it uses). I'd like to use it in a pure WinAPI app, is there a way to add CString there:confused:? (which files/libs to link, never worked with MFC really). An alternate solution would be another XML library. Thanks for your answers

      P Offline
      P Offline
      PJ Arends
      wrote on last edited by
      #4

      In VC7.x CString is a shared class that is shared between MFC and ATL. AFAIK all you have to do is #include <atlstr.h> and you can use CString in non MFC apps. If you are using VC6 you are SOL.


      [

      ](http://www.canucks.com)"You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ???  You're definitely a superstar!!!" mYkel - 21 Jun '04 Within you lies the power for good - Use it!

      1 Reply Last reply
      0
      • C CaesarCZ

        Hi, I'd like to use a XML parsing library (http://www.codeproject.com/soap/markupclass.asp) that uses CString (I guess that's the only MFC thing it uses). I'd like to use it in a pure WinAPI app, is there a way to add CString there:confused:? (which files/libs to link, never worked with MFC really). An alternate solution would be another XML library. Thanks for your answers

        M Offline
        M Offline
        Michael Dunn
        wrote on last edited by
        #5

        You can also use WTL, which has minimal overhead and its CString is identical to MFC's --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- If my rhyme was a drug, I'd sell it by the gram.

        C 1 Reply Last reply
        0
        • M Michael Dunn

          You can also use WTL, which has minimal overhead and its CString is identical to MFC's --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- If my rhyme was a drug, I'd sell it by the gram.

          C Offline
          C Offline
          CaesarCZ
          wrote on last edited by
          #6

          Could you also, please please please, tell me if it has this CArray? Before I download and install it... Thanks

          M 1 Reply Last reply
          0
          • C CaesarCZ

            Could you also, please please please, tell me if it has this CArray? Before I download and install it... Thanks

            M Offline
            M Offline
            Michael Dunn
            wrote on last edited by
            #7

            You can use the ATL class CSimpleArray --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- Laugh it up, fuzzball.

            C 1 Reply Last reply
            0
            • M Michael Dunn

              You can use the ATL class CSimpleArray --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- Laugh it up, fuzzball.

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

              I know I'm being annoying, but does it have the same interface as teh MFC's CArray. Can I use it as a drop-in replacement (after a typedef of course) PS: I'm really sorry to be such a pain, but I really don't do MFC/ATL/WTL stuff at all (yes, I've looked up MSDN... lists less member functions that CArray, but it's only the ATL CSimpleArray - just really not sure about it all) thanks

              M 1 Reply Last reply
              0
              • C CaesarCZ

                I know I'm being annoying, but does it have the same interface as teh MFC's CArray. Can I use it as a drop-in replacement (after a typedef of course) PS: I'm really sorry to be such a pain, but I really don't do MFC/ATL/WTL stuff at all (yes, I've looked up MSDN... lists less member functions that CArray, but it's only the ATL CSimpleArray - just really not sure about it all) thanks

                M Offline
                M Offline
                Michael Dunn
                wrote on last edited by
                #9

                I haven't looked them both up and compared them, but you can look at CSimpleArray in atlbase.h --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- #include "witty-quote.h"

                1 Reply Last reply
                0
                • C CaesarCZ

                  Hi, I'd like to use a XML parsing library (http://www.codeproject.com/soap/markupclass.asp) that uses CString (I guess that's the only MFC thing it uses). I'd like to use it in a pure WinAPI app, is there a way to add CString there:confused:? (which files/libs to link, never worked with MFC really). An alternate solution would be another XML library. Thanks for your answers

                  P Offline
                  P Offline
                  peterchen
                  wrote on last edited by
                  #10

                  a) VC7 : makes the CStringT template available for both ATL and MFC projects b) WTL (clickety[^]) : provides a 1:1 CString clone for ATL/WTL projects under VC6. The ATL/WTL framework emphasizes "link on demand", so you could basically create a raw Win32 application/library with CString c) On Codeguru you'll find a macro that extracts the CString sources from your MFC library, so oyu can add them to any other project d) there are some CString clones[^]. However, with the availability of WTL, there's rarely a need, unless you need to be portable e) finally, you can "rip out" the WTL CString class. All that CString needs from the framework is the Ressource HINSTANCE for implementing LoadString and similar functions. (IIRC there are some more system-dependent elements, which can be easily replaced)


                  we are here to help each other get through this thing, whatever it is Vonnegut jr.
                  sighist || Agile Programming | doxygen

                  1 Reply Last reply
                  0
                  • J John R Shaw

                    CString w/o MFC? No! I Thought I saw CString equivalent here at CP some where, or you could write your own. INTP

                    M Offline
                    M Offline
                    Mike Nordell
                    wrote on last edited by
                    #11

                    John R. Shaw wrote: CString w/o MFC? No! IIRC, CString is nowadays (also) under the CPL - MS made it part of the WTL library which they made free software.

                    1 Reply Last reply
                    0
                    • C CaesarCZ

                      Hi, I'd like to use a XML parsing library (http://www.codeproject.com/soap/markupclass.asp) that uses CString (I guess that's the only MFC thing it uses). I'd like to use it in a pure WinAPI app, is there a way to add CString there:confused:? (which files/libs to link, never worked with MFC really). An alternate solution would be another XML library. Thanks for your answers

                      G Offline
                      G Offline
                      gamitech
                      wrote on last edited by
                      #12

                      ofcourse it is possible. to the best of my knowledge everything is possible. click the "Project" menu then choose Settings. In the "General" tab you will see that you project isn't currrently using MFC. You can choose to use MFC in a static LIBRARY or in a DLL. I f you choose to have it in a library you'll have to include these files in stdafx.h : #include // MFC core and standard components #include // MFC extensions #include // MFC Automation classes #include // MFC support for Internet Explorer 4 #include #include // MFC support for Windows Common I haven't used MFC in a dll and I don't know if you have to include them there but i know that you won't have to carry all those DLL's if you want to check your app on a computer without VC++ installed gabby

                      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