|
True, but that's not what was asked, now was it ?
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Hmmm. You answer only to what is asked eh?
I am reminded of a joke.
It's a phone call
A: Hello.
B: Hello.
A: Can I speak to George?
B: No
A: Huh? I want to speak to George
B: Maybe, but you cannot
A: I insist. Gimme George now.
B: I cannot
A: Why not????????
B: George is not home
A: Sh*t
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
If the function modifies the pointer then pass it as a pointer, because references will be treated as const pointers [or am I wrong?] if they are a reference to a stack variable.
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
sheesh!
I was being stupid.
Pass a pointer if the function needs to change the pointer.
It cannot change a reference variable's address
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
|
When passing user defined types, using references can improve performance. For builtin types it doesn't matter which way you do it.
Vimal
|
|
|
|
|
Thanks. That really reminds me of Deitel & Deitel C++ How to Program's performance tips.
Kuphryn
|
|
|
|
|
Hi,
Does anyone know if the Gdiplus::Graphics class sports a [Fill|Draw]RoundRect() function (or similar.) I know I can use a GraphicsPath object (with lines and arcs) to represent the same shape, but it seems strange that such a basic function could be omitted by the implementation?
/Andreas
|
|
|
|
|
Nope - not there.
I did it like this:
GraphicsPath* CGPaintShape::MakeRoundRect(Point topLeft, Point bottomRight, INT percentageRounded)
{
ASSERT (percentageRounded >= 0 && percentageRounded <= 100);
INT left = MIN(topLeft.X, bottomRight.X);
INT right = MAX(topLeft.X, bottomRight.X);
INT top = MIN(topLeft.Y, bottomRight.Y);
INT bottom = MAX(topLeft.Y, bottomRight.Y);
INT offsetX = (right-left)*percentageRounded/100;
INT offsetY = (bottom-top)*percentageRounded/100;
GraphicsPath * path = new GraphicsPath;
path->AddArc(right-offsetX, top, offsetX, offsetY, 270, 90);
path->AddArc(right-offsetX, bottom-offsetY, offsetX, offsetY, 0, 90);
path->AddArc(left, bottom - offsetY, offsetX, offsetY, 90, 90);
path->AddArc(left, top, offsetX, offsetY, 180, 90);
path->AddLine(left + offsetX, top, right - offsetX/2, top);
return path;
}
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Ok, that's what I suspected anyway... I have to deal with different vectors for the ARC, but that should not present any problem. Just wan't to make sure I don't reinvent the wheel to many times
Thanks for the reply and sample
/Andreas
|
|
|
|
|
As I was skimming through a reference book tonight I ran across a description of the template class, complex. I know nothing of it, having had no prior need for it, but I'm curious about the operator:
<br />
complex& operator*=(const complex& rhs)<br />
Does the return value contain the dot (scalar) or the cross (vector) product? And if it's the cross product, which part of the return value represents the component normal to the Re/Im plane?
Can't imagine any immediate use for knowing, but who knows when the circumstance might arise...
|
|
|
|
|
|
Thanks!
As I mentioned, I don't have an immediate use for it, but one of the projects I've got in the back of my head may need the capability. It's more of a vector problem than a complex number application, but as long as we're limited to two dimensions (and the project is, fundamentally, two-dimensional) a solution using complex numbers will do nicely..
|
|
|
|
|
I want to monitor keyboard and mouse activity with a program that runs without a window and in the system tray. This program would write information to a log file as it "sees" the activity. Can anyone give me some hints on where to start looking? Some good starting points would be 1) How to monitor messages going to any application. 2) How to run a process in the system tray.
Ross
|
|
|
|
|
You'll need a system wide hook which will reside in a dll.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
1) SetWindowsHookEx with parameters WH_KEYBOARD, WH_KEYBOARD_LL, WH_MOUSE, WH_MOUSE_LL
2) http://www.codeproject.com/shell/systemtray.asp
|
|
|
|
|
Hi
I need to serialize objects without using MFC (no CArchive).
Does naybody have any code or examples to do this?
I don't mind using iostreams but ultimately the data will be in memory as a BYTE[] not strstream, and on disk accessed using Read/WriteFileEx() and not fstream.
The functions will look something like StreamIn(const vector<BYTE>& Data) and StreamOut(vector<BYTE>& Data).
Regards
Pieter Viljoen
|
|
|
|
|
I've downloaded the latest STLPort and I'm having a hell of a time setting it up. Has anyone had any success/like to give me some pointers ? I've read the readme, I've done the nmake thing and I get it looking for a lib file which I have not built. ARGH !!!!!
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Well, man, did the same thing about a half year ago.... and nothing... Now I'm not using STL at all, except what is included in VC. I know it is out-of-date... but for me it's enough
Philip Patrick
"Two beer or not two beer?" <shakesbeer>
Web-site: www.saintopatrick.com
|
|
|
|
|
I got it going, I had to uncommet a #define. However, it appears to deviate from the stanard ( size_t is unsigned int instead of int ), and declare stuff in the global namespace. I wrote functor and had to rename it because it crashed with something global introduced by STLPort.
The VC STL is quite fine, and still a bajillion times better than awful MFC containers, but we're writing a cross platofrm app, so we need a cross platform STL implimentation.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Oh, yes, you are right. I had a problem I remember with some define inside STL, that was a reserved word in VC++. Don't remember exactly what it was actually. I just didn't used it in my own code all worked fine, but we have a lot of existing code that used this reserved word, so I didn't want to go and change it in all code of my company...
Philip Patrick
"Two beer or not two beer?" <shakesbeer>
Web-site: www.saintopatrick.com
|
|
|
|
|
>> ( size_t is unsigned int instead of int )
Isn't "size_t" unsigned by standard???.
>> I got it going, I had to uncommet a #define
I have neither with VS7 nor with VC6 had any problems installing STLport.
You simply should open a DOS box (with VC environment), go into the STLport 'src' directory and run "nmake vc6.mak".
>> I wrote functor and had to rename it because it crashed with something global introduced by STLPort.
What was the name which caused the conflict?
|
|
|
|
|
Alexander Berthold wrote:
Isn't "size_t" unsigned by standard???.
MAybe it's not size_t - it's the return value of *container*.size() and a friend who has X3J16 in hardcopy looked it up and said the standard says int.
Alexander Berthold wrote:
I have neither with VS7 nor with VC6 had any problems installing STLport.
You simply should open a DOS box (with VC environment), go into the STLport 'src' directory and run "nmake vc6.mak".
That is true, if you want their IOStreams. I couldn't get that to compile, so I just followed the instructions without their IOStreams, which involves uncommenting a #define.
Alexander Berthold wrote:
What was the name which caused the conflict?
I don't recall. I was hoping in posting this to find out if all of STLPort is in global space, or not. It may have been something like hide or delete, which may explain it. ( The code is at work ).
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Does anyone know if it is possible to retrieve the name of the current monitor on a system?
If you were to select Window control panel, system, device manager, monitors, the display driver name is shown. I want to get and use that name in my program, but I'm not sure how to do it.
I'd appreciate any suggestions. Thanks in advance.
- Greg
|
|
|
|
|
Try this out:-
enumerate all keys under :-
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class
For each key check the defaul value. For one of them the default value will be "Monitors"
Open that key. For me it was this key :-
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E96E-E325-11CE-BFC1-08002BE10318}
It will have subkeys. I had only one called "0000". Open that key :-
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E96E-E325-11CE-BFC1-08002BE10318}\0000
See the value of this string - DriverDesc. For me it was "Default Monitor" as I hadnt installed my monitor's driver yet. The info you see in device manager is taken from this key. You'll also find other interesting details here like DriverDate, InfPath etc.
Good luck
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|