|
Or you could use the "Generic-Text Routine Mappings"
These will work on both Unicode and non-Unicode builds.
CString cszNumber = _T("1234567");
int nNumber = _tstoi(cszNumber);
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
Hi all,
I need to be able to do something when a particular USB device is connected. the closest i've come to understanding this topic is using the WM_DEVICECHANGE, but i'm not really sure how to use it. i've also found this webpage:
http://msdn2.microsoft.com/en-us/library/aa363215.aspx
it talks about how to handle an insertion of a CDROM. however, i'm also not really sure how to use this function. does the Main_OnDeviceChange function gets called automatically when a cd is inserted? how do i use this function in my MFC dialog based application? and i need to tweak it to detect the insertion of a USB device instead of a CD.
can someone please help me!
any help is greatly appreciated...
thanks
Loath
|
|
|
|
|
refer this[^] article by Sam NG.
|
|
|
|
|
Hi
I am trying to understand macros. All tutorials tell that:
-----------------------------------
An object-like macro definition replaces a single identifier with the specified replacement tokens. The following object-like definition causes the preprocessor to replace all subsequent instances of the identifier COUNT with the constant 1000 :
#define COUNT 1000
Function-like macro invocation:
An identifier followed by a comma-separated list of arguments in parentheses. The number of arguments should match the number of parameters in the macro definition, unless the parameter list in the definition ends with an ellipsis
#define SUM(a,b,c) a + b + c
-------------------------------------
1-)But what are predefined macros. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang/html/_predir_predefined_macros.asp
Are these object-like macro or function-like macro. Or special macro? Where are they defined?
2-) #define UNICODE -> they say:
"If you don't #define UNICODE, you get ANSI by default."
Is _UNICODE macro? I understand what _UNICODE done. But i dont understand what UNICODE is. What is the meaning of #define UNICODE here? What does compiler do when it see such an expression (#define something)
I hope i can explain the problem.
I am looking for your answers.
Thanks
|
|
|
|
|
Macros are there to make your life simple and your code easy to read. Take the following example:
#define min(x,y) (x<=y?x:y)
int a = 10;
int b = 20;
cout << min(a,b);
Since you created a macro your code has instantly become easier to read and write. When you hit the 'compile' button, before the compiler does anything it will go through all your code and replace the macros with the real code, from the above example the compiler will produce
cout << 10<=20?10:20;
Other types of macros go alongside functions. Take the CreateWindow() function for example. This is actually a macro, there are two versions of the real function CreateWindowA() and CreateWindowW() each taking ansi strings and unicode strings. That's where the _UNICODE macro comes in:
#if defined _UNICODE
#define CreateWindow CreateWindowW
#else
#define CreateWindow CreateWindowA
#endif
So now anytime you use the CreateWindow macro, that macro will be replaced with the real function name depending on whether or not your project is unicode.
|
|
|
|
|
Thank you very much.
I understood it.
|
|
|
|
|
WalderMort wrote: #define min(x,y) (x<=y?x:y)
be careful with this, and prefer defining it as below. read my other post also to have a relevant explanation of this :
#define min(x,y) ((x)<(y) ? (x) : (y))
ps:here, the spaces are not necessary, but add them because : ( gives me a smiley otherwise...
|
|
|
|
|
what WalderMort doesn't say, is that your life can become a nightmare if you come to debug your SUM() macro:
#define SUM(a,b,c) a + b + c
when you define a macro, your first reflex should be to worry about operators precedence. Here is an exemple:
float f = SUM(2, 2, 2) * 5;
you're expecting f to be 30 (6 * 5), right ?
but here is how the compiler treats your macro expansion:
float f = 2 + 2 + 2 * 5;
and as you propably know, multiplication operator is more prioritary over addition, so f actually gets :
float f = 2 + 2 + (2 * 5);
so don't forget parenthesis when defining macros, ever !!!
#define SUM(a,b,c) <code>(</code>a + b + c<code>)</code>
|
|
|
|
|
Hi,
I wish to remove the title bar of the window...It is created with CreateWindowEx. If possible, could you tell the procedure...
Regards,
nag.
|
|
|
|
|
You can create the window without the caption by using the appropriate window style(s).
To remove a caption later you'd need to change the window's style.
See SetWindowLongPtr Function[^] for how to change a window's style.
Mark
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
HI all
Is there anu Microsoft Certification for VC++.
Tell is ther any certification for C++ which is worth full to put in resume
VIBIN
"Fool's run away,where angle's fear to tread"
|
|
|
|
|
why bother? Having a certificate doesn't prove you are a good programer it just proves you can pass a test.
In your resume, add details of projects/libraries you have completed and possibly even give a demo.
|
|
|
|
|
Certifications in C++ are of zero value. Certifications in, e.g., .NET, such as MCTS, can be of some value - i.e., some employers insist on them and/or value them as an added bonus to requisite commercial experience.
Kevin
|
|
|
|
|
Hi all
which one is better and why ?
I have heard like Visual C++ is far better than C++.net but at the same time its quite difficult.
So does any body have good link to learn about VC++.
I knw how to program over C++.NET but i am new over VC++..
Please guide me the right path.
Thanks a lot
|
|
|
|
|
|
I am assuming that Visual C++ is ISO C++ (with some Microsoft only features) and C++.NET is Managed C++ or "C++/CLI". I wouldn't say one is better than the other. Visual C++ can be used for low-level programming with high-level abstraction; thus, Visul C++ is powerful. IMHO, C++/CLI is (at this time) more of a bridge language between native code and managed code.
Nevertheless, you can learn Visual C++ from any book that covers ISO C++:
C++ Programming Language, Bjarne Stroustrup, ISBN: 0-201-88954-4
Ivor Horton's Beginning Visual C++ 2005, Ivor Horton, ISBN: 0-7645-7197-4
http://www.intap.net/~drw/cpp/[^]
http://www.mycplus.com/[^]
http://www.fredosaurus.com/notes-cpp/[^]
Use Google to find books and e-books!
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
|
Pan San wrote: 没有更好,只有看哪个更适合你
you seem to have a serious problem with english, don't you ?!
|
|
|
|
|
Hey, the negativity ("-") just got onto you!
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
Bob's math coprocessor has some serious problems
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
toxcct wrote: Pan San wrote:
没有更好,只有看哪个更适合你
you seem to have a serious problem with english, don't you ?!
toxcct,
The poster said (according to http://www.worldlingo.com/[^]), "Not better, only then looked which suits you."
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
I think you are a clever boy!
My English is really poor,although I have studied English 13 years ,but I found it have no effect to me.
Sorry to say,I haven't pass the CET6 exam,by the way ,I'm a Master of computer,I still should to study English,it's boring.when I want to find some technique articles,it's hard for me to read English articles.
From this sentence I have wrote,you can sure my English is so poor,isn't it?
But you should know,I'm not a person who come from Europe or other country which said English.I think you had know where I from,lukily to say ,I come from a great and beautiful country.
|
|
|
|
|
Software_Specialist wrote: which one is better and why ?
What is better, a fork or a spoon ? I guess it depends on the task at hand.
Software_Specialist wrote: I knw how to program over C++.NET but i am new over VC++..
How do you mean ? C++.NET is standard C++, with .NET extensions. If you know C++.NET, you know at least some C++.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Then for what tasks C++.NET is better and for which tasks VC++ is better.
Dont you think VC++ is lot more complicated than C++.NET ?
And if not then give me a simple windows based application example, explaining how you would achieve in both.
Obviously i know C++ but on .NET platform. So i am keen to know which is better and what industry needs more these days ...
|
|
|
|
|
Clickety[^]
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|