|
Hello, i've just started C++ and currently looking into MFC. Is there a way that i could convert my existing console app to a MFC app?....because i wanted a GUI as well as a console window.....i tried adding the stdafx.cpp and the header file , the preprocessor def: _WINDOWS,_AFXDLL to my existing project. when compiled....i get......"c:\program files\microsoft visual studio\vc98\mfc\include\afxver_.h(130) : fatal error C1189: #error : Please use the /MD switch for _AFXDLL builds". Please Help!!! thanx
|
|
|
|
|
|
|
i mean that i draw something on a DC(CDC).
then i need to save this to a .bmp file.
that is to say, how to find the BITMAPINFO structure?
|
|
|
|
|
You must compute the bitmapinfo structure in your program. This is a "To Do". Read the MSDN and don´t ferget the 'DWORD' Alignment!!!
Try this @ home. (B&B)
|
|
|
|
|
Thanks.
Can you tell me where I can find the details about this in MSDN?
And how can i compute the bitmapinfo structure about a DC?
Best Regards...
|
|
|
|
|
If you use the visual studio press F1 else try the online docs from MSFT.
If you 'maybe' find the bitmapinfo you will read that this info contain the measures about the bitmap. A nice function is also "GetDIBits".
Try this @ home. (B&B)
|
|
|
|
|
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
|
|
|
|