Thread: CString

  1. #1
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    937

    Unhappy CString

    I am string to use the class CString in my WIN32 program. It don't work . What must I include?
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

  2. #2
    S­énior Member
    Join Date
    Jan 2002
    Posts
    982
    You need to include afx.h and link to the MFC libraries.

  3. #3
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    937
    Is there a way to build (format) a string using just windows.h?
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

  4. #4
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    937
    I tried what you said, but I got an error about not being able to find a lib file. It isn't on my computer. The reason this is odd is I have another program that is 100% MFC that uses CString just great. What's the connection?
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

  5. #5
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    937
    How do you link to the MFC libraries?
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

  6. #6
    S­énior Member
    Join Date
    Jan 2002
    Posts
    982
    If you're using MSVC 6.0++ select Project-Settings. On the general tab select "Using MFC in a Static Library/Shared DLL".

  7. #7
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    937
    thanks
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

  8. #8
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    >Is there a way to build (format) a string using just windows.h?

    You can do it in plain ANSI C by using the sprintf function that does the same thing as CString::Format for character arrays. But if you got it working, use CString, it's simpler for adding and replacing
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Inserting a swf file in a windows application
    By face_master in forum Windows Programming
    Replies: 12
    Last Post: 05-03-2009, 11:29 AM
  2. Writing CObjects with Serialization to CArchive
    By ruben_gerad in forum C++ Programming
    Replies: 0
    Last Post: 11-09-2006, 08:25 AM
  3. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-29-2005, 11:21 PM
  4. Help with CString class and operator+ overloading
    By skanxalot in forum C++ Programming
    Replies: 2
    Last Post: 10-07-2003, 10:23 AM
  5. Operater overloading - (const char + CString)
    By auth in forum C++ Programming
    Replies: 14
    Last Post: 10-24-2002, 09:22 AM