|
You might be using unicode build( which is default in vs2005 and later ). so should pass unicode string to MessageBox() function. To convert your string to unicode. use _T macro.
MessageBox( _T("This is my first Visual C++ Application!"));
|
|
|
|
|
You are building for Unicode and therefore trying to pass an ANSI string to an API which expects an Unicode string. Include all your literal strings within the TEXT macro.
anassamar wrote: MessageBox("This is my first Visual C++ Application!");
MessageBox(_T("This is my first Visual C++ Application!"));
The _T macro automatically emits an ANSI or an Unicode string (by prefixing nothing if building for MBCS or by prefixing L to the literal string if building for Unicode)
These links may help you further to understand about string data types:
The Complete Guide to C++ Strings, Part I - Win32 Character Encodings[^]
The Complete Guide to C++ Strings, Part II - String Wrapper Classes[^]
This might help you with International programming and Unicode:
International programming[^]
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
推荐网站www.codeproject.com 和 www.codeguru.com,在这里可以找到
|
|
|
|
|
Hi all,
I want to close a messagebox without clicking its button or without pressing Esc.
can u please tell me how can i do this.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
modified on Thursday, May 28, 2009 7:03 AM
|
|
|
|
|
"_$h@nky_" wrote: I want to open close a messagebox without clicking its button or without pressing Esc.
That makes no sense at all! Do you want to close a message box or show it? Is it really difficult to even clearly explain what you want?!
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
|
search for timed message box on code project or google for it.
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
EndDialog()
Setup a timer for that job
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
"_$h@nky_" wrote: can u please tell me how can i do this.
Here is one example.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
open the messagebox on a separate thread and kill that thread when you need to close it
Marius
~~~~~~~~~~~~~~
.NET developer
|
|
|
|
|
Hello
I am trying to convert from "String ^" to std::String on VC++ 2005. I use this piece of code:
std::string s;
String ^ ss = "hello";
s = ss;
I have got the following error:
error C2679: binary '=' : no operator found which takes a right-hand operand of type 'System::String ^' (or there is no acceptable conversion)
Any idea?
Thanks
|
|
|
|
|
You must have posted your query at the managed c++ forum. This board is for queries on native language programming (the actual stuff). Besides that, Why would you be converting a String to std::string ?!
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
ops, sorry for the mistake. The reason I need the converion is because I am merging code from different VC projects and versions. Some code use std::string variables and the other system::String ^
Thanks. I will post it in the correct place
|
|
|
|
|
If only it were that simple...
Here's my attempt at code that gets the raw wide characters from a CLR String into a std::wstring - I'll leave the conversion to ASCII to you - there are plenty of examples of how to do that part of it...
String^ ss = "hello";
std::wstring s;
array<wchar_t>^ chars = ss->ToCharArray();
pin_ptr<wchar_t> charPtr = &chars[0];
s = std::wstring(charPtr, charPtr+ss->Length);
Microsoft's suggested solution is here[^].
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
|
Hi all!
i have injected the kernel32.dll for the "CreateFileW" and i have customized the funcation.
i wana log only the files created by the user not by the system exe and dll and processes.
i have filtered by using "dwCreationDisposition" and dwFlagsAndAttributes
even though i cant filter some of the files created temperarily and some exe files.
has anybody known any filtering techniques in the kernel.
i welcome if someone leads me for a good technique
Thanks all!
Regards
Jack
|
|
|
|
|
I added a static variable in a file "shared.h"
static bool bDone;
and inclued in "shared.h" in two file "abc.cpp" and "xyz.cpp"
because I want to set the value in "abc.cpp" and use it in "xyz.cpp".
But when I do this I get the below linker error
error LNK2001: unresolved external symbol "public: static bool bDone, before addition of this variable every thing compiles fine
Please advice
|
|
|
|
|
By declaring it static , you've restricted the scope of that variable to the file where it is declared. You might want to look into the keyword extern (declare the variable globally without the static keyword and declare it as extern where you are trying to use it)
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
so in my case I should do as below
Shared.h
bool bDone;
abc.h
#include "Shared.h"
extern bDone;
xyz.h
#include "Shared.h"
extern bDone;
If I am not worng
|
|
|
|
|
Are you going to wait until I say "yes, go ahead"? Why not try it in the IDE and ask queries if it didn't work?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Now I get the below error
error LNK2005: "bool m_Cursor" (?m
.exe : fatal error LNK1169: one or more multiply defined symbols found
|
|
|
|
|
<a href="http://msdn.microsoft.com/en-us/library/dabb5z75(VS.80).aspx" target="_blank" title="New Window">__declspec</a>(<a href="http://msdn.microsoft.com/en-us/library/5tkz6s71(VS.80).aspx" target="_blank" title="New Window">selectany</a>) bool bVar;
#include "MyHeader.h"
extern bool bVar = 0;
#include "MyHeader.h"
extern bool bVar = 1;
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
No luck
now I got
.obj : error LNK2001: unresolved external symbol "bool m_BusyCursor"
|
|
|
|
|
do it all extern (declaration), AND "bool bDone = false;" in the Shared.cpp (instanciation)
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Now I get the below error
error LNK2005: "bool m_Cursor" (?m
.exe : fatal error LNK1169: one or more multiply defined symbols found
|
|
|
|