|
Thanks to mail me..But how can i use it..
|
|
|
|
|
still i am waiting for your response.
|
|
|
|
|
|
I'm working on MS Visual C++ 6.0. I have a dialog with a combo box on it. Since it needs to display the items in sorted order, i have checked the 'sort' feature available by right-clicking on the combo box and choosing "Sort". This does the job, except that the sorting takes place such that 11 appears before 2 (because the sorting is string based). I need the sorting done based on the length too i.e it should appear as 9, 10 ,11 and not 10, 11 and then 9.
How can I edit the "Sort" functionality of the combo box?
|
|
|
|
|
what are the values that your combo carry.
are they fixed? or are they going to change regularly.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
they are not fixed. Will change regularly.
|
|
|
|
|
in that case, follow what experts said below.
i.e. you have to sort them manually.
liz3 wrote: they are not fixed. Will change regularly.
it would be good, if you can narrate your task, with an example.
like,
1.are they going to have only numeric values? or can it have text too.
2.will it be loaded at the initiation of the application? or in between while operation on the UI.
3.please narrate what are the different possible values and what are the conditions, at which the values get addd to the combo.
all the best.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
AFAIK you should - disable the automatic (lexicographic) sort of the combobox.
- Sort yourself the items on insertion.
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]
|
|
|
|
|
This is a common problem with listbox types that sort on string values and do not take account of numbers. I think the only way to get your items in the correct order is to sort them manually and then add them to an unsorted combobox.
It's time for a new signature.
|
|
|
|
|
For a fixed owner draw combo box, handle WM_COMPAREITEM of parent dialog. Or create your own CComboBox derived class and over-ride CComboBox::CompareItem(). Implement your comparison logic there
CComboBox::CompareItem
WM_COMPAREITEM Message
|
|
|
|
|
In addition to the above suggestions, I offer the following.
If you don't mind the items of the combo box items look a bit different, and also you know the maximum width of the numbers, you can pad the items with leading zeros. This way, with the "sort" property set to true, the items will sort correctly.
For example, if you know the maximum width will be two, then format the items like this: 02, 09, 11, 10, etc.
Hope this helps.
|
|
|
|
|
I have a toolbar that can be dynamically floated. It is then in a window with a close button. How do I reopen it if it has been closed? Alternatively, how do I remove the close button.
Haakon S.
|
|
|
|
|
Add a menu item and handler in your CMainFrame class
void CMainFrame::OnViewMyToolbar()
{
if (m_wndMyToolBar.GetSafeHwnd() != NULL)
{
ShowControlBar(&m_wndMyToolBar, !m_wndMyToolBar.IsWindowVisible(), TRUE);
RecalcLayout();
}
}
void CMainFrame::OnUpdateViewMyToolbar(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck(m_wndMyToolBar.GetSafeHwnd() != NULL && m_wndMyToolBar.IsWindowVisible() ? 1 : 0);
}
|
|
|
|
|
Thank you very much, Niklas. ShowControlBar was the key. I kept trying ShowWindow.
Too little research from my side, I should have managed to find out
But again, thanks for pointing in the right direction.
Best regards Haakon S.
|
|
|
|
|
Hi,
I am having a console application. Its a hidden application.I want to close that application.But still it remains in the task manager,its not getting closed.
Im using following code :
CWnd * cWindow = FindWindow("Afx:400000:8:10011 :4604cf", NULL);
::SendMessage(cWindow->m_hWnd, WM_QUIT, (WPARAM) 0, (LPARAM) 0);
Can anyone please tell me where is the error?
Thanks,
|
|
|
|
|
Why don't you send WM_CLOSE ?
See "Terminating Windows-Based Application from Another App".
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]
|
|
|
|
|
How to get class id for a hidden application
|
|
|
|
|
Normal console applications do not have a message loop.
It is not message driven.
It just starts executing the main function until the main function returns.
So you cannot send it a windows message.
So if the application is running, it should be either waiting on a wait object or waiting for input or running in a loop.
So you need to tell us what exactly is going on here.
|
|
|
|
|
That console application acts as a watcher. It will open another application.If that application gets crashed,the watcher will again reinvoke that application.While closing the application,that application will close that watcher too.
|
|
|
|
|
OK. Now what I want to know is how the watcher is watching the other application.
Does it wait on the process handle?
Or is it checking for the process existence in a loop?
|
|
|
|
|
it will check that application in a loop
|
|
|
|
|
That is not a very good design.
This is how I would do it.
Start a loop with a flag condition.
Use CreateProcess or any other API that returns a handle to the newly created process.
Use WaitForSingleObject on the process handle.
When WaitForSingleObject returns, use GetExitCodeProcess on the process handle.
In the watched application, you can return an arbitrary value (eg. 15243) for normal shutdown.
So if GetExitCodeProcess returns the arbitrary value, set the flag so that the control comes out of the loop and the watcher also exits.
|
|
|
|
|
|
Hi,
I want to put all my 3 classes (cpp and .h file) in a dll file. I tried using MFC ext dll but to use this dll, I have to use .h file of every class.
How can I avoid that i.e. how to avoid attaching the 3 .h files?
|
|
|
|
|
You can declare all 3 or more classes in a single .h file.
In this case you will only need to include one .h file.
So put all #include statements in a .h file of your own.
Then you can use the single .h file that you created.
|
|
|
|