|
Hi:
I have created the following class:
class CQrgBond
{
private:
char* _cTicker;
double _fCpn;
int _nCpnFreq;
CQrgDate _dMaturityDate;
CQrgDate _dFirstCpnDate;
long _lAmountOS;
public:
CQrgBond( );
CQrgBond( char* cTicker, double fCpn, int nCpnFreq,
char* cMaturityDate, char* cFirstCpnDate,
long lAmountOS );
~CQrgBond();
}
I have created a constructor that can accept multiple arguments, but I am having troubles with creating an assignment operator with multiple arguments on the right hand side. My code doesn't work:
const CQrgBond& operator = ( { char* cTicker, double fCpn, int nCpnFreq,
char* cMaturityDate, char* cFirstCpnDate,
long lAmountOS } );
The error message is binary 'operator =' has too many parameters.
Ideally what I want to do it to have
CQrgBond m = { "Bond", 5.5, ... };
in addition to
CQrgBond m( "Bond", 5.5, ... );
Is this possible?
Any tips are appreciated.
|
|
|
|
|
No, what you have to do is
CQrgBond m = CQrgBond (....whatever);
Make sure you define a copy operator.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Anton A. Loukine wrote:
Is this possible?
Not with that class. The only time the array-style assignment syntax works is if you have a struct/class with all public members and no constructor, such as:
struct CFoo
{
int x;
char y;
};
CFoo foo = { 1, 'a' };
--Mike--
The Internet is a place where absolutely nothing happens.
-- Strong Bad
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
I have an AVI file playing on a dialog box. One of our users runs large fonts under Windows XP and we're seeing a darker gray area on the back of the dialog box. It kind of looks like this:
=====
=====
=====================
=====================
...where the === is the color that doesn't match the dialog background. The AVI file itself is being painted correctly.
I create the control in my WM_INITDIALOG routines (this is all Win32...no MFC) using the following code:
<br />
hAnim = CreateAnimationCtrl(hDlg, IDC_ANIMATE);<br />
Animate_Play(hAnim, 0, -1, -1); <br />
The CreateAnimationCtrl routine I got from MSDN and is defined as:
<br />
HWND CreateAnimationCtrl(HWND hwndDlg, int nIDCtl) <br />
{ <br />
HWND hwndAnim = NULL; <br />
RECT rc; <br />
POINT pt; <br />
<br />
hwndAnim = Animate_Create(hwndDlg, IDC_ANIMATE, WS_CHILD | ACS_TRANSPARENT, ghInst); <br />
<br />
GetWindowRect(GetDlgItem(hwndDlg, nIDCtl), &rc); <br />
<br />
pt.x = rc.left; <br />
pt.y = rc.top;<br />
ScreenToClient(hwndDlg, &pt); <br />
<br />
SetWindowPos(hwndAnim, 0, pt.x, pt.y, 149, 25, <br />
SWP_NOZORDER | SWP_DRAWFRAME); <br />
<br />
Animate_Open(hwndAnim, MAKEINTRESOURCE(IDR_AVI)); <br />
ShowWindow(hwndAnim, SW_SHOW); <br />
RedrawWindow(hwndAnim, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN);<br />
<br />
return hwndAnim; <br />
} <br />
In order to create a "transparent" AVI file, I use the following in my WM_CTLCOLORSTATIC call:
<br />
hdc = (HDC)wParam;<br />
dwColor = GetSysColor(COLOR_BTNFACE);<br />
SetBkColor(hdc, dwColor); <br />
UpdateWindow(hAnim);<br />
I don't currently have the transparent flags set for the animation control, but I have and that didn't help.
I don't know what's going on. She changed to large fonts, but kept the color choices the same. We both have XP and the same machines (as well as video drivers, etc.) I don't have any other controls on the dialog such as statics, etc. Mine works fine and hers doesn't.
Any help would be greatly appreciated.
Regards,
Brigg Thorp
Software Engineer
Timex Corporation
|
|
|
|
|
Hi all,
could you please download this:
http://home.tiscali.de/reichl/download/resysinfo_setup.exe[^]
and tell me if it's working or not?
I tested it on Win95/Win98/WinME/Win2k/WinXP and WinNT 5.0.
But a system information viewer must be tested on many different
system configurations before releasing it to the "user public".
Thank you
-Dominik
|
|
|
|
|
I gave it a quick run through on my WinXP Home box and everything I tried worked as expected.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
Thank you for testing!
-Dominik
|
|
|
|
|
Dominik Reichl wrote:
I tested it on Win95/Win98/WinME/Win2k/WinXP and WinNT 5.0.
WinNT 5.0?
That's what Win2k was called before it changed name, just before Beta 2, to Windows 2000.
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Anders Molin wrote:
WinNT 5.0?
That's what Win2k was called before it changed name, just before Beta 2, to Windows 2000.
Oops, i meant NT 4.0...
-Dominik
|
|
|
|
|
If I run my project in with the button that stops it at a breakpoint, (and out in NO breakpoints), the UI comes up with a controlk enabled. If I run this same with the ! the control comes up disabled. How can this be? How do I track this down?
Appreciate your help,
ns
|
|
|
|
|
So you're saying that when you run it with the debugger, a control in your dialog box is enabled, and when you run it without the debugger, the same control is disabled?
Regards,
Alvaro
The world is a dangerous place, not because of those who do evil, but because of those who look on and do nothing. -- Albert Einstein
|
|
|
|
|
Yep..thats what I was trying to say....
Anyways I did find it was code related , but why it worked in the debugger I dont know!!! Thanks for giving me the words....
Appreciate your help,
ns
|
|
|
|
|
I have a VC++ 6.0 compiler at home. I was able to make a MDI application
quite easily. When I create a new project my VC++ 6.0 I have at home
allows me to choose what type of software I am going to create (MDI, DLL,
console etc.) It also has a class wizard which generates code for me.
I have a VC++ 6.0 compiler at work. I was NOT able to make a MDI application
easily. When I create a new project my VC++ 6.0 I have at work
does NOT allows me to choose what type of software I am going to create (MDI, DLL,
console etc.) It also does NOT have a class wizard which generates code for me.
What version of VC++ 6.0 am I using at work? Should not VC++ 6.0 = VC++ 6.0
|
|
|
|
|
>> Should not VC++ 6.0 = VC++ 6.0
NO
VC++ 6.0 == VC++ 6.0
Maybe your needing Visual Basic
"No matter where you go, there your are..." - Buckaoo Banzi
-pete
|
|
|
|
|
Hi!
The listbox attached to a CComboBox is always displayed on top of and nerver clipped by the parent window. Is this possible to accomplish with other controls, like an ordinary CListBox (like IntellSense), and if so, how do you do it? I've tried setting the style WS_EX_TOPMOST, but it doesn't seem to stick on a CListBox control...
Thanks
There are no facts, only interpretations
|
|
|
|
|
The list box that's part of the combo box has no parent (well, maybe the desktop). It has the style WS_POPUP.
Chris Richardson
C/C++ Include Finder[^]
|
|
|
|
|
I have a class with several members> Theres a deque of these CImage objects:
std::deque<CImage> myObj. At one place in my code I need a deque of a finite size n, which is loaded with n null CImage objects.
How do I make a null object? Just push_back ing (0) doesnt compile. SO do I need to do:
CImage myIMage = new CImage;
myImage.attributeA = 0;
myImage.ATtributeB = 0;
..
etc?
then do
for (int i = 0; i <n; i++)
myDeque.pushback(myImage);
delete myImage;
Appreciate your help,
ns
|
|
|
|
|
You need to store CImage pointers in the deque instead of CImage objects.
e.g. std::deque<CImage*> myObj;
Then you can store null pointers inside the deque as well as created CImage objects.
Dave
|
|
|
|
|
I'll look int othis and see if I can redesign...
Appreciate your help,
ns
|
|
|
|
|
Or add an IsValid() method to your CImage object.
Todd Smith
|
|
|
|
|
My problem is with pre-build events. I have a custom resource compiler that receives as input a directory name, then it compiles all custom resource files in that directory and generate a header (if different from the previous version). So I want my visual studio to ALWAYS run that command line, don't matter if it thinks the project is up to date... I've tried several things, but nothing works properly. The pre-build event never works right because it thinks the project is up-to-date and don't execute the pre-build.
Any help would be great on that
|
|
|
|
|
I can only recommend a sneaky solution:
1. Change the date of your computer to some time in the far future, say two years from now.
2. Take a source file (from the project) that you never change, open it, save it, and make it read-only.
3. Reset the date of your computer.
Now when you build your project, that file will always be recompiled, and your pre-build stuff should work.
Regards,
Alvaro
The world is a dangerous place, not because of those who do evil, but because of those who look on and do nothing. -- Albert Einstein
|
|
|
|
|
That data change trick works, I've tried before. The problem is that visual studio always says "The project configuration(s) are out of date, Would you like to build them?", which is very annoying. I wonder if there is another way... Maybe I'll have to create a custom tool and manually run it before the project compilation, but it's far from the ideal solution. And another problem is that other programmers will use this project.
|
|
|
|
|
Im wondering if you could get a command line/dos version of the 'touch' utility and set the dir/project files date to a previous date in the pre-build step (may need to fire off a batch file) - would that force visual studio to rebuild ?? .. its easier than continually changing the date on the computer ...
or build a quick and dirty 'touch' yourself, or use someone's cp article for a head-start...
'G'
|
|
|
|
|
How can i write a progarmm that resides background and replaces any predefined word that user types in with another word ?
|
|
|
|
|