|
extern
I vote pro drink
|
|
|
|
|
You need to declare your global variables in the app file. You can get the vaiable valuefrom any cpp using theApp.global_variable
Best Regards...
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
The best way is to declare them extern in the stdafx.h, and declare them in stdafx.cpp.
Anyone who adds globals to a project without wrapping them in a namespace should move on the VB, in my opinion. That includes the writers of Microsoft sample code.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
|
|
|
|
|
Christian Graus wrote:
Anyone who adds globals to a project without wrapping them in a namespace should move on the VB
LOL, VB 6.0 you mean. Because, with VB.NET there are no global variables.
I vote pro drink
|
|
|
|
|
Nemanja Trifunovic wrote:
with VB.NET there are no global variables.
I knew that, actually, because I've been reading my C# book. One of the first differences to C++ that I thought was actually excellent.
I've been reading 'Design and Evolution of C++', as I've probably said, and it's interesting to me that Stroustrup does not like a lot of C++ constructs that remained for C compatibility. Reading through some of his statements I think there are many aspects of C# he would approve of, although that is all undermined by his public distaste for languages owned by a corporation.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
|
|
|
|
|
Christian Graus wrote:
I think there are many aspects of C# he would approve of
The one he would really like (I love it) is the use of ref and out in function calls. With C++, you must go to the function definition to learn whether the variable is passed by value or by reference.
I vote pro drink
|
|
|
|
|
I need to have a XOR'd full screen mouse cross hair style cursor tracker.
Something similar to DrawFocusRect would produce when clicking and dragging in a window, but "without" using OnMouseUp and OnMouseDown I only want to draw the lines when the mouse in moving.
XOR lines require you to draw them in the same location to remove them so how using OnMouseMove would I implement something like the above...??? I'm at a loss for ideas on how to do this...???
repainting the screen on each mousemove is unacceptable! It has to be XOR'ed.
Thanx a bunch!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
use OnMouseMove.
if the mouse is in the rect you're interested in:
get a CClientDC
draw the x-hairs at the "last" pos
draw them at the current pos
set "last" = current
there's probably a lot of special case stuff that you'll have to deal with, but that's the basic way i do this kind of thing.
-c
Smaller Animals Software, Inc.
You're the icing - on the cake - on the table - at my wake. Modest Mouse
|
|
|
|
|
Thats almost what i've been doing, but still i'm getting the same problem. When the mouse first moves over the client area the first drawn rect stays put and the rest are removed properly.
CClientDC dc(this);
static int lastX=point.x, lastY=point.y;
dc.DrawFocusRect(CRect(-10, -10, lastX, lastY));
dc.DrawFocusRect(CRect(-10, -10, point.x, point.y));
lastX = point.x;
lastY = point.y;
Any ideas...?
Thanx again!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
try initializing "last" to something offscreen. as it is now, you're drawing that first rect three times (twice here, and once again the next time you hit this function). you've got to be sure you're only drawing the same spot twice (or any multiple of 2, actually)
-c
Smaller Animals Software, Inc.
You're the icing - on the cake - on the table - at my wake. Modest Mouse
|
|
|
|
|
Hey thanx again i've managed to fixed the problem with the following:
static BOOL bFirst = TRUE;
static int lastX=point.x, lastY=point.y;
if(bFirst)
dc.DrawFocusRect(CRect(-10, -10, point.x, point.y));
else{
dc.DrawFocusRect(CRect(-10, -10, lastX, lastY));
dc.DrawFocusRect(CRect(-10, -10, point.x, point.y));
}
lastX = point.x;
lastY = point.y;
bFirst = FALSE;
Now the only problem is on moving or resizing the last drawn rect re-appears where it last left off. Almost there I am...
Thanx again!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
hi, my question is actually about opengl. I have a 3D scene, in my window (opengl scene, off course), and I want to make it disappear when it translates beyond a certain depth (negative z direction) into the screen. How do I achieve this?
Also, is there any discussion thread (on code project or other sites) that is specific to just openGL?
|
|
|
|
|
|
Hi All,
I'm working on an app that needs to implement a Visual C++ style workspace dialog bar. I've got a dialog bar with a tree control on it. Double clicking on tree items opens different views of a document in an MDI child window. So far so goo.
I need to add the ability have a tab control on the dialog bar. So, for instance, let's say I'ev got two tabs, a View tab, and a Help tab. The user selectes the Help tab, the contents of the tree reflect various help topisc, otherwise the tree represents various views of a document. How can I go about implementing this? Obviously, I need to a tab control to the form. But how do I swap out the trees?
Thanks,
Aaron
|
|
|
|
|
Hi,
You've basically got two options here. The first way is that you have one tab control and one tree control. When the tab control selection changes, you blow away all of the tree items and repopulate the tree with new items.
The alternative method (and the one I would think was better) is to have two tree controls both occupying the same space. Then, when the tab selection changes, just do a ShowWindow(SW_HIDE) on one tree control and ShowWindow(SW_SHOW) on the other. This will result in much quicker switching, especially if the amount of items in the tree is large.
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
OK, thanks for the info. I will give that a shot.
Thanks again,
Aaron
|
|
|
|
|
Instead of putting controls on a dialogue form at design time, I want to put them on a trun time.
If there is a member variable which is a list of CButtons I need to create them and then alter properties such as size, position etc.
I assume the problem is related to the parent value, but any ideas ????
|
|
|
|
|
|
Trollslayer wrote:
I assume the problem is related to the parent value, but any ideas ????
I'm not sure I understand you here...however
If the number of controls required is ambiguous then I would suggest using a dynamic array of controls and calling there Create function.
If your only concerned with dialog boxes and the number of controls required is known you could:
1) Load the control(s) from a resource dynamically
2) Use a static array and call it's Create functions
The first method is probaly easier. I'm not sure from experience standpoint, but i'm thinking you could probably fill the dialog data structures yerself and make the calls to CreateDialogIndirect(). This would allow you to load a custom external file with the controls and positions and create the controls dynamically this way.
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hi,
I would like to create a new interface ( not dependent on an object, and not inheriting from IDispatch), how can I do that ?
Thanks, Bye
Braulio
|
|
|
|
|
Don't use the class wizzard.
Make rigth click over the class browser, and select new class....
Sometimes I prefer to add the interface by hand, I define the new interfase in the IDL file, I make a new guiid, and copy the class and rename that. Is easy only you need a little of practice...
Regards...
Carlos Antollini.
Sonork ID 100.10529 cantollini
Computer Science: solving today's problems tomorrow.
|
|
|
|
|
Thanks,
I will do that !
Bye !
Braulio
|
|
|
|
|
Keep in Touch...
Nos vemos...
OH Bob speak in Spanish....
Regards...
Carlos Antollini.
Sonork ID 100.10529 cantollini
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
|
|
|
|
|
Hi,
I'm having massive problems with connection points, UDT's and SAFEARRAYs.
I am trying to wrap my inproc server around an existing component. Unfortunately, it has been design around use with VB and the events that it fires pass data in safearrays. Consequently, in my C++ component I'm having a nightmare getting my event sink to compile. The IDL for the event is decalred thusly...
HRESULT ZoneMessage(
[in] SAFEARRAY(ZoneMeasurementElement)* ZoneArray);
I don't think that there is much I can do about this. But of course, it's documented that the compiler will not know anything about the UDT when it prerocesses the headers...
i.e. this in the header cannot work...
STDMETHOD(ZoneMessage)(
/*[in]*/ SAFEARRAY ZoneMeasurementElement)* ZoneArray);
and this proves to be the case. Now, I've read that states for an [out] parameter you should remove the UDT from the signature for the implementation like so...
STDMETHOD(ZoneMessage)(/*[out]*/ SAFEARRAY** ZoneArray);
But this is the crucial point, this is connection point method and, so I need to declare
STDMETHOD(ZoneMessage)(/*[in]*/ SAFEARRAY* ZoneArray);
This does not work. I've tried endless permutations and failed miserably. The only thing that compiled was to declare the [in] parameter as a VARIANT but that wasn't really getting me anywhere I don't think.
Any help appreciated.
matthew
|
|
|
|
|
Did you try running it with the Variant? Your safe array may be buried inside it. I've never tried this myself, but it seems like it might be worth a try.
Hope this helps,
Bill
|
|
|
|