|
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
|
|
|
|
|
How do you know when an object is going to destruct? Provided you don't implicitly call the destructor. Thanks in advance.
-CDudd
|
|
|
|
|
If you create the object with new the destructor is called as part of the operations performed by delete .
If the object is created on the stack (no new ), the destructor is called when the object goes out of scope (e.g. if it is a local variable inside a function, the destructor is called when the function exits).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
An object is destructed when explicitly delete d or when it goes out of scope, if created on the stack.
An object is also destructed when its containing object (if any) is destructed. This applies to implicitly constructed members of the containing class. Dynamically created members need to be explicitly delete d.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I use this code :
CBrush Red;
Red.CreateSolidBrush(RGB(255,0x00,0x00));
CBrush* savebrush = dc->SelectObject(&Red);
dc->BeginPath();
dc->Ellipse(11*Xunit,10*Yunit,16*Xunit,16*Yunit);
dc->Ellipse(14*Xunit,10*Yunit,19*Xunit,16*Yunit);
dc->MoveTo(8*Xunit,14*Yunit);
dc->LineTo(15*Xunit,20*Yunit);
dc->LineTo(22*Xunit,14*Yunit);
dc->EndPath();
dc->FillPath();
Some parts are painted as white area,but I want all of them to be red.
Any Suggestion?
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Check out SetPloyFillMode.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Hi!
I tried to eject media from my CD-ROM drive ( Z: ) in an MFC program by using Interrupt 21h. But when I run the program, I get an exception in KRNL386.EXE at 0001:00008614 and the program crashes. While bx was 001Ah before the crash as it should be, the "crashing dialog" tells me it is 898Dh after the crash. So what did I do wrong?
void CEjectDlg::OnEject()
{
WORD DriveNum = 26;
BYTE DeviceCat = 0x08;
__asm
{
mov ax, 440Dh
mov bx, DriveNum
mov ch, DeviceCat
mov cl, 49h
int 21h
}
}
Another thing: is there a way to close the drive again by using Interrupt 21h?
Thanks,
Martin
|
|
|
|
|
You probably ought to use DeviceIOControl to eject your device.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
|
I'm looking at this URL
http://www.codeguru.com/opengl/oglwrapperclass.shtml
under the heading - Basic Use
I'm trying to create my own MDI application and draw graphics in the child window. But I don't understand anything about the six steps. i.e. when it says to replace CView with CGLEnabledView, do I just replace the word? Or do I have to actually create the class CGLEnabledView with all the methods and variables. It also tells me to override the VideoMode and OnDrawGL functions. What does that mean? When I create an MDI app, I don't see any such functions in my workspace. Are they present in header files? Basically, could someone give me a more detailed step by step explanation of how to set up an MDI app. where I can draw OpenGL graphics in the child window.
|
|
|
|
|