|
Hi folks!
Did you ever use System Console Software?
If no, try it now. Very interesting approach to scalable and amazing features for every day ( www.syscon.tsoftech.com ).
|
|
|
|
|
I use codeblocks + wxdgets
and try a sample
but get the following
:: === t3, Debug ===
D:\wxWidgets-2.8.3\include\wx\platform.h:14: warning: "/*" within comment
D:\wxWidgets-2.8.3\include\wx\platform.h:14: warning: "/*" within comment
D:\wxWidgets-2.8.3\include\wx\platform.h:14: warning: "/*" within comment
D:\wxWidgets-2.8.3\include\wx\msw\dde.h:100: error: `wxDDEConnectionList' declared as an `inline' field
D:\wxWidgets-2.8.3\include\wx\msw\dde.h:100: error: expected `;' before '&' token
D:\wxWidgets-2.8.3\include\wx\msw\dde.h:105: error: expected `;' before "protected"
D:\wxWidgets-2.8.3\include\wx\msw\dde.h:108: error: `wxDDEConnectionList' does not name a type
D:\wxWidgets-2.8.3\include\wx\msw\dde.h:130: error: `wxDDEConnectionList' declared as an `inline' field
D:\wxWidgets-2.8.3\include\wx\msw\dde.h:130: error: expected `;' before '&' token
D:\wxWidgets-2.8.3\include\wx\msw\dde.h:135: error: expected `;' before "protected"
D:\wxWidgets-2.8.3\include\wx\msw\dde.h:137: error: `wxDDEConnectionList' does not name a type
D:\wxWidgets-2.8.3\samples\minimal\minimal.cpp:163: error: `menuBar' undeclared (first use this function)
D:\wxWidgets-2.8.3\samples\minimal\minimal.cpp:163: error: (Each undeclared identifier is reported only once for each function it appears in.)
:: === Build finished: 10 errors, 3 warnings ===
why?
|
|
|
|
|
cform0 wrote: why?
What exactly are you asking "why" to?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
cform0 wrote: why?
Why NOT fix the warnings and errors one by one?
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
cform0 wrote: why?
Your question is why you get these errors?
|
|
|
|
|
Hi,
So here's my problem: In certain circumstances, I want to stop my application from being closed when the "X" Windows sysmenu button in the top right corner of the application is pressed.
How can I do this? I tried catching the WM_DESTROY message and not running a PostQuitMessage(0) but this only leaves the process running; the application window is still destroyed.
Thanks in advance!
KR
|
|
|
|
|
If working with a dialog application, you can catch the command notification from the IDCANCEL button, which is what the [X] is on a normal dialog box.
I am not certain, but I think that the [X] generates a WM_SYSCOMMAND message with a SC_CLOSE notification, so you should be able to intercept WM_SYSCOMMAND .
In fact, you might be able to do the same for dialogs...
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Catching WM_SYSCOMMAND with SC_CLOSE works, thank you.
KR
|
|
|
|
|
KellyR wrote: How can I do this? I tried catching the WM_DESTROY message and not running a PostQuitMessage(0)...
Did you try to simply return 0?
KellyR wrote: ...the application window is still destroyed.
That's because the WM_DESTROY message is sent after the window has been removed from the screen. Try WM_CLOSE instead.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
... simply return nothing.
--
=====
Arman
|
|
|
|
|
I've tried that, it doesn't work; the application process continues to run but the window closes.
KR
|
|
|
|
|
CWnd::OnDestroy() is a void function...
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
James R. Twine wrote: CWnd::OnDestroy() is a void function...
Yes, but MFC was not mentioned in the OP. The WM_DESTROY message does expect a return value, however.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi all:
I have some experience using C programming, but for C++, so many libraries have been added to it.
The task I am supposed to perform is to check if a text file can be opened, which is input a command in line parameter, e.g. argv[1].
The first line of code given by my lecturer is:
ifstream in(argv[1], ios_base::binary);
I am stuck right here. Am I supposed to check the return value of ifstream? Or am I supposed to employ a member function of ifstream, but which one?
Thank you.
|
|
|
|
|
Generally, you need to learn C++ to fully understand what is happening. Anyway, the code is simple and a common way of opening a file [well, trying to open].
ifstream in(argv[1], ios_base::binary);
Here you declare and define an object whose type is ifstream. ifstream is a class responsible for file input operations. You pass the path and an optional ios::binary arguments to its constructor. Ok, to check whether the operation succeeded, you can do one of the following;
if (in)
{
}
if (in.is_open())
{
}
In the first case, the overloaded operator bpol gets invoked implicitly. In the second case, you explicitlly call a function [which returns bool].
--
=====
Arman
|
|
|
|
|
|
C_Zealot wrote: ifstream in(argv[1], ios_base::binary);
That line constructs an instance of the ifstream class as a variable called in , passing two parameters (argv[1], ios_base::binary ) to the constructor.
You then use the members of in to manipulate the data contained in the file referred to by argv[1] . You will have to take it upon yourself to lookup information on the ifstream class to see how you should use it.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
|
C_Zealot wrote: Or am I supposed to employ a member function of ifstream, but which one?
Have you tried is_open() ?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
C_Zealot wrote: I am stuck right here. Am I supposed to check the return value of ifstream? Or am I supposed to employ a member function of ifstream, but which one?
You need to check if ifstream in is a valid stream. It's an object so you need to call it's is_open() , good() , or bad() function.
if(!in.is_open())
cerr << "File didn't open correctly!";
if(in.bad())
cerr << "File bad bit is set!";
if(!in.good())
cerr << "File is not good for use!";
You can also just do:
if(!in)
cerr << "File didn't open correctly!";
Which I believe checks if the file opened, but does NOT check if the any of the bad bits are set (could be wrong).
I recommend the in.good() approach, personally, as it checks everything for you.
My favorite pure C++ reference site. Goes great alongside MSDN.
http://www.cplusplus.com/reference/iostream/ifstream/[^]
Good luck
-- modified at 14:41 Wednesday 23rd May, 2007
|
|
|
|
|
|
I'm trying to make a program that will loop the end where it takes in all the information in the "LIBRARIANSHAVE347CATS.DAT" and if the book has more then 200 pages it outputs the information to a different file called "bigbook.dat"
This is my code so far:
struct card_catalogue
{
float dewey;<br />
string title;<br />
string author;<br />
int released;<br />
int num_pages;<br />
enum typeofbook {fiction = 1, nonfiction, reference, pond};<br />
};<br />
<br />
int main()<br />
{ <br />
card_catalogue books;<br />
ofstream outfile;<br />
int i;<br />
bool rerun = 1;<br />
ifstream infile;<br />
ofstream outfilebb;<br />
<br />
outfile.open("LIBRARIANSHAVE347CATS.DAT",ios::out);<br />
while(rerun)<br />
{<br />
cout<< "Enter the Dewey Decimal Number please: ";<br />
cin>> books.dewey;<br />
cout<< "Enter the Title of the book please: ";<br />
getline(cin, books.title);<br />
cin.ignore(80, '\n');<br />
cout<< "Enter the Author of the book please: ";<br />
getline(cin, books.author);<br />
cout<< "Enter the Year of Release please: ";<br />
cin>> books.released;<br />
cout<< "Enter the Number of Pages please: ";<br />
cin>> books.num_pages;<br />
cout<< "<-----Type----->"<<endl; <br />
cout<<"1 - Fiction" <<endl<br />
<<"2 - Non-Fiction" <<endl<br />
<<"3 - Reference" <<endl<br />
<<"4 - pond"<< endl;<br />
cout << "Enter the type: ";<br />
cin >> i;<br />
<br />
<br />
if(i == 1)<br />
{<br />
cout << "You chose Fiction\n";<br />
}<br />
if(i == 2)<br />
{<br />
cout << "You chose Non-Ficiton\n";<br />
}<br />
if(i == 3)<br />
{<br />
cout << "You chose Reference\n";<br />
}<br />
if(i == 4)<br />
{<br />
cout << "You chose Pond\n";<br />
} <br />
<br />
<br />
<br />
if(outfile)<br />
{<br />
outfile << books.dewey;<br />
outfile << books.title << endl;<br />
outfile << books.author << endl;<br />
outfile << books.released << endl;<br />
outfile << books.num_pages << endl;<br />
outfile << i << endl;<br />
}<br />
else<br />
{<br />
cout << "An error occurred while opening the file. \n";<br />
}<br />
cout << "Do you want to run this program again? Press 1 if so, 0 if no." << endl;<br />
cin >> rerun;<br />
}<br />
outfile.close();<br />
<br />
<br />
<br />
<br />
infile.open("LIBRARIANSHAVE347CATS.DAT",ios::in);<br />
outfilebb.open("Bigbook.dat",ios::app);<br />
while(infile)<br />
{<br />
infile >> books.dewey;<br />
infile >> books.title >> endl;<br />
infile >> books.author >> endl;<br />
infile >> books.released >> endl;<br />
infile >> books.num_pages >> endl;<br />
infile >> i >> endl;<br />
<br />
<br />
if (books.num_pages > 200)<br />
{<br />
if(outfilebb)<br />
{<br />
outfilebb << books.dewey;<br />
outfilebb << books.title << endl;<br />
outfilebb << books.author << endl;<br />
outfilebb << books.released << endl;<br />
outfilebb << books.num_pages << endl;<br />
outfilebb << i << endl <<endl;<br />
<br />
}<br />
}<br />
}<br />
outfile.close();<br />
infile.close(); <br />
return 0;<br />
}
|
|
|
|
|
Ok, so what exactly is the problem?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hello,
Can I change the CREATESTRUCT& cs without calling PreCreateWindow function in the ChildFrame and assign it to the window class procedure AfxRegisterWndClass()
Prithaa
|
|
|
|