|
for istance, you may call myfile.rdstate() .
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
I tried it by using rdstate(). Still stuck with the same thing.
|
|
|
|
|
pl_kode wrote: I tried it by using rdstate()
What is the return value?
Have you read the Rajkumar reply?
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
pl_kode wrote: myfile.open (filename, ios::app);
does replacing it with something like : myfile.open (filename.c_str(), ios::app); works ?
|
|
|
|
|
It doesn't show any errors like this. But it also do not create a file in the folder.
|
|
|
|
|
Can you try creating a file manually there ? Do you have the write access to the path?
|
|
|
|
|
Yes if i give ..
ofstream myfile;
myfile.open ("c:\\New folder\\file1.txt", ios::app);
It works. Even a file is created.
But I want it the other way.
|
|
|
|
|
can you post how you initialise filename variable. or check the value of filename before open(),
cout << filename.c_str();
|
|
|
|
|
Hi all,,
I m using one plug-n-play device like.. printer
whose driver also installed on my machine..
now i want to get the information about this device
like : 1> on which port it is connected
: 2> what is its device Id
: 3> what is its company name & Driver info.
at Run time .... how can i get these using VC++
and in which version of VC++
or give any solution which work in VC++6.0
ur reply really matters me....
thanks in advance...
|
|
|
|
|
|
If anyone can give me direction as to modifying the Crystal Report default path to ...\MyDocuments\. I would appreciate it.
I am working on an application using C++/MFC, which creates reports (using crystal reports), but the default path is preferred to be in the My Documents folder. Otherwise, to the path set previously by the application's operator. I am using Crystal Reports (version 8.5).
Thanks.
modified on Monday, April 28, 2008 8:53 AM
|
|
|
|
|
Hi All, Look at the following code snippet. My aim is to disable the button for some time say 2 seconds and enable it thereafter. What i noticed if i repeatedly click the button before 2 seconds lapsed then the all clicks i did get queued even the button itself was disabled at the very first click. The result of above said is that the all queued events get called one by one. Which is not desirable and i am able to notice as many traces as the clicks i did before 2 secs in my output window.
my aim is simple. I just don't want the button's handler to be called after the same gets disabled.
void CMYDlg::OnMyButton()
{
m_mybtn.EnableWindow(false);//disable button on its own click handler
Sleep(3000);
TRACE("___demo___");
m_mybtn.EnableWindow(true);
}
Your help and suggestion will be highly appreciated...
thanks
Raman
|
|
|
|
|
hey if any of you have problem understanding my question then please reply to this thread.
|
|
|
|
|
Member 3068970 wrote: Sleep(3000);
You can't put a simple in there. You will block your main thread (which is the UI thread too) meaning that no message will be processed. So, all your clicks will still be queued. You have to use a timer to simulate such behavior. Disable the button and start the timer in OnMyButton and re-enable the button once the timer fired.
|
|
|
|
|
|
Use a timer (WM_TIMER) instead of a Sleep.
When the user clicks on the button, disable the button, start the timer, and when the timer ellapse, re-enable the button.
|
|
|
|
|
Don't do that in a event handler. Set a one-shot timer for the purpose, for instance:
int iMyTimer = 100;
void CMYDlg::OnMyButton()
{
m_mybtn.EnableWindow(false);
iMyTimer = SetTimer(iMyTimer, 3000, NULL);
}
void CMYDlg::OnTimer(UINT_PTR nIDEvent)
{
if ( nIDEvent == iMyTimer)
{
m_mybtn.EnableWindow(true);
KillTimer(iMyTimer);
}
CDialog::OnTimer(nIDEvent);
}
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
i got it.thanks a lot.
|
|
|
|
|
Even though it goes against your design, Windows is actually not doing anything wrong or unexpected since neither the button control nor the dialog itself are responding to the mouse click while the button is disabled. It's not until the button is enabled that it resumes processing messages. Use Spy++ to verify.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
Member 3068970 wrote: oh its very true...
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I have a simple dialog with a progress control bar and some static text in it.
If I make the dialog modal Dlg.DoModal() there is no problem. But when I show it with Dlg.Create(IDD_PROGDLG, NULL); Dlg.ShowWindow(SW_SHOW); The text does not appear.
What am I doing wrong??
|
|
|
|
|
piul wrote: If I make the dialog modal Dlg.DoModal() there is no problem. But when I show it with Dlg.Create(IDD_PROGDLG, NULL); Dlg.ShowWindow(SW_SHOW); The text does not appear.
Are you dynamically creating this static control?
Nibu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
No. I put it when drawing the dialog.
|
|
|
|
|
piul wrote: No. I put it when drawing the dialog.
Can you show us the code where you are doing this?
Most probably it's(static) a local object that's why it's working with DoModal and not working with Create and ShowWindow , since DoModal blocks till the dialog is closed but this is not the case with Create and ShowWindow , they don't block so your static control will get destroyed hence it's not visible.
Nibu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|