|
Hello everyone,
As mentioned in Gotw about deque. What means "streamlined version of deque with simplified iterators"? I did some search and can not find out.
http://www.gotw.ca/gotw/054.htm
--------------------
Finally, note that the popular library implementation that I tested has since been revised and now includes a streamlined version of deque with simplified iterators. I do not yet have a copy of that library, but it will be interesting to see how much of the deque disadvantage in even the raw iterator "traverse" and element-accessing "at" tests will remain compared to vector.
--------------------
thanks in advance,
George
|
|
|
|
|
it simply means there is a STL library somewhere that even Sutter does not yet have (at the time of the writing) contains a streamline version of the dequeue container and simplified iterator.
streamline means better (either in performance and/or in memory useage).
simplified means, well, more simple than the current implementation (I assume the current one is not simple)
I also assume that you know that the "Guru Of The Week" #54 is nearly 19 years old (written in 1999) and that there have been lots of improvements in STL and that what he was writing about is probably already included in the current STL implementation and that there are no "non" streamline or "non" simplified versions of dequeue.
you could try to get a copy of the dequeue code from that time and compare it with the current code to see what have changed.
|
|
|
|
|
Thanks Maximilien!
1.
What is your point? The Gotw #54 is out of date?
2.
I want to learn your comments about what do you think are possible improvements? compare with traditional implementation of deque? Currently, I only know traditional way of implementing deque -- chunks and chunks containing elements.
regards,
George
|
|
|
|
|
Hi,
I just want to ask how can i select folder in file open dialog?
Because it usually enters a folder when i select it.
Is it possible?
If not what should i use and how will i do it?
Thank you.
|
|
|
|
|
|
You can do this by adding another button to the dialog template ([Select] for example), and when clicked you can return the path(s) to the selected item(s).
Lookup customizing the common file dialog for more information on how to specify a custom dialog template and react to actions taken in it.
Peace!
-=- James Please rate this message - let me know if I helped or not!<hr></hr> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Hello friends,
Please find the following code that creates the problem in release mode and run well in debug mode.I am using VC 6.0.
<
#include "win.h"//this file contains the declarations of the classes
#define ID_TIMER1 1
BEGIN_MESSAGE_MAP(MyWin,CFrameWnd)
END_MESSAGE_MAP()
MyWin::MyWin()
{
Create(NULL,"Test");
}
BEGIN_MESSAGE_MAP(App,CWinApp)
ON_WM_TIMER()
END_MESSAGE_MAP()
BOOL App::InitInstance()
{
m_pMywin=new MyWin();
m_pMainWnd=m_pMywin;
m_pMainWnd->UpdateWindow();
m_pMainWnd->ShowWindow(SW_SHOWNORMAL);
::SetTimer(NULL,ID_TIMER1,5000,NULL);
return TRUE;
}
void App::OnTimer()
{
AfxMessageBox("App Timer");
}
App obj;
>
ritz1234
|
|
|
|
|
First of all: debug your application!
This is essential if you want help from others. You will be asked questions about the results from your debugging sessions and if you cannot answer those questions, you cannot be helped. An explanation like "it crashes" is always wrong unless followed by an explanation about how it crashes.
More on the problem:
In my opinion you're using the timer API in an unusual way by having the application class handle the WM_TIMER message. Having your window class setting up the timer and handle its events would be more straight forward. I'm not saying that it's impossible, because it's not, but if you're less experienced with MFC and message handling you'd be better off by choosing a main stream solution.
You should also read the documentation carefully; calling ::SetTimer() with the hWnd param set to NULL makes the function return the ID of the timer. It could be a new ID that you're supposed to use when calling ::KillTimer(), but you simply ignore it.
You also have to verify that the problem actually is related to the timer. In your previous thread you mention something about multiple threads and a web cam that may also have something to do with this.
Now I'm just guessing, but it could be a plausible cause: you have an ActiveX control that receives input from the web cam and you're trying to access it from another thread than the one that created the control without proper marshalling.
To help you further, whether it would be me or anyone else, you have to debug your application and tell us how it fails.
If you're only having troubles in the release version, then build the release version with debug info. There are more differences between building release mode and debug mode than just creating the debug info.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Hi,thanx for the reply,
Right now forgot about the previous posts.
This is the sample test application which also fails believe me.
If you want then try it out.
It crashes in release mode as following.
When I run the application in release mode the OnTimer function gets
executed and then after it crashes with dialog to send the error report
to microsoft with the "send" and "Don't send" buttons.
The win.h file on the above code snippest has the following code
class MyWin:public CFrameWnd
{
public:
MyWin();
DECLARE_MESSAGE_MAP()
};
class App:public CWinApp
{
public:
MyWin *m_pMywin;
BOOL InitInstance();
afx_msg void OnTimer();
DECLARE_MESSAGE_MAP()
};
ritz1234
|
|
|
|
|
I copied your code to make a SDI project with VC++ 2005. There are some issues.
First of all, the prototype of OnTimer is not what you wrote. The correct one is:
afx_msg void CWnd::OnTimer(UINT_PTR nID);
OnTimer is a member function of CWnd . And Your App class is of the base CWinApp , which is not CWnd .
And Secondly, your this line doesn't compile at all.
BEGIN_MESSAGE_MAP(App, CWinApp)
ON_WM_TIMER()
END_MESSAGE_MAP()
The reason is as mentioned above: OnTimer is a member function of CWnd , not of CWinApp . Therefore static_cast is not allowed.
Maxwell Chen
|
|
|
|
|
Ok, in other words:
You have a serious design flaw in your application. You're using the SDK version of SetTimer() since SetTimer() is not defined in CWinApp . When using MFC you would usually do this in a CWnd derived class since SetTimer() is defined in the CWnd class.
Using the ON_WM_TIMER macro is very wrong in your case, since it assumes the class to be a CWnd subclass and you're using it from a CWinApp subclass. On top of that the message handler you provide as a parameter to ON_WM_TIMER must be declared as
afx_msg void OnTimer( UINT nIDEvent ); . You have omitted the parameter which will, at the best, corrupt the stack frame.
Like I wrote earlier, it's possible to use a timer in the app class, but chances that this is really what you want to do are ridiculously close to zero depending on how the MFC framework is intended to be used.
I recommend you to stay within the MFC classes for doing basic stuff like this.
If you want to start the timer when the application start, you should declare a message handler for the WM_CREATE message and override the CWnd::OnCreate() member function. From your message handler you can call CWnd::SetTimer() . Use the wizards for this and don't forget to add a message handler for WM_TIMER as well and override CWnd::OnTimer() .
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Hi, thanx Roger and Maxwell.
I also realize that I should not use the timer for the application class
because they can be used by the CWnd derieved class. So I change the code
of the application and I use timer in class derieved from CMDIFrameWnd.
So the problem is solved now.
Thanks for the help once again.
ritz1234
|
|
|
|
|
I need to write a text line vertically and at the same time the font must have every char displayed with the same width (like courier , or like the font used in VS editor to let us move vertically along the columns) (hope be clear).
Now:
If I use Courier Font I get the right font...but it seems uncompatible with the nEscapement parameter to write the text vertically.
If I use Tahoma the nEscapement parameter is well imported, but the space between the char is not constant.
So
How can I find a font that let me use both this properties?...Is there some property that I can check?
Of course...only using the standard fonts that Windows user has got by default.
Thanks a lot
Russell
|
|
|
|
|
Not sure, But why not let the CreateFont() pick the font which matches the characteristics?
|
|
|
|
|
I am using CreateFont....but not every font type understand the Escapement parameter...I'm trying every font right now... I'm going crazy
Russell
|
|
|
|
|
Russell' wrote: I'm trying every font right now
I think you are setting the font name in the "lpszFace"
"If lpszFace is NULL or empty string, GDI uses the first font that matches the other specified attributes" from msdn.
|
|
|
|
|
Courier New math both the required.
Plus:
To have constant spacing with every font must be set both lfHeight and lfWidth!!! . So you can also use many other fonts (compatible with the lfEscapement parameter)more then Courier New .
But a little problem remains:
One time that the font writes in vertical way the size of the text it is not perfecly rotated (there is a little stretch) ... propably because the pixels are not squared, but rectangular. (any trick?)
Bye bye
Russell
|
|
|
|
|
hi there
i've made an application which use a lib.
how can i build an executable file, without deliver the dll's.
how can i know which files have to be near the executable?
|
|
|
|
|
Do you want to know wwhich files your program is used?
|
|
|
|
|
hi,
i am beginner to visual c++ . so i have no idea that how can i store & Retrive data in databse using visual C++(Not MFC).
Anybody have idea that from which point i start.
i am very thankful if anybody give me proper or useful link for start.
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
modified on Thursday, March 6, 2008 10:12 AM
|
|
|
|
|
Is it correct returning value from catch() block?
Can the calling function get return value when there was exception caught by try{}, catch() in called function?
Best Regards,
Suman
|
|
|
|
|
Provided that the function returns a value of that type it is correct in the aspect of C++ syntax to return a value from inside a catch block.
However, I would rather have the return statement outside the catch block since in my opinion the code would be easier to read. I would have a return value at function scope that I would assign a value inside the catch block and return it at the last line of the function.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
i want to sent ctrl+alt+delete to remote computer,
i using postmessage() API, its working fine all os except VISTA.
is there any chance to send/simulte ctrl+alt+delete in VISTA.
Anybody hav ideal,plz help me.
|
|
|
|
|
Hi,
When i am trying to build my C++ exe using /clr option, i am getting the following Link Error:
StdAfx.obj : error LNK2020: unresolved token (0A001984)......
Please could someone suggest me how to resolve this error?
Regards
Rinnu
|
|
|
|
|
Try to ask the right forum (the managed C++/CLI one).
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
|
|
|
|