|
ok.Thanks.
I have download a program coding with VC++6.0,
It use GetDibits() function as you say.
http://www.codeguru.com/bitmap/window_to_file.shtml
Now,i will study these documents and functions at first... thanks you very much..
|
|
|
|
|
I have a thought to make the speaker to speak at a special time. That is:
1.Set RTC timer alert time at a special time;
2.Then the RTC timer triggers the speaker to speak.
This action can be done by Api functions "CreateTimer" and "OnTimer".
But I don't want to use this way, how to do it?
I use VC6.0
Thanks in advance!
|
|
|
|
|
shalala wrote:
This action can be done by Api functions "CreateTimer" and "OnTimer".
But I don't want to use this way, how to do it?
Use the shell to start a batch-file at your specific time?
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
can you tell me more details
or even some samples?
Thanks
|
|
|
|
|
Well, you simply need to get a batch-file to do what you want (e.g. reading a text or playing a *.wav).
Then you can use "scheduled task" to start that .cmd at the time you want.
Please read the help about scheduled tasks, as I am no expert, just a user.
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
Could somebody tell me how to call the shell function in vc6?
Thank you again
|
|
|
|
|
ShellExecute(...)
Cheers,
Fredrik
"Felix qui potuit rerum cognoscere causas."
|
|
|
|
|
I have a try.
Thank you!!!
|
|
|
|
|
I have a Video system and I want to display permanently images that come from it when I run my application. Solution seems to be Direct Draw with 2 graphic board or a DUAL one. It is not really a problem, I suceed. But, there is a point that worry me. It is obvious that when my application is running on one monitor we will display video image and on the other normal interface and I'd like seeing mouse only on the normal inteface. But if we attach all the graphical boards to the desktop the mouse is moving on the 2 screen, I am afraid that is too confusing for customer. I'd like then use one board attach on the desktop (we need at least one anyway) and the other is sleeping, excepted when my application is running then it will display video. In term of programing that means we need to call Direct draw with the good board device. the function DirectDrawEnumerateEx is all what we need. It works well if all the board are attached to the desktop (that is to say we see all the board device) but any of the boards are not attached then I don't succeed in seeing them. However there is a flag DDENUM_DETACHEDSECONDARYDEVICES that seems to be specially provided for that use but it do not return anything about the detached devices. Is anyone can help?
I have a Video system and I want to display permanently images that come from it when I run my application. Solution seems to be Direct Draw with 2 graphic board or a DUAL one. It is not really a problem, I suceed. But, there is a point that worry me. It is obvious that when my application is running on one monitor we will display video image and on the other normal interface and I'd like seeing mouse only on the normal inteface. But if we attach all the graphical boards to the desktop the mouse is moving on the 2 screen, I am afraid that is too confusing for customer. I'd like then use one board attach on the desktop (we need at least one anyway) and the other is sleeping, excepted when my application is running then it will display video. In term of programing that means we need to call Direct draw with the good board device. the function DirectDrawEnumerateEx is all what we need. It works well if all the board are attached to the desktop (that is to say we see all the board device) but any of the boards are not attached then I don't succeed in seeing them. However there is a flag DDENUM_DETACHEDSECONDARYDEVICES that seems to be specially provided for that use but it do not return anything about the detached devices. Is anyone can help?
Gwen
Gwen
|
|
|
|
|
i wan to output images which are coded basically in arrays of 1(presence of a bit)and 0(absence of a bit) to my SDI view, is there any samples around? not sure if it is something like cellular automata method...i am a beginner so need help in coding arrays and how to output in colour oso, for instance, i have a square which is an array of ones... how to show in on the SDI view and where should i code it coz i need to take in parameters from other dialogs. thanx
|
|
|
|
|
I created a modeless dialog with an accelerator table, but for some reason PreTranslateMessage is not called, so my accelerator keys are not translated to messages. Anyone knows why PreTranslateMessage is not called, or how to solve this problem?
|
|
|
|
|
Call PreTranslateMessage yourself; it's virtual.
Something like this:
BOOL CMyModelessDlg::PreTranslateMessage(MSG* pMsg)
{
if (!(m_hAccel && ::TranslateAccelerator(AfxGetApp()->m_pMainWnd->m_hWnd, m_hAccel, pMsg)))
return CDiaog::PreTranslateMessage(pMsg);
else
return TRUE;
}
Phil
The opinions expressed in this communication do not necessarily represent those of the author (especially if you find them impolite, discourteous or inflammatory).
|
|
|
|
|
I have something like you proposed:
<br />
BOOL CCentaurusDlg::PreTranslateMessage(MSG* pMsg) <br />
{<br />
BOOL handled = FALSE;<br />
<br />
if (pMsg->message == WM_KEYDOWN)<br />
{<br />
if (::TranslateAccelerator(m_hWnd, m_accelerators, pMsg) != 0)<br />
{<br />
handled = TRUE;<br />
}<br />
}<br />
<br />
if (!handled)<br />
{<br />
handled = CDialog::PreTranslateMessage(pMsg);<br />
}<br />
<br />
return handled;<br />
}<br />
But my PreTranslateMessage method is not called by the MFC framework. So where should I call PreTranslateMessage ?
|
|
|
|
|
I feel my computer is playing a cat and mouse game with me, and I am the one losing. Here's why!
I can enter a bunch of strings and it can read one and ignore the rest, (meaning, it'll only give me the first one that it read), or it can read ALL, but give me NOTHING (meaning, it'll hang in the loop)!! Here's the code.
string str;
vector<string> vStr;
do
{
cin>> str;
vStr.push_back(str);
cout<<"\n Size: " <<vStr.size();
} while(str.end()!="\r");
======================
vector<string>::iterator iterB = vStr.begin(), iterE = vStr.end();
for(; iterB!=iterE; ++iterB)
cout<< *iterB <<" ";
======================
cout<<"\n" <<endl; The condition shown in the 'while' statement, will show the vector growing as strings are entered, but WILL NOT exit the 'do/while' loop.
However, if I were to change the condition in the 'while' statement to:
while(str.end()=="\r"); It'll exit the loop, but will ONLY give me the first string it read.
Ideally, I would like for it to read all the strings entered, and report all that it accumulated in the vector.
Thanks for any help.
William
Fortes in fide et opere!
|
|
|
|
|
I'm a little confused as to what you want your end condition to be... cin >> str reads in tokens delimited by whitespace (including \r and \n ), and throws away the whitespace.
If you want to read an entire line of text at once, then look at cin.getline() .
- Mike
|
|
|
|
|
Try the following
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
using namespace std;
int main()
{
string line;
getline(cin,line);
istringstream istrstr(line);
vector<string> vStr;
for(;;)
{
string str;
if(!(istrstr>>str))break;
vStr.push_back(str);
cout<<"\n "<<str;
cout<<"\n Size: " <<vStr.size();
}
return 0;
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks for replying.
I did review several options to my situation which included the use of 'istringstream'. At first 'istringstream' looked very promising, but after studying it some more, it didn't quite offer me what I was looking for (viz., an option that didn't limit the number of strings I might be receiving at any time).
'istringstream' is ideal for formatted string input and for a set number of strings. IOW, in your input stream syntax, you would have to show the amount of strings you are going to be receiving and their types (if other types are going to be part of the input other than just 'string').
Because the number of strings I would be receiving varies, I had to choose something that didn't restrict me to a fix amount, which told me that a loop would have to be the main mechanism.
I will look at your example, and again review what 'istringstream' can do for me.
Thank you for replying. I appreciate it.
William
Fortes in fide et opere!
|
|
|
|
|
I think I understand your problem. Have you tried checking for str.empty before pushing to the vector, and exiting the loop if the string is actually empty? I've not tried it myself, but I guess it might work.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Yes, I did try:
while(str.empty()); and got nowhere with it (meaning, it would not exit the loop). I also tried the opposite, 'while(!str.empty());' and it exited the loop but with only the first string. (IOW, the computer and I playing the old cat and mouse game.)
Thanks for replying.
William
Fortes in fide et opere!
|
|
|
|
|
I did not explain myself clearly enough. I mean:
for(;;)
{
cin>>str;
if(str.empty())break;
vStr.push_back(str);
cout<<"\n Size: " <<vStr.size();
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks for replying.
I didn't exactly try your last suggestion (according to the way you coded it), but I did try using the 'break' syntax, and it certainly did take me out of the loop. But guess what, the vector only had the first string entered in it!!
Believe me, before I posted this problem on CP, I tried a lot of ways, but always with one of the two standard results: either I end up with just the first entry, or I couldn't exit the loop.
William
Fortes in fide et opere!
|
|
|
|
|
As I understand it, end() will point just beyond the end of the sequence. Maybe that is your intent, but I'm not sure. Anyway, what condition do you want to terminate the do/while loop? Maybe something like:
do
{
...
} while (str[0] != '\r');
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Thanks for replying.
Your sample gave the same result as:
while(str.end()!="\r"); which is, "receiving any number of strings and growing the vector, but unable to exit the loop."
The intent is to receive as many strings as inputted, and exit when finished.
The exiting part is the whole problem, because if I were to just enter one string, I can exit with:
while(str.end()=="\r"); I've tried a number of things while inside the loop (e.g. conducting certain discrete test and setting boolean values to signal to the loop that I'm ready to exit), and the best I could have ended up with came down to one of the two options I presented in my original posting.
William
Fortes in fide et opere!
|
|
|
|
|
From what I've seen, cin does not "return" until a non-whitespace character has been entered. This leads to something like:
string str;
vector<string> vStr;
do
{
cin >> str;
vStr.push_back(str);
cout << "\n Size: " << vStr.size();
} while (str != "9");
which is one step away from cheesy!
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Cheesy or not, at this point I'll take whatever works.
Something else I tried, included inserting a delimiter at the end of the last string inputted, to signal that I wanted to exit the loop (how much cheesier than that can you get, I don't know), but that didn't work either.
Am I desperate? Not quite, but am getting there.
Thanks for replying.
William
Fortes in fide et opere!
|
|
|
|