|
or you can always do:
<code>
char A[] = _T("ABCD")
</code>
If you know the contents on declaration.This way you don't need to worry about the string fitting the array size. Its automatically sized for you.
"..Even my comments have bugs!"
Inspired by Toni78
|
|
|
|
|
Your way is better than mine.
Can you tell me what is the meaning of "_T"?
|
|
|
|
|
If you ever decide to convert your program to support UNICODE characters, e.g. multilanguage support, there are a few simple but worthwhile techniques that you can do in your program to achieve this:
- The _T macro converts your literal string to unicode, if enabled. This is also the same as the TEXT() macro.
- Instead of char, declare your characters as TCHAR. When compiling a UNICODE program, the character will be treated as a double-byte character, instead of the usual single byte set.
- Most of the C++ string manipulation routines have a UNICODE version. eg. strcpy will only work on ANSI encoded charaters. _tcscpy does exactly the same thing but also uses the correct function if compiling in UNICODE mode.
if you are just starting off with C++, you don't need to stress yourself with this right now, but be aware of them because sooner or later you are bound to meet them again.
Have a look at a few of CodeProjects articles on unicode programming if you are interested:
Sorry to over-complicate things
"..Even my comments have bugs!"
Inspired by Toni78
|
|
|
|
|
Your instructions are very good.
You let me know well about it.
Thank you!
|
|
|
|
|
Just two additional comments:
a) for the unicode support, you would have to make the declaration TCHAR instead of char.
b) TCHAR x[] = _T("abcd") initializes 5 characters (including the terminating 0) If you don't want that, you need to use TCHAR x[] = { 'a', 'b', 'c', 'd' };
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
How to enumerate a connection as Active as soon as it starts dialing? under windows 2000/XP/NT?
Only under win 98 RasEnumConnections function returns handle when the system starts dialing?
Please help, very important
|
|
|
|
|
how to display the date retrieve from mysql database and then display in the plain text box after this how to get back the date in the text box and convert to date type so that i can increase the year
|
|
|
|
|
If you are using MFC, Have a look at COleDateTime and COleDateTimeSpan.
Michael
'War is at best barbarism...Its glory is all moonshine. It is only those who have neither fired a shot nor heard the shrieks and groans of the wounded who cry aloud for blood, more vengeance, more desolation. War is hell.' - General William Sherman, 1879
|
|
|
|
|
Michael P Butler wrote:
If you are using MFC, Have a look at COleDateTime and COleDateTimeSpan.
ditto. COleDateTime can both represent a given date in a variety of string format as well as convert (::ParseDateTime) a given valid date string to its internal format for interaction with your database.
"..Even my comments have bugs!"
Inspired by Toni78
|
|
|
|
|
Hi gurus,
I want to add an item to the visual studio context menu (i.e) - the menu that opens when i right click on the project and choose 'new class' & 'new ATL object' etc... i want to add my item there
i've searched for examples but couldn't find anything solid...can any1 help me please?
thanks in advanced,
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
I've been having a looking at the object model for Visual Studio and I'm not sure if the context menu is one of the elements which can be modified (I'm really open to correction on this).
As an alternative you could look at writing an Add-in or a macro to do whatever you need to do, and then add the item to the Insert menu (Tools -> Customize -> Commands), which comprises similar functionality to the part of the context menu that you are talking about.
The MSDN that got installed on my machine (I think it was 6.0a) has an article entitled "Controlling Developer Studio Objects Through Dual Interfaces" which lists all (or all important as far as I can see) interfaces which are available. It is probably a reasonable starting point for further work on devstudio add-ins or being able to actually modify the context menu.
Sorry I can't be of more help. Good luck again
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
Thanks again man,
i will look into the msdn topic you've reffered me.....
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
I stand corrected, there are so many articles on CP...
Undocumented Visual C++[^]
Context menu changes thread[^]
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
I developed an OLE mini server using VC++6. Everything works fine (both release and debug) as long as I insert the object manualy through the Insert Object dialog of MS Excel 2000. When I've tried to insert it from a VB AddIn for Excel it draws the frame but the interior of the rectangle remains transparent (the object is created but the container image of it isn't updated). It seems that when I insert from VB the OnGetExtent event it is not triggered (in the manualy case it is). How can I fix it? (I'll try to trigger the OnGetExtent through a method exposed by my object.) Here is a sample of how I try to insert the object from VB:
Dim obj as OLEObject
set obj = XLInstance.Sheets(ActiveSheet.Name).OLEObjects.Add (ClassType:="MyChart.Chart")
Thanx in advance...
|
|
|
|
|
hey again,
How can I see which processes are runing on the system (in c++ of course)
thanks
|
|
|
|
|
|
Hi,
How can I set my app to load auto on win start.
thanks
|
|
|
|
|
you have to put the path to your .exe file into the registry
HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run
using win api you can do this like that
name is a path to your application
void SetDeafultRegistries(char *name)
{
if( name == NULL)
return;
HKEY hKey;
if(::RegCreateKeyEx(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", NULL, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL)==ERROR_SUCCESS)
{
RegSetValueEx(hKey, "InternetProfile", NULL, REG_SZ, (BYTE*)(name), strlen(name));
}
RegCloseKey(hKey);
return;
}
|
|
|
|
|
hi all,
I have a small problem and i am sure this can be done..I want to load IE at syatem startup..can anyone show me some tutorials or can show me some pointers..any help is highly appreciated..
thanks a lot in advance..
himanshu
|
|
|
|
|
Put a shortcut to IE in your startup submenu under the start menu.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Add an Entry pointing to the IE exe in HKLM\Software\Microsoft\Windows\CurrentVersion\Run
"It was when I found out I could make mistakes that I knew I was on to something."
-Ornette Coleman
|
|
|
|
|
Hi,
I have come across the concept of Registry Hives in windows. Windows loads the registry hive for a particular user based on his SID under the HKEY_USERS registry entry. What I would like to know is that for some of the users I've seen more than one SID entries under the HKEY_USERS, why is that? For one user there should be only two entries .DEFAULT and the key relating to the SID of that particular user. Why does that happen?
Can anybody clarify this please.
Thanks,
Abhishek.
Learning is a never ending process of Life.
|
|
|
|
|
Can i create singledocument template in regular dll.and use it in exe
gucy
|
|
|
|
|
Hi,
I am facing problem in CTreeCtrl.
I want to control the horizontal Scrollbar appear in the CTreeCtrl after the line node exceeds its visible length.
What I need is the prefered method to make the horizontal scrollbar disappear.
have a nice day;
The Phantom
|
|
|
|
|
GetCommandLine() returns a string enclosed in quotation marks. So the first question is why? Let's call this string strCmdLine .
Since I had no idea that strCmdLine was enclosed in quotations marks, I would just extract the path of the executable by adding a null character at the location of the very last '\' occurence. So if my path was "c:\\apps\\myapp\\myapp.exe" I would convert the string to "c:\\apps\\myapp\0. As you can see there is a quotation mark at the begining of the string. Calling SetCurrentDirectory() would work just fine in Windows XP but it doesn't work in Windows 98. I fixed the problem by removing the leading quotation mark but I am puzzled as why would this work in XP and not in 98? This should not work at all. I don't know if it works in other windows versions.
// Afterall, I realized that even my comment lines have bugs
|
|
|
|