|
To begin use
try
{
}
catch(...)
{
}
or catch every error you might know
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
I've used the catch(...) but that doesn't garantee that "Runtime Error! .... This application has requested the Runtime to terminate it in an unusual way." message box doesn't show up.
|
|
|
|
|
>>However I can't run it as a service because I sometimes need to use the desktop.
You can make a service to display user interfaces and receive user inputs by setting SERVICE_INTERACTIVE_PROCESS attribute of a service.
There is no spoon.
suhredayan
|
|
|
|
|
Hello,
Does anyone know where to find a reference to a large calendar control? I would like it to look more like a standard wall-hanging calendar (not the date picker in MFC) in which I'll write/paint words and icons and colors.
thanks in advance,
JennyP
|
|
|
|
|
This is tne final step in my program and I cannot figure it out. Where do I enter the line with the slashes next to them? I changed the number to amount in the program. In the posoiton they are in I get 19 errors.Below is what was given:
string input;
int number;
int pos = input.find(',');
while (pos != -1)
{
////input.replace(pos, 1, "");
////pos = input.find(',');
}
number = atoi(input.c_str());
cout << number<< endl;
This is what I done.
int main()
{
int c;
float fee;
double total;
char a ='y', ans;
////string input;
//// int amount;
while(a =='y'|| a =='Y')
{
cout << "\nChoose from options below.\n";
cout << "\nEnter A to calculate total RWA cost.\n";
cout << "\nEnter B to calculate RWA base estimate.\n";
cout << "\n\t\tEnter your choice, then press the enter key:";
cin >> ans;
cin.ignore();
if (ans == 'A' || ans == 'a' ){
cout << "\nEnter RWA Base Estimate, then press the enter key:$";
cin >> amount;
////int pos = input.find(',');
////while (pos != -1)
////{
////input.replace(pos, 1, "");
////pos = input.find(',');
////}
////amount = atoi(input.c_str());
////cout << amount<< endl;
cout << fixed;
cout.precision(2);
fee = amount * 0.04;
cout << "4% Management Fee:$" << fee <<"\n";
total = amount + fee;
cout << fixed;
cout.precision(2);
cout << "Total:$" << total <<"\n";
|
|
|
|
|
You have everything in the correct place. Just change the line
cin >> amount; to
cin >> input;
I ran the code as posted here (added missing closing braces) and it ran fine.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
hi
I want to know how to extract element symbols using recursion from string like "4H2SO4". Also tell me how to learn recursion and string manipulation "some good books".
|
|
|
|
|
vikramdelhi wrote:
Also tell me how to learn recursion and string manipulation "some good books".
search your local market or Nai Sadak at old delhi for data structure books or go for Data Structure Book by LOMIS( i think i spelt his name incorrectly).
-----------------------------
"I Think this Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
spelt -> spelled
|
|
|
|
|
Alex Korchemniy wrote:
spelt -> spelled
Soory Thanks
-----------------------------
"I Think this Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Hello,
I'd like my app to have 1 document and 3 concurrent views. These views must also be shown and hidden at the users' discretions, and they're to be in separate child windows. I've searched the articles and the internet but only found discussions about splitters and flipping between views one at a time.
Can anyone point me in the right direction?
thanks,
JennyP
|
|
|
|
|
It's been awhile since I did this, but this can be accomplished using an MDI interface. The first step is to match all your documents, child frame, and view classes together. This is done in your apps InitInstance function
CMultiDocTemplate* pDocTemplate = new CMultiDocTemplate(
IDR_MY_TYPE_ONE,
RUNTIME_CLASS(CMyDoc),
RUNTIME_CLASS(CChildFrame),
RUNTIME_CLASS(CMyView1));
AddDocTemplate(pDocTemplate);
pDocTemplate = new CMultiDocTemplate (
IDR_MY_TYPE_TWO,
RUNTIME_CLASS(CMyDoc),
RUNTIME_CLASS(CChildFrame),
RUNTIME_CLASS(CMyView2));
AddDocTemplate(pDocTemplate);
CMainFrame* pMainFrame = new CMainFrame;
The IDR_MY_TYPE_ONE and IDR_MY_TYPE_TWO are the resource defines for the string table strings that that name your templates.
IDR_MY_TYPE_ONE "\nTypeOne\n"
IDR_MY_TYPE_TWO "\nTypeTwo\n" The string after the first newline (\n) is used to name the document template.
You then have to override CMainFrame::OnFileNew() so that it uses the proper template
void CMainFrame::OnFileNew()
{
CDocTemplate *pTemplate = GetTemplate(_T("TypeTwo"));
if (pTemplate)
pTemplate->OpenDocumentFile(NULL);
} In CMainFrame::OnFileOpen you would pass the file name to OpenDocumentFile().
To open a new view of an already open document, you have to add the menu message handlers to your document class
void CMyDoc::OnNewViewTypeOne()
{
CDocTemplate *pDocTemplate = GetTemplate(_T("TypeOne"));
if (pDocTemplate)
{
CFrameWnd *pFrame = pDocTemplate->CreateNewFrame(this, NULL);
if (pFrame)
pFrame->InitialUpdateFrame(this, TRUE);
}
}
Here is the code for GetTemplate
CDocTemplate *GetTemplate (CString str)
{
CString strDoc;
CDocTemplate *pTemplate = NULL;
bool templatefound = false;
POSITION pos = AfxGetApp()->m_pDocManager->GetFirstDocTemplatePosition();
while (pos)
{
pTemplate = (CDocTemplate *)AfxGetApp()->m_pDocManager->GetNextDocTemplate(pos);
pTemplate->GetDocString(strDoc, CDocTemplate::docName);
if (strDoc == str)
{
templatefound = true;
break;
}
}
if (!templatefound)
{
TRACE (_T("GetTemplate() failed, Template not found"));
return NULL;
}
return pTemplate;
} There may be bits I am missing, but this should get you started.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Thanks for the help.
When implementing this code, my application runs, but upon startup, it pops-up an MFC dialog titled "New" which contains my two views and expects me to pick either one. If I hit cancel, no document is loaded; else, the app behaves correctly. How do I default a view (instead of asking the user to choose), and how do I show both views simultaneously?
thanks!
JennyP
|
|
|
|
|
In your app's InitInstance function, there is a call to ProcessShellCommand. Remove that line. You then have to process the command line yourself. Look up CommandLineInfo in MSDN for all the possible options.
For example, if your user opens your app by double clicking on one of your associated files in explorer
if (cmdInfo.m_nShellCommand == CommandLineInfo::FileOpen)
{
CDocTemplate *pTemplate = GetTemplate(_T("TypeOne"));
if (pTemplate)
pTemplate->OpenDocumentFile(cmdInfo.m_strFileName);
}
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Hello,
Thanks for the help. Just to make sure your solution matches my needs: I would like to have several views operate/interact with the same open document data set simultaneously. Is this the case here? I'm a little suspicious because perhaps MFC is asking about which document (data set) to open upon startup?
Also, is there an easier way to simply display the same document data in separate child windows rather than creating templates? I'm not complaining about the implementation, but in the back of my head, I'm thinking that manually starting and maintaining a child view would be pretty straight-forward. I would just have the added task of manually messaging this new window to update itself at the right times.
thanks,
JennyP
|
|
|
|
|
bitpusher wrote:
I would like to have several views operate/interact with the same open document data set simultaneously. Is this the case here?
Yes.
bitpusher wrote:
I'm a little suspicious because perhaps MFC is asking about which document (data set) to open upon startup?
No, MFC is asking which view to use to display the data. If you had multiple CDocument classes then the question would be which document, but AFAIK you have only one CDocument class.
bitpusher wrote:
is there an easier way to simply display the same document data in separate child windows rather than creating templates?
No, the templates are the core of the MFC Doc/View model
bitpusher wrote:
I would just have the added task of manually messaging this new window to update itself at the right times.
It's not all that difficult. As long as you remember that the document is the central part of your app. All your views do is display your data and pass any user input onto your document. Do not do any actual data manipulation in your CView classes, do it all in your CDocument classes. Whenever you do data manipulation, simply call UpdateAllViews and the MFC framework will update all the active views that are displaying data from the current document.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
bitpusher wrote:
my application runs, but upon startup, it pops-up an MFC dialog titled "New" which contains my two views and expects me to pick either one.
This will happen if you have more than one document template defined when the commandline parameters are processed. You can either: Define all the templates except one after the parameters are processed, or modify the parameter processing to prevent this behaviour. The defailt parameter processing calls OnFileNew() which shows the New dialog box if there are multiple document templates.
Ryan "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"
|
|
|
|
|
Hi,
I have included an MSFlexgrid control into my MFC application and I don't know if it is necessary to add the ocx file, as well as another files into the project to distribute the program (and what files?). And is it needed to make a registering routine for this Activex control in Windows register?
Thanks
|
|
|
|
|
I have visual c++ .net 2003 and am trying to add an MSchart to a form. I've selected it from the coms list and added it to the tool box. I then go to ad it to the form and get an AxImp.exe error message telling me it can't find AxInterop.OWC10.dll even though it's in the debug directory of the project. I have the same problem if I try using any other AxtiveX component, just a different dll in the error message.
|
|
|
|
|
Hi,
I'd like to know if there is a sort of sdk to develop an application that uses MP3, I'd like to access the MP3 Tags for example.
Thanks
|
|
|
|
|
|
|
Hi,
I have a dialog based project in vc++ 6.0, I need to add Menu bar to the dialog box. So I have inserted a Menu(IDR_MENU1) and created it the way I want.But I do not know how to add it to the dialog box. Please do help me.
Thanks
|
|
|
|
|
CDialog::SetMenu() should do the trick.
Nick
|
|
|
|
|
I am using Microsoft Visual C++ 6.0. I ahve tried #include <stdlib> and #include <stdlib.h> and both are not accepted. Is their a header file associated with this function?
int pos = input.find(',');
while (pos != -1)
{
input.replace(pos, 1, "");
pos = input.find(',');
}
number = atoi(input.c_str());
cout << number << endl;
Thank You
|
|
|
|