Results 1 to 12 of 12

Thread: Win32 Application Tutorials Not Working....

  1. #1

    Thread Starter
    Hyperactive Member PlaGuE's Avatar
    Join Date
    Jun 2005
    Location
    in ur mind.
    Posts
    445

    Win32 Application Tutorials Not Working....

    This is stemmed from this topic i made @ http://vbforums.com/showthread.php?t=430985


    For Some Reason Ever Since i re-formatted my computer and re-installed everthing i needed to. Such as The Platform SDK(R2), DirectX 9 August 2006 SDK.
    I havent been able to compile projects that i used to be able to compile.

    For Example. This is just a simple app that prompts a mesage box upon loading.

    This is the code:
    VB Code:
    1. #include <windows.h>
    2.  
    3. int WINAPI WinMain( HINSTANCE hInstance,HINSTANCE hPrevInstance ,LPSTR lpCmdLine ,int nCmdShow){
    4.  
    5.     MessageBox( NULL , "Hello World!", "Win32 Tutorial" , MB_OK );
    6.  
    7.     return 0;
    8. }

    This used to run in VC++ 2005 Express Edition(Tho idk if it was still a Beta..LOL)

    Anyways....Is it just me... or do i need to get Visual Studio 2005 to fix this problem...

    However... This same example works with Dev-C++. But since i want to work with DirectX, im going to stick with VC++ 2005 Ex Ed... soon to be VS 2005.

    :For Those that hate double posters:
    You might think im double posting... but im not.This is a totally new question surrounding an old question
    Without balance, there could only be chaos.
    Without chaos, there could be no balance.
    I live with karma. Eat with destiny. Dream of life without shackles....
    Yet. If life had no consequences, life could not exist, nor could it flourish.


    If at first you dont succeed.You're screwed.

    C++/Java NOOB.

    I aint a professional at PHP, but if i can help i will.

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Win32 Application Tutorials Not Working....

    So what is the error?
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Hyperactive Member PlaGuE's Avatar
    Join Date
    Jun 2005
    Location
    in ur mind.
    Posts
    445

    Re: Win32 Application Tutorials Not Working....

    hehe...ooops.
    forgot error...

    Empty Project[Checked]:
    Code:
    ------ Build started: Project: messgebox, Configuration: Debug Win32 ------
    Compiling...
    winmain.cpp
    c:\documents and settings\hp_owner\my documents\visual studio 2005\projects\messgebox\messgebox\winmain.cpp(5) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [13]' to 'LPCWSTR'
            Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    Build log was saved at "file://c:\Documents and Settings\HP_Owner\My Documents\Visual Studio 2005\Projects\messgebox\messgebox\Debug\BuildLog.htm"
    messgebox - 1 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    Empty Project[Unchecked]:
    Code:
    ------ Build started: Project: asdf, Configuration: Debug Win32 ------
    Compiling...
    asdf.cpp
    c:\documents and settings\hp_owner\my documents\visual studio 2005\projects\asdf\asdf\asdf.cpp(10) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [13]' to 'LPCWSTR'
            Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    Build log was saved at "file://c:\Documents and Settings\HP_Owner\My Documents\Visual Studio 2005\Projects\asdf\asdf\Debug\BuildLog.htm"
    asdf - 1 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    This is using VC++ 2005 Express Edition..

    So would this be fixed by installing Visual Studio 2005?
    Without balance, there could only be chaos.
    Without chaos, there could be no balance.
    I live with karma. Eat with destiny. Dream of life without shackles....
    Yet. If life had no consequences, life could not exist, nor could it flourish.


    If at first you dont succeed.You're screwed.

    C++/Java NOOB.

    I aint a professional at PHP, but if i can help i will.

  4. #4
    Addicted Member
    Join Date
    Sep 2002
    Location
    Middle Earth
    Posts
    156

    Re: Win32 Application Tutorials Not Working....

    That MessageBox() call is expecting a Unicode string literal and it's getting a Single Byte Character Set literal. Putting an L in front of each string literal might resolve the problem:

    MessageBox( NULL , L"Hello World!", L"Win32 Tutorial" , MB_OK );

  5. #5

    Thread Starter
    Hyperactive Member PlaGuE's Avatar
    Join Date
    Jun 2005
    Location
    in ur mind.
    Posts
    445

    Re: Win32 Application Tutorials Not Working....

    hmm...k i'll try after work tomorrow.
    Without balance, there could only be chaos.
    Without chaos, there could be no balance.
    I live with karma. Eat with destiny. Dream of life without shackles....
    Yet. If life had no consequences, life could not exist, nor could it flourish.


    If at first you dont succeed.You're screwed.

    C++/Java NOOB.

    I aint a professional at PHP, but if i can help i will.

  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Win32 Application Tutorials Not Working....

    Better to wrap them in TEXT(), so that it works for both ANSI and UNICODE compiles.
    MessageBox( NULL , TEXT("Hello World!"), TEXT("Win32 Tutorial") , MB_OK );
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  7. #7

    Thread Starter
    Hyperactive Member PlaGuE's Avatar
    Join Date
    Jun 2005
    Location
    in ur mind.
    Posts
    445

    Re: Win32 Application Tutorials Not Working....

    *No Bump*

    was there some sort of an update since august 2005?
    Which is the last time i has re-installed "everything". Because i've been able to compile the tutorials from functionx.com/win32/ and gameprogrammer.org (win32 tutorials) since then.until last month...

    I just find it wierd.... cuz now ima have a harder time in learning C++/Win32/DirectX
    Without balance, there could only be chaos.
    Without chaos, there could be no balance.
    I live with karma. Eat with destiny. Dream of life without shackles....
    Yet. If life had no consequences, life could not exist, nor could it flourish.


    If at first you dont succeed.You're screwed.

    C++/Java NOOB.

    I aint a professional at PHP, but if i can help i will.

  8. #8
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Win32 Application Tutorials Not Working....

    Is it always the same error or different errors?
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  9. #9

    Thread Starter
    Hyperactive Member PlaGuE's Avatar
    Join Date
    Jun 2005
    Location
    in ur mind.
    Posts
    445

    Re: Win32 Application Tutorials Not Working....

    With Every tutorial its the same error.. but i guess i cant use those tuts anymore ... and i cant find any "newer" win32 Tutorials... so its hard for me to learn.


    BTW... I now have VS 2005 Standard Edition installed.(Just thought i let you know i dont use Express Edition, anymore..)



    What i guess im really trying to ask now is... Know any sites/books that offer Win32 Tutorials/Examples that were published since .... Jan 2006? lol..

    I tried looking thru MSDN for Win32 Examples/Tutorials... but i couldnt find any.
    Without balance, there could only be chaos.
    Without chaos, there could be no balance.
    I live with karma. Eat with destiny. Dream of life without shackles....
    Yet. If life had no consequences, life could not exist, nor could it flourish.


    If at first you dont succeed.You're screwed.

    C++/Java NOOB.

    I aint a professional at PHP, but if i can help i will.

  10. #10
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Win32 Application Tutorials Not Working....

    What error?

    Old tutorials should work. Aside from the instructions on how to set up a project, it's absurd that they wouldn't. After all, old programs need to work, too.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  11. #11

    Thread Starter
    Hyperactive Member PlaGuE's Avatar
    Join Date
    Jun 2005
    Location
    in ur mind.
    Posts
    445

    Re: Win32 Application Tutorials Not Working....

    the code in my first post used to work in VC++ 2005[Before Re-Formatting of HardDrive] and Dev-C++. But now it only works in Dev-C++. But when i do VC++ 2005 .... it errors unless i change the strings to "L"iteral strings...

    So maybe just maybe... i had an option on in VC++ 2005 that made strings literal... or... im just losing my mind... since i REALLY WANT TO LEARN C++/Win32.. So that i can go onto DirectX..

    also, im sorry if i keep ranting about the same thing... Its just... i want to learn... but i keep having road blocks, the size of grand canyon, in my way.
    Without balance, there could only be chaos.
    Without chaos, there could be no balance.
    I live with karma. Eat with destiny. Dream of life without shackles....
    Yet. If life had no consequences, life could not exist, nor could it flourish.


    If at first you dont succeed.You're screwed.

    C++/Java NOOB.

    I aint a professional at PHP, but if i can help i will.

  12. #12
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Win32 Application Tutorials Not Working....

    2005 has Unicode compilation enabled by default. Wrap every string literal in the TEXT() macro and it should work.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width