|
As michel wrote, it allocates memory on the stack. But, if you use VC++ 7.0, you can use CA2W(), it allocates memory on the heap, if needed, but otherwise it works just like A2W().
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Hi,
I would like to create a script in C++ for introduce some datas into a executale.
For example : senddata /p test /r test1.
I create a little sample and after I execute my script, the prompt message is closed and I can't see the result.
My sample:
int main(int argc, char* argv[])
{
printf("Hello World!\n");
char *p;
int i;
int iErr;
for (i=1; i
|
|
|
|
|
This works fine (I just add the condition in the for loop)
int main(int argc, char* argv[])
{
printf("Hello World!\n");
char *p;
int i;
int iErr;
for (i=1; i < argc;i++)
{
p=argv[i];
if(*p=='/')
{
p++;
switch(*p)
{
case 't':
{
printf("Option :t is introduce\n");
iErr = 1;
}
break;
case 'T':
{
printf("Option :T is introduce\n");
iErr = 2;
}
break;
default :
printf("Nothing\n");
iErr = 0;
}
}
else
{
printf("Nothing\n");
iErr = 0;
}
}
return iErr;
}
~RaGE();
|
|
|
|
|
Yes, I know but I would like that the Prompt message is allways displayed and not destroyed.
Have you a solution for me ?
Best Regards
youssef
|
|
|
|
|
You can force a prompt at the end with
getchar(); ...
(BTW, the message is not destroy on my machine until you hit a key (even without the getchar())
How do you run your program ? In VC++ ? Or from the Explorer ? Or from Command Line ?
~RaGE();
|
|
|
|
|
What do i include? WHen i try to declare a CString it says undeclared identifier.
Thanks.
|
|
|
|
|
#include <afx.h>
~RaGE();
|
|
|
|
|
|
Unless you are using WTL you can't, because the MFC version of CString requires some MFC Internals. There is a WTL version but this requires you to use ATL and WTL.
John
|
|
|
|
|
VC NET
Use ATL::CString
#include <atlstr.h>
In VC 6, you can use WTL::CString if you download WTL, but the class in WTL 3.1 was not incredibly good.
Regards,
R.
|
|
|
|
|
Sorry, seems that the rest of my post got lost ... OK, Ramon gave you the right thing ...
~RaGE();
|
|
|
|
|
Why not use stl string. its much better than the CString and feature rich. Easy o use. If u r unsure why not peek into "Thinking in C++" by Bruce Eckel Vol 2. @ mindview.net
|
|
|
|
|
I have a popup keypad for numbers and would like to have the number added to a edit control for display as it is typed and then return the number on clicking ok.
I can't seem to get the number to show in the edit control.
I thought there was an article on this but couldn't find it.
Any help would be very much appriciated.
Thanks,
|
|
|
|
|
Source sample, please ?
~RaGE();
|
|
|
|
|
Not sure that I can give enough source to make sence. So I'll try and explain with a short example:
Dialog app. user clicks edit box and a dialog appears with a button and an edit box. The user clicks the button and every time a one is added to a temp array and the new number is displayed in the edit box. On exit the number is returned to the first click edit box.
Number should look like 11111. But in the real app there are 10 buttons plus other functions to act on the number present. Much like a calculator.
Thanks for trying to understand. Hope this helps.
|
|
|
|
|
OK: It does not sound very complicated...
First, draw your dialog and create a class associated to it, let´s name it CKeypadDlg. If you are already lost, mail back
Add a member
int * m_Response
Then overload the DoModal function like this :
int CKeypadDlg::DoModal(int *response)
{
m_Response=response;
return CDialog::DoModal()
}
declare a CString in your KeypadDLg:
CString m_Result
On your second dialog box, you should have a control associated to your CEditBox (let´s name it m_EditCtrl).
When the user clicks on button 1 for instance you will have to catch it in a OnButton... function - Double Click on the Button in the Dialog, and you´ll get :
void CKeypadDlg::OnButton1()
{
m_Result+="1";
m_EditCtrl.SetWindowText((LPCTSTR)(LPTSTR)(m_Result))
}
Same code for all button ...
To get the current result at any moment
int Result_i=_atoi(m_Result);
Finally, override OnOk() with
void CKeypadDlg::OnOK()
{
*m_Response=_atoi(m_Result);
CDialog::OnOK();
}
Oufff ...
use it ike this :
CKeypadDlg myDlg
int final_result=0;
myDlg.DoModal(final_result);
Hope this helps ...
~RaGE();
|
|
|
|
|
Not sure how to use it, it always returns "The parameter is incorrect." when the return value is interpreted with the Error Lookup.
Thanks!
|
|
|
|
|
Hi all,
Any programmer here who has experience with using DSP boards? As I'm not a hardware guy I'm looking for something coder-friendly. Any suggestions would be welcome
|
|
|
|
|
I used a DSP56001 board many years ago. (Like when the 186 was the top dog). It was good and easy to use at that time, considering I hadn't done my programming degree at that time. (that makes it 12 years ago )
Sorry if I can't be more help.
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
10x Roger.
Any idea anyone where I can get benchmarks/performance figures. Ideally I'd like to know whether the bang/buck of a DSP compared to a 2Ghz AMD is better, etc and any pitfalls. I couldn't find any perf data on the Texas Instruments site.
|
|
|
|
|
I have am writting an MDI Doc/View app and have a situation where I would like to be able to close a view (there is only one view and it is derived from CScrollView) and leave the document open...then, sometime later, create a new view and attach it to the still open document.
How do I do this?
|
|
|
|
|
To avoid deeper hacking, I'd create a 'dummy' frame/view and hide it. So technically a view would exist - but user would be unaware about that.
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
Thanks for replying...I thought about that, but there can be many documents/views being opened and closed and if they are not really closed (only inactive), the inactive views continue to receive OnUpdate messages. I am worried about a possible performance hit...It seems that it would be cleaner to close the view, but leave the document open.
|
|
|
|
|
Gary Kirkham wrote:
I am worried about a possible performance hit...
Well, the dummy view would be just a class derived from CView which ignores OnUpdate calls.
You may also try to dabble with undocumented CDocument::m_bAutoDelete. Probably if you set it to FALSE closing last view will not destroy document. I've never played this trick personally, however.
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
Never mind I figured it out...you gave me part of the answer (m_bAutoDelete)
Thanks
|
|
|
|