|
Why cant Method_1 work?
If you cant tell the CD to call you back when its finnished, then you will have to do polling.
Magnus
|
|
|
|
|
Hi,
I have to develop some software wich will use the command line for input, after that the GUI will be shown with the information provided in the command line already displayed (in textBoxes etc.).
Can someone tell me how to do this?
Thank you in advance
|
|
|
|
|
Derive your own class from CCommandLineInfo. THen override ParseParam to parse the command line arguments. In your applications InitInstance write
// Parse command line for standard shell commands, DDE, file open
CYourCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
After that, you have the information in member variables of cmdInfo that you must have created. Or perhaps within ParseParam you could have stored the information wherever you want..
|
|
|
|
|
If you are using MFC, check out the CCommandLineInfo class, or CWinApp::m_lpCmdLine. Otherwise, the command-line arguments come to you in the third parameter of WinMain(), or the second parameter of main().
|
|
|
|
|
I have a document object with , say an array of 100 integers.
I want to have 2 different displays of this data: 1 textual and
1 graphical.
To my understanding, i have to create 2 views one for each, say
CTextView and CGraphView. It is also obvious that i must have an MDI application.
My question is this:
1. DO i have to have 2 different document templates (say m_pDocTemplate1, m_pDocTemplate2 with the *doc and *frame classes same, but different views)? Or
2. if i have only one document template, how do i connect it with both views?
|
|
|
|
|
giorgos wrote:
DO i have to have 2 different document templates (say m_pDocTemplate1, m_pDocTemplate2 with the *doc and *frame classes same, but different views)?
No. You could, but it's not necessary. If you do this, I think you'll end up with two options in the new document box that pops up when you've got multiple doc types (I'm not sure about this, but I think it's right).
There's a good tutorial on switching between multiple view here[^].
Hope this helps,
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"
|
|
|
|
|
1. So.. you suggest that i have only one document template, associate it with one of the two views (randomly choose one?) and switch views according to needs?
2. The document object supports a linked list of different view objects if i want to iterate between them?
|
|
|
|
|
giorgos wrote:
So.. you suggest that i have only one document template, associate it with one of the two views (randomly choose one?) and switch views according to needs?
Yes. I have done this and it works well. Associate it with the view that you want to appear on startup.
giorgos wrote:
The document object supports a linked list of different view objects if i want to iterate between them?
I'm not sure what you're asking here... Do you want to elaborate a bit?
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"
|
|
|
|
|
In each document object i can use GetFirstViewPosition, and GetNextView functions to iterate between the open views. I wonder, if this will work if i have for example as 1st view a CAView, and as 2nd View a CBView.
But i think that it should work with proper checking for example:
POSITION pos = GetFirstViewPosition();
while (pos != NULL)
{
CView* pView = GetNextView(pos);
if (pView->IsKindOf(RUNTIME_CLASS(CAView))) { ... }
else if (pView->IsKindOf(RUNTIME_CLASS(CBView))){ ... }
}
Thx you veru much for your valuable help!
|
|
|
|
|
Yes, that will work. No problem at all
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"
|
|
|
|
|
I realize that the following line of code calculates the absolute value of a, but why would you want to do this in a program?
<br />
<br />
#define ABS(a) ( (a) < 0 ? -(a) : (a) ) <br />
<br />
Thanks, Dave
VC++ 6.0
|
|
|
|
|
There are many reasons to use it. One is finding the distance between two values (not the difference, just the magnitude of the difference), and there are many others. There are lots of mathematical solutions that require finding the absolute value of a number.
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"
|
|
|
|
|
do what? Using this macro, or using ABS?
a) using a macro: for C sources that don't know of templates, this was the only way to define abs once, without having to redefine it for every type you possibly need.
b) calculating ABS:
one is float comparison, due to round off errors, should usually be done with an eps, e.g. fabs(b-a) < eps. If you have an array of samples (both positive and negative), and you want to normalize them (so they fit e.g. into a (-1, +1) range), you need to find the highest absolute value in the samples.
reasons are many...
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
I'm still a bit confused on the use of ABS ( ), I'm going to have to read up on it some more. Hopefully it'll become more clear in time.
Thanks guys
|
|
|
|
|
I'm working on a project which is Single Document-MFC.
I'm learning database(ODBC) programing vith visual C++ 6.0.
I want to enter a numeric value into an EditBox.
Then this value should be stored in *.mdb table as Long Integer.
I chose catagory as value and variable type as long for EditBox from class wizard.
But I could not write any code for it.
please,help me !
emroz
|
|
|
|
|
Emre Zorlu wrote:
But I could not write any code for it.
What do you mean by it? This is the second time you're asking this question. Don't you think you should provide more details?
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
At a very high level:
1) Get the text from the edit box
2) Validate it
3) Create a DAO object and connect to your database
4) Call the Recordset's AddNew or Update to insert the data
Which of these actions do you need more help with?
I'm going to live forever or die trying!
|
|
|
|
|
when i create a Cwebbrowser contorl in my dll,it occur seriou error.
i seem that the dll doesn't support activeX control.
how can i realize webbrowser in my dll.
gucy
|
|
|
|
|
by the way ,i had added AfxEnableControlContainer() in my dll app.
if i add activeX control using resource edit,the dialog will not show at all.
if i dynamically create the control in the program. create failed.
gucy
|
|
|
|
|
I am using a VC SDK which has a menubar and some drop down menus in it. I want to add tool bar to it and beautify my application.After adding tool bar I want to call all the functionality of the menubar.
any help?
Madhu
|
|
|
|
|
Check the following abstract code snippet.
CMyclass::OnClick1() //called when button1 is clicked
{
Postmessage(WM_USER1);
.
.
. //2
MessageBox("Everything not roght here.");
}
CMyclass::OnUser1() //called when WM_USER1 message is posted
{
Beep(200,300);
.
.
.
.
}
Now what happens is whenever CMyclass::OnClick1() gets called it executes the code till comment two (//2) it doesn't displays the MessageBox(), then it jumps to CMyclass::OnUser1() handler executes it completely, then again comes back to CMyclass::OnClick1() & starts where it left, i.e it displays the MessageBox() & everything goes as expected.
Now the question is why it jumped from CMyclass::OnClick1() to CMyclass::OnUser1() before displaying the MessageBox(), then again comes back & does the rest?
|
|
|
|
|
Simply because you're just putting a message in the message queue of the window. PostMessage returns immediately without wating the message to be processed. So the message is processed when the window extract it from the queue (so when the thread has nothing more to do).
If you want the action to be executed immediately, you must use SendMessage instead (this is the same instead SendMessage wait until the message is processed).
Hope yhis helps!
|
|
|
|
|
I think he was saying that the opposite is happening when it shouldn't be
You are correct, and I'm pretty sure he knows it too.
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"
|
|
|
|
|
Ooops, yes sorry !
In fact I read it too fast and I just explained the first sentence. Hum, it's a little bit ambigous !
|
|
|
|
|
I'm not sure why this would happen, but put the PostMessage() after the MessageBox() and it will work as you want.
Hope this helps,
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"
|
|
|
|