ICC_STANDARD_CLASSES doesn't exist?

This is a discussion on ICC_STANDARD_CLASSES doesn't exist? within the Windows Programming forums, part of the Platform Specific Boards category; I am trying create an edit box using the Windows API. Here is the code I'm using: Code: //Initialize the ...

  1. #1
    Registered User Xzyx987X's Avatar
    Join Date
    Sep 2003
    Posts
    107

    ICC_STANDARD_CLASSES doesn't exist?

    I am trying create an edit box using the Windows API. Here is the code I'm using:

    Code:
      //Initialize the Edit Control Class
    
       ecc->dwSize = sizeof(LPINITCOMMONCONTROLSEX);
       ecc->dwICC  = ICC_STANDARD_CLASSES;
    
       if(!InitCommonControlsEx(ecc))
       {
          MessageBox(NULL, "Edit Box Registration Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK);
    
          return 0;
       }
    
      //Create the Edit Box
    
      hwnd_edit = CreateWindowEx(
          0,
          EDIT,
          "Test",
          ES_AUTOVSCROLL | ES_MULTILINE | ES_READONLY,
          0,
          0,
          100,
          100,
          hwnd_main,
          NULL,
          GetModuleHandle(NULL),
          NULL);
    (Variable decalarations and includes are ommitted, but they are in the original code.) According to MSDN this is the correct wat to do it, but my compiler is telling me ICC_STANDARD_CLASSES isn't defined. It's supposed to be defined in commctrl.h which I did include properly, but it just isn't there. On top of that, the other control classes it mentions for use with those seem to work fine. I've tried this with multiple compilers and the same thing always happens. Does anyone know what the heck is going on here? Also, if you don't know the problem then can you at least reccomend an alternative method for creating an edit box. One thing though, I have to do it without using a recource script.
    Last edited by Xzyx987X; 09-11-2003 at 02:54 AM.

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    First...

    >>> ecc->dwSize = sizeof(LPINITCOMMONCONTROLSEX);

    ... lose the LP, you want the sizeof() the structure not of a pointer to a structure.

    The rest, I'm thinking you have version problems. Browse your commctrl.h file and see what it says.

    You need _WIN32_IE set to at least 0x0300 to use the structure at all, and 0x0400 to use the rest that are defined. MSDN says you need at least IE 4.7 level includes to use the flag you want.

    You probably need to update your SDK.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    Registered User Xzyx987X's Avatar
    Join Date
    Sep 2003
    Posts
    107
    Ah you're right, it was only set to 0x300. I just had a hard time believing the version was what was wrong since it failed on 3 seporate compilers... Where can I get the updated API includes?

    EDIT: Ok, I'm aware I can just serch on mircrosoft.com for it but their search is useless. I tried getting it for a half hour with no luck at all.
    Last edited by Xzyx987X; 09-11-2003 at 05:52 AM.

  4. #4
    Registered User Xzyx987X's Avatar
    Join Date
    Sep 2003
    Posts
    107
    Ok, well I managed to find the latest SDK on my own (I find it very annoying I have to use google to just find something on microsoft's website,) but now a new problem has come up. When I try to initate ICC_STANDARD_CLASSES the compiler says it still doesn't exist. After looking in commctrl.h I found it's definition:
    Code:
    #if (_WIN32_WINNT >= 0x501)
    #define ICC_STANDARD_CLASSES   0x00004000
    #define ICC_LINK_CLASS         0x00008000
    #endif
    So you have to be using a windows version that high to just make an edit box? Wtf? Ok, so I look in the platform SDK documentation and it says the edit control class is defined already in winuser.h (which is included by using windows.h) and the class self initializes, so I don't need to register the class to use it. But when I look in my shiny new winuser.h file, surpise, it isn't there at all. So what is this all about . I really don't get what's going on, it seems like the documentation is being self conflicting. Could someone with a little more experience in windows programming explain it to me?

  5. #5
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    >>>
    So you have to be using a windows version that high to just make an edit box?
    <<<

    Well, obviously not. We had edit boxes before Win2000! But that is not your question. Looking back at your original post, you are asking why your call to InitCommonControlsEx() is failing.

    We have, of course, assumed, that is what your problem is, however, you do not need to call this function simply to create an edit box, (which is not a "common control"), if that is what you are meaning?!?!?!???
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  6. #6
    Registered User Xzyx987X's Avatar
    Join Date
    Sep 2003
    Posts
    107
    Ok, well I reduced my former code from what I had to this:
    Code:
      hwnd_edit = CreateWindowEx(
          0,
          EDIT,
          "Test",
          ES_AUTOVSCROLL | ES_MULTILINE | ES_READONLY,
          0,
          0,
          100,
          100,
          hwnd_main,
          NULL,
          GetModuleHandle(NULL),
          NULL);
    According to what I read in the SDK docs EDIT is defined in winuser.h, but I checked it and it's not there. Is there something else I have to do here I'm missing?

  7. #7
    Registered User xds4lx's Avatar
    Join Date
    Nov 2001
    Posts
    630
    instead of EDIT try "EDIT"
    "only two things are infinite, the universe and human stupidity, and im not sure about the former." - albert einstein

  8. #8
    Registered User Xzyx987X's Avatar
    Join Date
    Sep 2003
    Posts
    107
    *Smacks myself on the head* Why didn't I think of that? Oh well, creating an edit box in this way can be pretty complicated, I can see why most people like recource scripts . You don't even get a scroll bar automatically this way... Oh btw, I also forgot to set the edit box to WS_VISABLE and WS_CHILD but I figured that out pretty quickly. Ok, so now that I've got that resolved, a few quick questions about edit box formatting. First, how do you end a line when setting the edit box text? I want to dispay a few paragraphs of text and making a new line by spacing it out is just plain messy. Second, Is it possible to make some text italic or bold while leaving other text normal? (Never mind this if it can only be done with a Rich Edit control. I see no need to set up one of those for a simple disclaimer like this.) I know how to change the font, but that has to be aplied in an all or none fashion. And last, how to you change the background color of the edit box? That last one may be a bit more complicated than I bargined for, but I don't think the grey backround of a static text box looks very good.
    Last edited by Xzyx987X; 09-12-2003 at 09:09 PM.

  9. #9
    Registered User johnnie2's Avatar
    Join Date
    Aug 2001
    Posts
    186
    You may be interested in MSDN's edit control section.
    "Optimal decisions, once made, do not need to be changed." - Robert Sedgewick, Algorithms in C

  10. #10
    Registered User Xzyx987X's Avatar
    Join Date
    Sep 2003
    Posts
    107
    I already did, but it doesn't explain anything about what I want to do. At the very least I need to know how to start an new line when setting text, the rest isn't that important.

  11. #11
    Registered User
    Join Date
    Jun 2003
    Posts
    245
    WindowStyles |= ES_MULTILINE

    then put \n at end of each line

  12. #12
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    A rich edit control may be required if you want multiple formats.
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  13. #13
    Registered User Xzyx987X's Avatar
    Join Date
    Sep 2003
    Posts
    107
    Originally posted by _Elixia_
    WindowStyles |= ES_MULTILINE

    then put \n at end of each line
    That's exactly what I did, but it didn't work. I believe for windows purpses you need both a line feed and carridge return to start a new line, but I don't know what I have to do to get it...
    Originally posted by bennyandthejets
    A rich edit control may be required if you want multiple formats.
    Yes, that's what I thought, but I really don't think going through all that trouble for what I'm doing is neccesary, so I'm not going to bother with it.

  14. #14
    Registered User xds4lx's Avatar
    Join Date
    Nov 2001
    Posts
    630
    "\r\n"
    "only two things are infinite, the universe and human stupidity, and im not sure about the former." - albert einstein

  15. #15
    Registered User
    Join Date
    Jun 2003
    Posts
    245
    I did think about "\r\n" but I thought that was required for file i/o only, and not be general text boxes, guess I've been using gui classes far too much

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 06-16-2008, 01:18 PM
  2. Compiler error in whitespace that doesn't even exist
    By beanroaster in forum C++ Programming
    Replies: 2
    Last Post: 09-09-2005, 10:27 PM
  3. How to insert data to the top of exist text file?
    By ooosawaddee3 in forum C++ Programming
    Replies: 4
    Last Post: 08-16-2005, 08:08 AM
  4. Mount: special device /dev/hdb5 doesnt exist.
    By Bajanine in forum Tech Board
    Replies: 8
    Last Post: 04-19-2004, 04:10 PM
  5. How to check a directory is exist or not?
    By Unregistered in forum C++ Programming
    Replies: 6
    Last Post: 03-23-2002, 09:13 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21