|
Many thanks
|
|
|
|
|
FYI: Visual C++ 2008 SP1+ has a shared_ptr Class[^] as well.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks Mark. But unfortunatly I can't use it as my application is portable across multiple platforms. I believe the one which you said is not portable (please correct me if I am wrong). Your help is much appreciated though.
|
|
|
|
|
Christian Flutcher wrote: portable across multiple platforms
In that case Boost is a better option for the time being if you need shared_ptr.
shared_ptr will currently only be found on compilers that have implemented the
TR1[^] extensions.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi all,
I have made a dialog based application and in that i have put some buttons, now the problem is i am putting bmp on dialog using picture control and then bmp's on my button control. my pictrue control is hiding my buttons but when i press alt alt my buttons become visible....
how can i remove this problem...
thanks in advance
|
|
|
|
|
What you're saying isn't clear.
Is the picture control so large that it is covering the buttons?
Are the buttons visible in design mode?
|
|
|
|
|
buttons are visible in design
|
|
|
|
|
You didn't answer the other question. Is the picture control so large that it is physically covering the buttons?
|
|
|
|
|
VCProgrammer wrote: how can i remove this problem..
What problem?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi,
your message is not very clear. My best guess is your PictureBox is autosizing, i.e.
it is growing according to the size of the picture you are showing, and in doing so it
is covering up some Controls it did not cover while designing.
One solution is to disable the autosizing, and possibly choose image stretching instead,
so the image is scaled to fit your picturebox (warning: this does not preserve the aspect ratio).
I don't know the details in C++/MFC.
|
|
|
|
|
Luc Pattyn wrote: I don't know the details in C++/MFC.
u gimme codez sir, no wordz, plz plz sir.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Since you didn't mention urgent nor homework, and being in a good mood, I will assume you
are a professional, and have the stamina to create your own codez.
You could prove me wrong at any time though...
|
|
|
|
|
Hi all,
when i Build or Rebuild my application it takes so much time.
before some time its not takes so much time.i dont know now why it takes so much time for build the application.
i want to speed up the build process.
is its possible.
please tell me .
thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
1) Check whether the incremental Linking is enabled in the project settings. It can slow down each time when you rebuild the application. Try turning off the incremental link. This thread[^] is interesting.
2) Check whether the latest visual studio service pack is installed.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
In addition to the things mentioned by Jijo Raj, try configuring your projects to use Precompiled Headers.
|
|
|
|
|
|
I've never seen one, but you can always try Google.
|
|
|
|
|
you'll have to use a library (like Gecko[^], for example)
|
|
|
|
|
I have a class called curves and an stl::list of them called curveList.
class curve {
int getValue();
.
.
.
} ;
typedef std::list<curve>::iterator curveItr;
class curveList
{
public:
curveItr getCurveByID(ID i);
.
private:
std::list<curve> _myList
.
}
in my code, I declare
curveItr iter;
iter = myCurveList.getCurveByID(1); // this returns the correct iterator
I get the right value back. Now I want to use iter to call a function of curve to return a value (I'm trying to avoid casting as pointers, list of pointers, etc). Everything I do throws a LINK error LNK2019 unresolved external. I have tried
iter->getValue();
*iter.getValue();
&(*iter)->getValue();
p = static_cast<curve *>(iter)
but everything throws back the same error. Is there a correct way to do this or do i have to resort to lists of pointers?
BTW, the curve/type declarations are in a separate file from getCurveByID is called.
|
|
|
|
|
mjackson11 wrote: Everything I do throws a LINK error LNK2019 unresolved external.
If it is a linker error, then it means that the code compiles fine. Besides, your first approach is the correct one (iter->getValue() ). The error specifies that you have decleared a function but you didn't provide any definition for it. I guess it is for the getValue function, am I right ?
To fix the problem, simply provide a function body.
|
|
|
|
|
Stupid programming tricks -- the method was defined in a file that was in the directory but not included in the project.
Two wasted days.
|
|
|
|
|
I have a long running program (written in C++ using MFC) that consists of one thread to handle the GUI interface and one or more worker threads to do the actual computation / simulation. The worker threads are simulating a stochastic process over and over again. When the worker thread completes one simulation, it notifies the GUI thread by reporting either a pass or fail. This notification is done by calling a member function in the GUI object.
The user interface displays the data entered by the user and every time a run is completed, I would like the user interface to be updated. However, I only want the single line that has changed. The line that has changed looks like:
Passed: <number> Failed: <number>
Currently, the member function that handles the reporting in the GUI object calls the routine CWnd::Invalidate(). This results in (my version of) OnPaint being called. This results in the entire screen being redrawn. Since, I am getting about 10 updates per seond, the screen appears to flicker. I only want to update the single line that has changed. If that line appears to flicker it is ok. What is the best way to do this?
Thanks
Bob
|
|
|
|
|
Hi,
IMO you should only invalidate that portion of the window that needs repainting, have a look
at CWnd::InvalidateRect
That will restrict the region that gets erased, and the information will also be passed to the
paint handler. For optimal performance and minimal flicker, make sure your OnPaint
only repaints the region it is told to repaint.
|
|
|
|
|
Luc,
I think I am starting to get this. Would the following approach work? First, for all calls to OnPaint, the routine will call GetUpdateRect with the address of a struct of type RECT. Recall that the struct RECT has four fields, top, bottom, left and right. These are not pointers but of type integer. Now, if all four fields are set to 0, then my code will redraw the entire window. It does this by executing a a bunch of calls to TextOut. I have a feeling that a more sophisticated MFC programmer would be using a bitmap and then selecting into the device context. However, I am not doing this.
Now, if I just want to redraw that one line, I could set top = bottom = 45 where 45 would be interpreted by my program to just redraw that one line. For that matter, I believe that I could choose any number as long as my program was consistent. Maybe even -45. Now, when my program wants to just update that one line, it would call Invalidate with the address of a struct of type RECT. The fields top and bottom in that struct would be set to 45. Does my approach makes sense?
Thanks
Bob
|
|
|
|
|
Hi Bob,
I don't believe what you suggest would result in correct behavior under all circumstances.
You can't just go and change the semantics of GetUpdateRect[^]; it will return the rectangle (in logical coordinates) that needs updating. It is provided by Windows; e.g. if another window partially obscures your window, then gets moved away, I expect GetUpdateRect to return the area you should repaint, using coordinates, not line numbers.
I suggest you try and look at the normal return values of GetUpdateRect when moving around the window, or moving something else on top and away again.
This is what I would try: whenever you modify a line of text, calculate its rectangular outline; in a first approximation you only need to calculate its vertical position, I would simplify and set the left and right to the entire window's left (=0) and right (=width). In a simple case, when no vertical scrolling is involved, all text lines use the same font and line distance, etc, that would be very simple. Then call InvalidateRect with that rectangle. I expect this normally will cause GetUpdateRect to return the rectangle you just invalidated, and hence OnPaint should now act on that information. One exception would be when several invalidates are still unprocessed in the message queue, Windows may and should optimize them by turning them into a single, possible larger,
invalidation.
BTW: I am a .NET programmer, I did only limited Win32 GUI stuff long ago, that is why I am not
completely sure about the above. However I think the logic behind it all is basically always the same.
|
|
|
|