|
You don't need to change your project name in order to change the executable name. To change the output file name, it depends of the IDE you are using. For VC2005, go into your project properties -> 'Linker' -> 'General' -> 'Output file'.
|
|
|
|
|
thanks i was using vc++6 but changed the output file name as u hinted.
Tasleem Arif
|
|
|
|
|
|
We have a downloadable COM component which traps user actions on html form elements,stores them and later replays them.
Now,assume the distributable is UNICODE built.
And heres an sample scenario to capture the value from a text-box element on a form:
CComPtr<ihtmlelement> spElem;
CComVariant varval;
hr=spElem->getAttribute(CComBSTR(L"Value"),FALSE,&varval);
if(FAILED(hr))
{
return S_FALSE;
}
we convert it into a wstring using OLE2T (unicode)- and later set it back on the element as a BSTR, during replay.
Will this arrangment handle clients from ASCII locales too?or does a ASCII entry need a MBCS distributable?i.e can wstring handle both ASCII and non-ASCII locales seamlessly?
|
|
|
|
|
Hi, all...
I do the followings (in VC++ 6) :
1. Create an 'MFC AppWizard (exe)' project
2. Just delete the text : "TODO : ..." in the dialog box
3. Add an EditBox (IDC_EDIT1)
4. With ClassWizard, define this MemberVariable for IDC_EDIT1 : Member : m_edit1, Type : CEdit
5. For supporting Unicode parameters :
5.1. Add the _UNICODE in -> [Menu]->[Project]->[Settings...]->[C/C++] (with category General) -> in {Preprocessor definitions}.
5.2. Add wWinMainCRTStartup in ->[Menu]->[Project]->[Settings...]->[Link] (with category Output) ->in {Entry-point symbol:}
6. Add EN_CHANGE Message to IDC_EDIT1
6.1.Write this line in EN_CHANGE Message handler function for IDC_EDIT1 (void CTestDlg::OnChangeEdit1() ) :
m_edit1.SetWindowText( _T("Any text, even NULL") );
OK, then the program builds successfully, and runs...
Problem : now, I input a character in editbox, Oops! the program terminates!
Whats the problem ?!
Thanks.
|
|
|
|
|
the program terminates, or hangs ?
calling SetWindowText() generates an EN_CHANGE event to be thrown.
change your event with this :
CTestDlg::OnChangeEdit1() {
static bool b = false;
if (!b) {
b = true;
m_edit->SetWindowText("Hello");
b = false;
}
}
|
|
|
|
|
Thanks...
I think it's just abuot calling again and agian the EN_CHANGE message...
It's interesting that the program terminats not hangs !
|
|
|
|
|
hum, i think it terminates when crashing because of a full call stack...
anyway, be careful when handling even which you can potentially rethrow.
|
|
|
|
|
I'm curious why you'd want to set the text of an edit control in this fashion. If you are going to hard-code text in the control no matter what is typed/copied into it, there are better alternatives.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: there are better alternatives
examples ?
|
|
|
|
|
For starters:
Set the value in the dialog's template.
Call SetWindowText() in the dialog's OnInitDialog() method.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
but this will set the value for the beginning only. if the user modifies the editBox after then, nothing will be done...
|
|
|
|
|
That's exactly what his code is doing anyway. No matter what is typed/copied into the edit control, he is hard-coding the control with a call to SetWindowText() . Not only is this a bad design, it results in multiple EN_CHANGE messages.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I use an CString member variable for a listbox to get the selected item data, so if I use a CString member variable for editbox too, I should use the UpdateData(FALSE) to update the changing, then the selected item in the listbox will change and the first one of those items will bw selested.
It's my reason!
|
|
|
|
|
Mohammad Rastkar wrote: so if I use a CString member variable for editbox too...
Which you shouldn't be. Use a CEdit member variable instead.
Mohammad Rastkar wrote: ...I should use the UpdateData(FALSE) to update the changing
There is no valid reason for using UpdateData() . Yes, the framework calls it (i.e., when the dialog is initialized and when OnOK() is called), but calling it explicitly is not necessary.
I'm not sure what this talk of listboxes has to do with my initial comment about edit controls and your EN_CHANGE handler.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi...this is my first entry in a messageboard..dont kno de costims here
i'm doing a project using WH_JOURNALRECORD hook. using this hook i was trying to catch keyboard messages.for the top-level keys (volume cotrol keys bowser key etc..) the system becomes stuck..for all other keys it works fine..
i tried my best to solve this.. please anybody help..i'll be gratfull to you.
Thank you.
|
|
|
|
|
joe.cet wrote: dont kno de costims here
"Don't know the customs" is the the custom here.
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
Link2006 wrote:Let's take it outside of CP
Jeremy : Please don't.I would love to see this.I'm making the popcorn already.
|
|
|
|
|
Hi All,
I need to add the carriage return and line feed to a string to simulate the new line '\n' before writing it to a binary file.
what is the function I can give the ASCII Code and it returns the equivalant character.
What I need is a function that is similar to chr in Visual Basic
-- modified at 8:17 Thursday 21st September, 2006
|
|
|
|
|
Just write "\r\n" to the file (at the end of each line)
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
Mohsen Saad wrote: Re: How to convert ASCII code to character
int i=10;
char *str=new char[3];
sprintf(str,"%c",i);
cout<<str;
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Mohsen Saad wrote: what is the function I can give the ASCII Code and it returns the equivalant character.
There is no need for that in C++. The ASCII code IS the character. That is:
char c1 = '\n';
char c2 = '\r';
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hi All,
How can I find the current users "Application Data" directory ie C:\Documents and Settings\<currentuser>\Application Data\ in VC++ 6.0. I cannot use .NET functions.
Currently I am able to get the same using 'AppData' environment variable like getenv("APPDATA"); but I am looking for any direct functions or other work around for the same.
Thanks,
|
|
|
|
|
Does this helps you ?
char szAppDataFolderPath[MAX_PATH];
memset(szAppDataFolderPath,0,MAX_PATH)
SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, szAppDataFolderPath);
|
|
|
|
|
Great.. I am looking for some thing like this; but the problem I am facing is the SHGetFolderPath and CSIDL_COMMON_APPDATA are mentioned in the MSDN library as being part of shlobj.h and my shlobj.h contains neither of these declarations. Is it the part of Platform SDK?
|
|
|
|
|
Use this.
SHGetSpecialFolderPath(NULL, szPath,CSIDL_APPDATA, 0);
|
|
|
|