I don't think that if you are trying to learn CLR that example is what you want.
Have you tryed something at MSDN? There you could get a great assistance specific for Visual C++
To make that example working, follow these steps:
> Create a new empty project
> Add WinTut.cpp and WinTut.h in your project directory
> From meny 'Project' select 'Add existing item' and add those files to your project
> in line 2 modify #include <windows> in #include <windows.h>
After that on my Visual C++ works
Thank you for your reply. Well, your procedure is exactly the same that I have been trying to. I think it should work just that way. But for me it doesn't ...
Did you build a solution with 2008 Express Edition? Have you installed a Windows SDK also? I have installed MSDN Express Library but don't have MFC libraries. Don't know if that should be for this code.
I agree that this might not be the best example, but I really would like to learn how to make use of existing code. It might be very useful in some another case and another code.
Thank you for your reply. I think I'll install Windows SDK also and have a look if it helps. I have also disabled a few services manually, must check if there is something to correct, f.e. "Windows Driver Foundation" or "COM+ System Applications".
I believe i am having the same problems. I took the code and made a project out of it, when i compiled i got one error. It was #include <windows> instead of #include <windows.h> . after fixing that i got 4 errors which include:
1 2 3 4 5 6 7 8 9 10 11 12 13
1
1>Compiling...
1>WinTut.cpp
1>c:\documents and settings\scott\desktop\wintut\wintut.cpp(21) : error C2440: '=' : cannot convert from 'const char [12]' to 'LPCWSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\documents and settings\scott\desktop\wintut\wintut.cpp(26) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [39]' to 'LPCWSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\documents and settings\scott\desktop\wintut\wintut.cpp(29) : error C2664: 'CreateWindowExW' : cannot convert parameter 2 from 'const char [12]' to 'LPCWSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\documents and settings\scott\desktop\wintut\wintut.cpp(33) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [28]' to 'LPCWSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>Build log was saved at "file://c:\Documents and Settings\Scott\My Documents\Visual Studio 2008\Projects\Wintut\Wintut\Debug\BuildLog.htm"
1>Wintut - 4 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
any help would be much appreciated. I'm new to c++ so try to be specific in your responses. Thanks ahead of time!
when you say widen, do you mean change the numbers to larger numbers or change the const char's to wchar_t? also what is strpy() IIRC. i have never seen that in my life =)
A char is 1 byte long and contains just a few characters, a wchar_t is 2 bytes long and it contains many character sets (used for non-latin alphabets).
string made of chars: "Hello"
string made of wchar_ts: L"Hello"
Add an 'L' before every string and your program will compile