Thread: afxwin.h, Surface and CPalette classes

  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    222

    afxwin.h, Surface and CPalette classes

    I'm trying to use the Surface and CPalette classes that are supported in windows API. I'm aware that CPalette class is included in afxwin.h. I've searched through a few forums (including this one) that it has to do with MFC not supported or the libraries/headers not being installed when Visual Studio was installed. However, I've checked on my IDE's installation and I believe it should be including afxwin.h. My goal is basically create device surface and palette objects perhaps using these methods rather than using EngXXX functions that are with the GDI technology that perform the same operations. It would be much appreciated if you can provide some recommendations if I were to use these two classes and how the problem with afxwin.h not being able to be included could be solved. Thanks.

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Afxwin.h is a MFC header. You don't include it manually.
    You create an MFC project instead. Then you can use those classes.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Registered User
    Join Date
    Jul 2004
    Posts
    222
    Elysia: thanks for the reply: I got confused about afxwin.h. So if the project is anything but a MFC project, I can't use that header file as well as classes that afxwin.h supports?

  4. #4
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Exactly.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5
    Registered User
    Join Date
    Jul 2004
    Posts
    222
    From what I have read on the MSDN documentation on EngCreatePalette, it creates an RGB palette. If I were to go around this function, the closest thing that I have come across is color palettes (http://msdn.microsoft.com/en-us/libr...38(VS.85).aspx). Am I totally far off between what I'm aiming to do with EngCreatePalette function originally and creating a logical palette and then using a handle to point to that palette?

  6. #6
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    I'm afraid I don't know much about drawing and palettes. However, MFC is mostly emulating GDI, so it shouldn't be that difficult to "reverse engineer" what it's doing.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #7
    Registered User
    Join Date
    Jul 2004
    Posts
    222
    After doing some hacking on the code and reading more documentation from MSDN, I found out that there is no viable alternative other than that EngXXX method for that function. So I guess I solved the problem (at least for now anyway).

Popular pages Recent additions subscribe to a feed