|
CPallini wrote: Did it compile (I mean is it a ANSI build)?
Yes it is.
CPallini wrote: What can you see using the debugger?
You mean in debug mode. It seems work fine. That's why I confused. Go through step by step there.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Eranga Thennakoon wrote: You mean in debug mode. It seems work fine. That's why I confused. Go through step by step there.
What I mean is:
(1) put a break point on the following line
n = atoi(argv[1]);
(2) use the debugger to follow program execution step by step (F10 key) and see what happens (and when appropriate use F11 to step into functions).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Yep, that what I have done pal.
Different thing is that, all my members are public. It wont be a case use of instance, isn't it.
I appreciate your help all the time...
Eranga
|
|
|
|
|
And what were results?
(1) n is proper assigned, i.e. it corrensponds to the numerical value of the argument you passed.
(2) Lets suppose n=1 . Did execution reach
m_Add.addNumbers();
line?
(3) if the answer to point (2) is yes, had you follow execution inside your method? What did happen?
I think you can figure out some other interesting tests.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Yes, everything works fine. I couldn't find where the error. So what I have done is write another application, follows same steps which as previously do. It works.
I don't know why is that. But Little worried about another thing. I try change the argument to text. Something like this,
func.exe sum
rather than use of a number as argument. Set the arguments as 'sum' and tried it. But no luck. Is there any additional changes I have to done, which I don't have done in previous case.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Eranga Thennakoon wrote: Is there any additional changes I have to done, which I don't have done in previous case
Yes, you have to test against strings, change
int n;
n = atoi(argv[1]);
switch(n)
{
case 1:
m_Add.addNumbers();
break;
case 2:
m_Add.diffNumbers();
break;
default:
cout << "Invalid argument" << endl;
break;
}
into
if ( strcmp(argv[1], "sum") == 0 )
{
m_Add.addNumbers();
}
else if ( strcmp(argv[1], "diff") == 0) )
{
m_Add.diffNumbers();
}
else
{
cout << "Invalid argument" << endl;
}
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
modified on Wednesday, January 23, 2008 3:50:22 AM
|
|
|
|
|
I've test this, but gives an error on following code line.
CPallini wrote: if ( _tcscmp(argv[1], _T("sum") == 0 )
Error is,
'_tcscmp' : cannot convert parameter 2 from 'bool' to 'const char *'
I appreciate your help all the time...
Eranga
|
|
|
|
|
OOOPS...My bad
change
Eranga Thennakoon wrote: if ( _tcscmp(argv[1], _T("sum") == 0 )
into (mind the closing brace around the strcmp function)
if ( strcmp(argv[1], "sum") == 0 )
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Wow, it's work. Thanks a lot pal.
I appreciate your help all the time...
Eranga
|
|
|
|
|
I am a beginner who wants to restore the main window of a clock program that resides in the System Tray when running. What I want to do programatically is done normally by right clicking on the clock program's icon in the System Tray, then selecting "Restore Main Window" from the context menu.
I have tried many things, and the closest I can get is using SetForegroundWindow, which will only work when I have already selected "Restore Main Window" from the context menu and then minimized the restored main window.
I think I must be missing some fundamental concept about what I am trying to do.
Consider the pseudocode below...
void MyApp::OnLaunchSysTrayApp<br />
{<br />
CWnd*m_hWnd = FindWindow(NULL, "System Tray Application Name")<br />
if (m_hWnd)<br />
{<br />
m_hWnd->SetForegroundWindow();
<br />
BOOL m_bIconic;<br />
m_bIconic=m_hWnd->IsIconic()<br />
if (m_bIconic)<br />
{<br />
} etc.<br />
}<br />
}<br />
<br />
I would appreciate any suggestions about how I might achieve my goal, or information about whatever basic concept I (probably) currently fail to understand.
Thank you.
"For a successful technology, reality must take precedence over public relations, for nature cannot be fooled." Richard Feynman, Minority Report to the Official Report on the Space Shuttle Challenger Crash
|
|
|
|
|
Too much of this depends on the particular application to usefully answer.
Maybe the clock window is destroyed, or maybe it is the main window for the application but is hidden. Maybe, maybe...
In short, I don;t think there is a generic way of doing this.
Iain.
|
|
|
|
|
Try posting the SW_RESTORE command to the application.
|
|
|
|
|
Dear all
anyone know how to stop show when output of screen displays full screen..which function is available? thanks
Li Zhiyuan
5/10/2006
|
|
|
|
|
Can you more explain,please?
|
|
|
|
|
thanks, i mean when my program is runing, screen of output will display content continuously, no stop, so i want to see something, but passed already, how to do the screen will stop after display one full screen...thanks
Li Zhiyuan
5/10/2006
|
|
|
|
|
How do you show the content? What kind of application is yours?
|
|
|
|
|
i use win32 console application...when my program is runing..it will display something
Li Zhiyuan
5/10/2006
|
|
|
|
|
The only way of stopping the display is simply not to display anything in your code.
You'll have to manage it yourself: in your code, wait for the user to press a key before going to the next step.
|
|
|
|
|
In addition to Cedric Moonen said...
You can use GetConsoleScreenBufferInfo for getting the screen size.
|
|
|
|
|
Can't you just scroll the console window up (with the mouse) to see the older text?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi Everybody...
I have a query on SDI implementation. How can I make a SDI Document not to be dragged.
Thanks in advance
Sairam
|
|
|
|
|
What do you mean ? Could you be more precise please ?
|
|
|
|
|
We can move the window with mouse clicking on Tittle bar. I want to restrict this..
Thanks & Regards
Sairam
|
|
|
|
|
1/ There may be good reasons for resticting the size of an application. But the position? I officially don't want to use it.
2/ Have a look at WM_WINDOWPOSCHANGING to reset window movement, or override WM_NCHITTEST to tell windows this is not a draggable window bit.
3/ See (1) again. You'd better have a VERY good reason to do this, or you'll get hate vibes from customers.
Iain.
|
|
|
|
|
Hi all,
What I know about CFile::GetFileTitle(); that it gives the title(name without the extension) of a CFile. So what is happened here in this code. I found this on MSDN.
Try
{
CFile sysFile(_T("\\My Documents\\FOO.DAT"), CFile::modeRead);
_tprintf(_T("Path is : \"%s\"\n"), (LPCTSTR) sysFile.GetFilePath());
_tprintf(_T("Name is : \"%s\"\n"), (LPCTSTR) sysFile.GetFileName());
_tprintf(_T("Title is: \"%s\"\n"), (LPCTSTR) sysFile.GetFileTitle());
sysFile.Close();
}
CATCH(CFileException* pEx)
{
pEx->ReportError();
}
Output
Path is : "\My Documents\FOO.DAT"
Name is : "FOO.DAT"
Title is: "FOO.DAT"
Here output for Title is FOO.DAT, is it correct.
Here is the link I get it on MSDN Library 2004.
ms-help://MS.MSDNQTR.2004JUL.1033/dv_wcemfc4/html/aflrfcfilecolcolgetfilename.htm
I appreciate your help all the time...
Eranga
|
|
|
|