need help declaring an msg

This is a discussion on need help declaring an msg within the Windows Programming forums, part of the Platform Specific Boards category; i am a complete idiot at c programming and some of you guys are getting mad because i am but ...

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    44

    need help declaring an msg

    i am a complete idiot at c programming and some of you guys are getting mad because i am but if nobody helps then i dont learn and kids are your future. well anyway i need sombody to tell me how to declare msg and how do i have to do something for it get a value or what somebody told me to do this
    Code:
    MSG msg;
    but the comiler says

    Compiling...
    dontopen.cpp
    C:\Programs\dontopen\program.cpp(25) : error C2450: switch expression of type 'struct tagMSG' is illegal
    No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
    Error executing cl.exe.

    i dont understand what is wrong with this

  2. #2
    Even death may die... Dante Shamest's Avatar
    Join Date
    Apr 2003
    Location
    Malaysia
    Posts
    970
    >> but if nobody helps then i dont learn and kids are your future

    We don't want upstart kids to steal our jobs. So we'd be more than happy to let you remain ignorant and rely on purchasing our products.

    >> well anyway i need sombody to tell me how to declare msg

    Msg msg ;

    >> but the comiler says

    How are you trying to use it in a switch statement?


    Do you know basic C?

  3. #3
    Registered User Xzyx987X's Avatar
    Join Date
    Sep 2003
    Posts
    107
    If you are trying to learn windows proigramming and C at the same time, then I can tell you from experience that this is a very bad idea. I know programming console apps is boring and probobly doesn't seem like it could teach you anything usefull regarding windows programming, but trust me, it can.

  4. #4
    Registered User
    Join Date
    Mar 2004
    Posts
    44
    [QUOTE]Originally posted by Dante Shamest


    >> well anyway i need sombody to tell me how to declare msg

    Msg msg ;

    >> but the comiler says

    How are you trying to use it in a switch statement?
    Code:
    switch(msg){
    case WM_DESTROY:{}
    case WM_CLOSE:{}
    Do you know basic C?
    I do know basc c it but it has been a bit tough switching from linux to windows programming it would probably be easier the other way around

  5. #5
    Even death may die... Dante Shamest's Avatar
    Join Date
    Apr 2003
    Location
    Malaysia
    Posts
    970
    The switch statement only accepts integral types.
    You can't use msg, which is of type MSG.
    You should be using switch on the second parameter in your window procedure, which is of type UINT.

    >> I do know basc c it but it has been a bit tough switching from linux to windows programming

    The switch statement works the same whether you're programming for Linux or Windows.

  6. #6
    Registered User
    Join Date
    Mar 2004
    Posts
    44
    I never said it was the switch statement i am having trouble with it is the other bull$$$$ that windows puts me through

  7. #7
    Even death may die... Dante Shamest's Avatar
    Join Date
    Apr 2003
    Location
    Malaysia
    Posts
    970
    So is your problem solved yet?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. error msg instead of the result so far
    By maybabier in forum C Programming
    Replies: 25
    Last Post: 03-20-2009, 03:45 PM
  2. Display text in a Dialog Box
    By Dark_Phoenix in forum Windows Programming
    Replies: 9
    Last Post: 01-02-2009, 06:30 AM
  3. the handle is invalid
    By m37h0d in forum C++ Programming
    Replies: 17
    Last Post: 07-10-2008, 12:29 AM
  4. Replies: 10
    Last Post: 11-06-2005, 09:29 PM
  5. template fn replacements for msg macros
    By Ken Fitlike in forum Windows Programming
    Replies: 17
    Last Post: 10-30-2002, 07:55 AM

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