|
Have you been to all your classes, and listened to the teacher and did all the required exercises and reading ?
Did you asked those questions to your teacher and/or teaching assistant ?
I don't want to sound harsh, but all this is pretty basic, and if it's an course assigment, you should do it yourself.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
class Date
{
//blah blah
};
You have now created a data type called Date. You can use it as you would any data type like int or char.
class RailCar
{
double capacity;
Date dateOfManufacture;
}
|
|
|
|
|
Hi,
I have a client that says he is having some problems with my application. I would like to know the state of the application when he has said problems. I will send him a debug version of the executable, and ask him to create a core dump of the program when he is having problems.
Now, my two questions:
1) What can I use on a Windows XP system that can create a program core dump?
2) What application do I use to view the core dump? (I have MSVC 7.1)
Thanks
- Andrei
|
|
|
|
|
1) Dr Watson (drwtsn32.exe, found in the system dir of every XP installation)
2) VS will work just fine - open the .dmp file, and hit Debug - the context dumped will be displayed.
There are also several relevant articles here, you'd do well to spend a bit of time reading up on it.a
|
|
|
|
|
Hi there,
Was wondering if anybody why i get this exception while sending data over a socket. I am using CAsyncSocket for socket connections. I am getting error code 0 when i catch the exception and call GetLastError(). I cant seem to be able to trace why this is happening as the error generates randomly. Any advice on how to handle this and i would really appreciate if somebody could help me out on this.
Thanks
|
|
|
|
|
What's the exception that's thrown?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
This is all that i am getting "The operation completed successfully"
|
|
|
|
|
is it realyl an exception or is something returning 0?
If its an exception, run it in the debugger and set the debugger to break on an exception. This will show you where its being thrown from and should give you some idea of whats going on.
Usually 0 means success. Are you sure its really broken?
|
|
|
|
|
Hi,
I have a MFC dialog that I want to be in a static library. When it is in the static library and I call DoModal on it, the FindResource comes back with 0.
<br />
if (m_lpszTemplateName != NULL)<br />
{<br />
hInst = AfxFindResourceHandle(m_lpszTemplateName, RT_DIALOG);
HRSRC hResource = ::FindResource(hInst, m_lpszTemplateName, RT_DIALOG);
hDialogTemplate = LoadResource(hInst, hResource);
}<br />
Is it possible to have a dialog defined in static library with MFC support? I should point out that made sure that all the resource identifiers are out of the range of all other identifiers in the program (ie, 5000+)
Sincerly,
Clint Singer
|
|
|
|
|
clintsinger wrote: Is it possible to have a dialog defined in static library with MFC support?
Yes. But since you can't link resource templates into static libraries, you'll need to remember to do so in the app that uses them. For instance:
- Clint.exe links with ClintLib.lib, and has resources specified in Clint.rc
- ClintLib.lib contains class for dialog, template for dialog is defined in ClintLib.rc
- Clint.rc must
#include ClintLib.rc in order for those resources to be available at runtime.
|
|
|
|
|
Thank you. It worked!
Cheers,
Clint
|
|
|
|
|
Hi,
I am trying to call SetWindowText on a CEdit control, but can't seem to
make a line break appear within the control.
m_MyEdit.SetWindowText( _T("Three \n Different \n Lines");
I want the output:
Three
Different
Lines
I am using the multiline style, and the read only style.
Thanks.
|
|
|
|
|
atom wrote: m_MyEdit.SetWindowText( _T("Three \n Different \n Lines");
Use:
_MyEdit.SetWindowText( _T("Three\r\nDifferent\r\nLines");
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Hi
You most Set Multi line & Want Return Properties of your Edit control
Iman Ghasrfakhri
|
|
|
|
|
Ghasrfakhri wrote: You most Set...Want Return Properties of your Edit control
Not required.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
First post, I usually can find what im looking for by searching but this seems to have eluded me.
I want to create a window that cannot be resized and its getting frustrating.
I have made up a solution that will work, but it looks messy.
What it does is use the CS_HREDRAW and CS_VREDRAW window styles to tell the window to redraw everytime its addjusted. Then in the case for recieving that message I calculate the difference between the top and bottom, and left and right sides. If they are not the size i want then it resets them to that size and redraws the window. As you can imagine when somenoe trys to resize the window it blinks rediculously untill they stop. Is there some other way of acchiving this? I still want the end user to be able to move it about the screen, just keeping the same size.
|
|
|
|
|
remove the WS_THICKFRAME style from your CWnd derived frame window ( I assume that is what you have )
or handle the WM_GETMINMAXINFO message to prevent the resizing of the window.
search for WS_THICKFRAME in msdn, there's an article there about that.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
thanks
I was using WS_OVERLAPPEDWINDOW wich inclused WS_THICKFRAME
I must have read over that 100 times and it just didnt click
hate it when that happens
|
|
|
|
|
Hello,
I have the following problem. I want to create a temporary object that is transparent to the caller of the function which creates the temporary. We all know that a temporary object is created on the stack for objects returned by value from a function.
I wan't to use this property of the temporary to create a locking / unlocking mechanism for an object. See the following code for details
class CArbitraryClass
{
public:
void DoFoo() {}
};
class CWrapperClass
{
public:
CInvisibleTemporary operator->()
{
return CInvisibleTemporary::CInvisibleTemporary();
}
};
class CInvisibleTemporary
{
public:
CArbitraryClass& operator->() { return m_ArbitraryObject; }
private:
CArbitraryClass m_ArbitraryObject;
};
So the code should look like the following statements:
CWrapperClass Wrapper;<br />
Wrapper->DoFoo();
But it looks like:
CWrapperClass Wrapper;<br />
Wrapper.operator ->().operator ->().DoFoo();
Am I trying to do something impossible?
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Hi, Bob,
its normal that you should write
CWrapperClass Wrapper;<br />
Wrapper.operator ->().operator ->().DoFoo();
because after each function .operator ->() call you have returned a other object
temporary, pointer or reference. From this object you can call again some functions and so on.
The first call (Wrapper.operator ->() ) returns the temp object 'TempX' (CInvisibleTemporary)
You have now a object from which you can call some functions like TempX.operator ->() which returns a reference to the encapsulted object (CArbitraryClass m_ArbitraryObject ) and now you can call the finale funtion DoFoo();
If you want to encapsulate the function call list, you will have to return the correct object immediatly. But then you could lose the transparancy you need.
Maybe this could be done by using templates. I will check this out!!
codito ergo sum
|
|
|
|
|
BadKarma wrote: its normal that you should write
CWrapperClass Wrapper;<br />
Wrapper.operator ->().operator ->().DoFoo();
I know that I should write this and I want to avoid this obfuscation by introducing the invisible temporary.
My current solution is that the user has to create the temporary himself by calling a function from the wrapper class. This is OK, but if the user doesn't destroy the object, the cache I use it for, might get polluted.
I'll let you know if I find a solution. Thanks for your time, really appreciate it!
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
You can decrease the level of complexity by changing the -> operator in the CInvisibleTemporary class
from
CArbitraryClass& operator->() { return m_ArbitraryObject; }
to
CArbitraryClass* operator->() { return &m_ArbitraryObject; }
the code for calling is now
Wrapper.operator ->()->DoFoo();
in stead of
Wrapper.operator ->().operator ->().DoFoo();
codito ergo sum
|
|
|
|
|
Thank you!
The following change did the trick:
BadKarma wrote: CArbitraryClass& operator->() { return m_ArbitraryObject; }
to
CArbitraryClass* operator->() { return &m_ArbitraryObject; }
The compiler now automatically calls the second operator->() and everything looks like you have no temporary object! I tested this syntax on VS2005 and I don't know if it works on previous versions of visual studio. I'll try it as soon when I get my hands on one of those versions.
I first tried it with implicit casting, but this didn't work. I now have the solution thanks to you.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Hi, bob
If you mean invisible (like hide the class/object from the user) instead of transparent (don't care for the object class type), I may have a solution that works like you intended.
class CArbitraryClass
{
public:
void DoFoo() {}
};
class CInvisibleTemporary
{
public:
CInvisibleTemporary(void (CArbitraryClass::*pFunction)())
{
(m_ArbitraryObject.*pFunction)();
}
private:
CArbitraryClass m_ArbitraryObject;
};
class CWrapperClass
{
public:
void Call(void (CArbitraryClass::*p)())
{
CInvisibleTemporary::CInvisibleTemporary(p);
}
};
The way you need to call it is like this:
CWrapperClass Wrapper;
Wrapper.Call(CArbitraryClass::DoFoo);
The function Call does create a temporary object of the type CInvisibleTemporary. To this object the function that needs to be called is given via its constructor.
The 'invisible' temporary object doens't exist anymore after the 'Call', which frees the locked resoruces.
I hope that this may be a solution or at least sets you on route to one
codito ergo sum
|
|
|
|
|
how can you use a class to be a utility class of another class?? need help!! im quite stuck with this one
|
|
|
|