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:
#include <windows.h>
int WINAPI WinMain( HINSTANCE hInstance,HINSTANCE hPrevInstance ,LPSTR lpCmdLine ,int nCmdShow){
MessageBox( NULL , "Hello World!", "Win32 Tutorial" , MB_OK );
return 0;
}
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
Re: Win32 Application Tutorials Not Working....
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?
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 );
Re: Win32 Application Tutorials Not Working....
hmm...k i'll try after work tomorrow.
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 );
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
Re: Win32 Application Tutorials Not Working....
Is it always the same error or different errors?
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.
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.
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.
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.