|
But ... don't I have to "upgrade" to windows x.y to keep the .NET current? If so it is still spending $ on this hobby which I could use on bying beer.
|
|
|
|
|
Your choice, of course. Stick with whichever technology you prefer.
|
|
|
|
|
Hi, if Key-Value pairs are like:
40000 "40000 is a first number"
41020 "41020 is a second number"
....
use CMapStringToString or CMap<int,int,string,string> to store.
Then which one is better in look up efficiency?
CMapStringToString or CMap<int,int,string,string>
|
|
|
|
|
econy wrote: Then which one is better in look up efficiency? I don't know, but I cannot imagine having to convert between ints and CStrings just to use the CMapStringToString could possibly be worth it, I would start with the CMap.
|
|
|
|
|
Why don't you test that?
Veni, vidi, vici.
|
|
|
|
|
Lookup requires comparing keys, i. e. calling the operator < and maybe operator == . Since these operators are more efficient for ints than they are for strings, I suspect that CMap is better. However, the rest of the looking-up algorithm that does not involve comparing keys may play a much more significant role on performance overall, so you might not notice a difference.
You should also consider whether there are other operations than looking up which are called often, e. g. insertion, removal, converting keys to different formats, etc.: E. g. if you spend a lot of time reading keys from a text source or writing them as text, then it may be advisable to just stick with string keys rather than converting them back and forth all the time!
|
|
|
|
|
Hi
I got handle to Grid Control of window of another ( external ) application. Used EnumChildWindows for getting child window handle.
But I am unable to read text from that grid control.
Can anyone provide any pointers for this ? Thanks in Advance.
|
|
|
|
|
The WM_GETTEXT message will only return the text of the window whose handle you provide. It will not include the content of child windows, as exist in a grid control.
|
|
|
|
|
Hi, am building a GUI MFC application, I have several toolbars in my application, i want my toolbars to auto align according to my application frame width, the code i have been tried is given below. By this code the toolbar is simply align in a single row. what should i do to reach my goal? thanks in advance
m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY);
tb1.EnableDocking(CBRS_ALIGN_ANY);
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
tb4.EnableDocking(CBRS_ALIGN_ANY);
tb8.EnableDocking(CBRS_ALIGN_ANY);
tb9.EnableDocking(CBRS_ALIGN_ANY);
tb2.EnableDocking(CBRS_ALIGN_ANY);
tb3.EnableDocking(CBRS_ALIGN_ANY);
tb6.EnableDocking(CBRS_ALIGN_ANY);
tb7.EnableDocki:confused:ng(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockPane(&m_wndMenuBar);
DockPane(&tb9);
DockPaneLeftOf(&tb8, &tb9);
DockPaneLeftOf(&tb4, &tb8);
DockPaneLeftOf(&m_wndToolBar, &tb4);
DockPaneLeftOf(&tb1, &m_wndToolBar);
DockPaneLeftOf(&tb7, &tb1);
DockPaneLeftOf(&tb6, &tb7);
DockPaneLeftOf(&tb3, &tb6);
DockPaneLeftOf(&tb2, &tb3);
A learner
|
|
|
|
|
Your intention is not totally clear, can you try and explain better what you are trying to do and what is not working ?
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
Entropy isn't what is used to.
|
|
|
|
|
|
|
Another comment:
Is your toolbar CMFCToolbar ?
From MSDN: http://msdn.microsoft.com/en-us/library/cc665920.aspx[^]
This method (EnableDocking) extends the base class implementation, CBasePane::EnableDocking, by setting the CBasePane::m_dwControlBarStyle data member to AFX_CBRS_FLOAT. This method then passes dwAlignment to the base class implementation.
Maybe you would need the AFX_CBRS_RESIZE as well, see here in the base class:
http://msdn.microsoft.com/en-us/library/cc701911.aspx[^]
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
Entropy isn't what it used to.
|
|
|
|
|
Yes am using CMFCToolbar, i have already checked with palette sample and EnableDocking();, they didnt help me i will attach the code i have tried for docking the toolbar
m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY);
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
tb1.EnableDocking(CBRS_ALIGN_ANY);
tb2.EnableDocking(CBRS_ALIGN_ANY);
tb3.EnableDocking(CBRS_ALIGN_ANY);
tb4.EnableDocking(CBRS_ALIGN_ANY);
tb6.EnableDocking(CBRS_ALIGN_ANY);
tb7.EnableDocking(CBRS_ALIGN_ANY);
tb8.EnableDocking(CBRS_ALIGN_ANY);
tb9.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockPane(&m_wndMenuBar);
DockPane(&tb1);
DockPane(&m_wndToolBar);
DockPane(&tb4);
DockPane(&tb8);
DockPane(&tb9);
DockPane(&tb7);
DockPane(&tb3);
DockPane(&tb6);
DockPane(&tb2);
|
|
|
|
|
Hello everybody,
I am playing with LibSDL and tried to use smart pointers for some of the objects created by the Library (i.E. SDL_CreateWindow returns a SDL_Window* which I would like to put into a std::shared_ptr<sdl_window>). For the rest of the post I will simple refer to SDL_Window but the same applies to other SDL objects.
The SDL_Window structure in the SDL header is a forward declaration for a simple structure without a destructor (plain old data) but there is a function called SDL_DestroyWindow which destroyes the SDL_Window and frees the allocated memory.
I use the following code to declare and initialize my smart pointer:
std::shared_ptr<SDL_Window> window(
SDL_CreateWindow( "Title", 0, 0, 640, 480, SDL_WINDOW_SHOWN ),
SDL_DestroyWindow
);
Now if I assign a nullptr to the initialized shared_ptr I get warning C4150 for deleting a pointer to the undefined or incomplete type SDL_Window but the SDL_DestroyWindow function gets called.
Am I doing something wrong or will I have to ignore this warning?
Thank you for your help,
Andreas
modified 7-Mar-14 14:40pm.
|
|
|
|
|
The warning is probably because of the forward declaration.
Look at the documentation - Compiler Warning (level 2) C4150[^]
«_Superman_»
I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++) (October 2009 - September 2013) Polymorphism in C
|
|
|
|
|
Hi!
I am sure the forward declaration is the problem because you cannot delete a forward declarated type. The compiler simply does not know if it has the call a destructor if it has not been declared.
But what I do not understand is why I get the warning if I supply a custom deleter. In this case the default delete (and therefor class destructor) should not be used by the shared_ptr template. If the last shared_ptr runs out of context it simply calls the provided custom deleter (which should know the full definition for the class it is deleting)
Thank you for your response, but it does not hit the mark.
However, I have found the problem (and the resolution) which I will explain in my next post.
Andreas
|
|
|
|
|
Hello again,
I now know what is causing the "problem" and will explain it.
Example code:
class MyIncompleteType; // forward declaration
std::shared_ptr<MyIncompleteType> y(myAllocate(), myFree);
y.reset(); // this works without warning (and calls myFree)
y = nullptr; // this gives me warning C4150
The second parameter to the shared_ptr constructor (myFree) is used to create a specialized a custom deleter template which calles myFree if the object pointed to by shared_ptr has to be deleted.
y.reset(); invokes the custom delimiter and sets the shared_ptr to empty (which is
y = nullptr; initialized the shared_ptr with a new pointer to an object uf MyIncompleteType which is actually nullptr, but a standard deleter is created which causes to C4150 warning because it would delete the object using 'delete' (which is not going to happen because the new pointer is nullptr).
So if you have to reset a shared_ptr of an incomplete type you simply have to use the reset() method.
Assigning a new value to the shared_ptr will also assign a new deleter and if you assign a nullptr it will be boxed and the shared_ptr created will use a default deleter which causes the warning C4150.
Andreas
|
|
|
|
|
Hi, in a modal dialog based MFC application, I use addFontResource() function to load font resource in application's InitInstance().
I want to use this font in all life of application.
when application ends, then release the font resource.
But I can't find the destructor of the modal dialog based MFC application, do I need to write it myself?
modified 7-Mar-14 11:15am.
|
|
|
|
|
See ExitInstance() .
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
It's a dialog based application, can't find
ExitInstance()
|
|
|
|
|
Override it, easiest done with the class wizard.
|
|
|
|
|
is that means CDialog class has a ExitInstance() member function? inherited from ,maybe a parent class.
I will check thhat
|
|
|
|
|
It means that your Application object (derived from CWinApp) has an ExitInstance() override.
|
|
|
|
|
Since you're adding the font in the application's InitInstance method, it would be properly matched if you release it in ExitInstance[^].
It would also work if done in the destructor of the dialog class, but ExitInstance would be cleaner.
The Visual Studio wizard does not normally output the dialog class destructor, but you could write one yourself as you would normally do and it will be called when the dialog class goes out of scope.
«_Superman_»
I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++) (October 2009 - September 2013) Polymorphism in C
|
|
|
|