|
Good advice, but if he's been given the structs, then he's bound to use the format they asked of him, surely ? It's pretty rare for any student to be taught the STL in my experience, they mostly learn C with classes, not C++.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Hi,
Before you start coding you should analyse every little detail. Some of those details are: user requirements, data used, classes to be used, member functions of the classes, relations between the classes and so on...
You should make a diagram of the details related to classes. See this[^] article for details about the diagram.
When you've done all the analysing, just implement all the classes. The only thing remaining is putting all together, but that should not be a problem if your design is right!
Good luck
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
Is it possible to use the string class within another class? For example:
#include <string.h>
class x {
public:
method(); //... and so on
private:
string foo;
};
So far I've been getting errors when doing so, and have had to declare the strings outside of the class, which is not at all what I want to do. Any thoughts?
|
|
|
|
|
What errors are you getting ? I'd suggest they probably relate to the fact that I don't see 'using std::string;' anywhere in the above code. String lives in the std namespace, and needs to be scoped either when you use it ( std::string foo; ), or by a using statement to make it available to the global namespace.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
If I hava a class which has handle to a Mutex object as a static member such as:
class sharedClass{
public:
void accessSomeResource();
private:
someResourceType someResource;
static HANDLE hMutex;
}
...and I have mutliple threads instantiate there own sharedClass object.
Clearly, access to the resource is protected but what about the handle itself? Each thread will have access to the same static hMutex in an unsynchronized way.
The handle is not overwritten anyware. I'm only using it in the sycnchronization calls but could this be a problem??
-Alan
|
|
|
|
|
i didn't really understand ur issue... again please!
Don't try it, just do it!
|
|
|
|
|
when i include more than 1 user defined header file eg
#include "tcplib.h"
#include
#include
#include "big.h"
tcplib.h and big.h..... the second header file doesnt include in that it gives me errors saying its not included, any ideas on how to solve this? are you able to include more than one user defined header file?
also getting this warning:
LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:library
|
|
|
|
|
Because you didn't check 'do not treat <'s as HTML tags', I cannot see what else you included. If stdafx.h is in there, it needs to be the FIRST thing you include, everything else after. I tend to include all the standard stuff first, then my own headers underneath. You can include as many as you want to.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Mr. Cully wrote:
LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:library
Do exactly what it says. Add /NODEFAULTLIB:LIBC to your linker settings and the warning will go away..
John
|
|
|
|
|
i guess the problem you are facing is that, tcplib is a file already in use by the linker as default library. Thats why you are getting a message use "/NO DEFAULT" tag in you progam settings. My suggestion is to change the name of your user defined file, tcplib.
|
|
|
|
|
Hello, there,
I know there are several classes that can make the buttons in a dialog box become xp style. I'd like to know how I can do the same thing to the buttons in the MessageBox.
In other dialog box, I need to set the buttons to "Owner Drawer" and the subclass the button with other class that can actually draw the button. But in MessageBox, I don't know how to do something similar.
Any suggestion would be highly appreciated.
Thanks a lot.
Bin
|
|
|
|
|
Hello,
In my CChildFrame in PreCreateWindow I am removing the WS_MINIMIZEBOX and the WS_MAXIMIZEBOX (this is what I want) then in Activate Frame I force the view to Full size.. I only want the "X" close button to be displayed but when I force the view in to maximize it displays the restore down button... anyone know how to remove this button (I dont want to just disable it)?
Thanks,
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
Hi,
I have a map<string,int>.I want to sort it on values(int).How do I do this?
Karteek
|
|
|
|
|
If the key is the int then it probably is already sorted but it may depend on your implementation of map because I am not sure that the standard requires it to be sorted. STLPORT and VC6STL both instert into a sorted map.
John
|
|
|
|
|
Hi,
I want to sort on values not keys
Karteek
|
|
|
|
|
Sorry. I was a little confused when I read the question..
John
|
|
|
|
|
Read here.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
You need to copy the values into another container and sort it there. You cannot reorder the values, since it may break the order of the keys.
--
Intellectualize my blackness[^]
|
|
|
|
|
Hi,
I´m catching Outlook Events by using the connectin points of the DispInterface.
It all works great, but when there is only on item, for example the last contact, in the folder contact, the event handler doesen´t fire.
What´s the problem and is there any solution known ?
My second question: The event handler does only catch Events for the TopLevel Folders such as Inbox ...
When the user created a subfolder under the inbox the event handler
does not fire.
Can someone pleas help me ?
Thanks a lot, Chris
|
|
|
|
|
i dont know about the last contact thing
but the subfolders ... dont u have set up the event handler for each container? sub-containers are simply containers at different levels afaik
"there is no spoon" biz stuff about me
|
|
|
|
|
No I only set up the event for main container such as Contact.
How can I do this ?
|
|
|
|
|
Hi!
I'm quite new to MFC, but I understand the concept.
In trying to modify code to include (in a dialog) a new button that changes the caption of a label and the button itself I get an assertion error in winocc.cpp line 247. This occurs when clicking on the button while running the debug.
I created the button in the ressource file and added the code to modify the label and button:
if(isFlat == true )
{
m_lblRatePerHourControl.SetWindowText(_T("Rate per hour"));
m_cmdTypeControl.SetWindowText(_T("Flat"));
isFlat = false;
}
else
{
m_lblRatePerHourControl.SetWindowText(_T("Rate"));
m_cmdTypeControl.SetWindowText(_T("Linear"));
isFlat = true;
}
I noticed the AFX_DATA code of other button/control so I figured that I might need something there, I tried adding manually:
CStatic m_lblRatePerHourControl;
CStatic m_cmdTypeControl;
Still doesn't work. I read somewhere that it could be the compiler that acts as if my addition was a mistake and removes something or it could be that the original dialog was created in a wizard...
Any ideas anyone?
Also, can anyone recommend a good MFC book?
|
|
|
|
|
frexxx wrote:
I get an assertion error in winocc.cpp line 247.
If this is VS6, line 247 of WINOCC.CPP is not an assertion. Line 229 perhaps?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Sorry, I forgot to mention this is in MS Visual Studio .Net 2003.
|
|
|
|
|
In that case, look at line 247 of WINOCC.CPP and see what condition caused the assertion to fire. It's likely an invalid window handle.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|