|
Hi,
I have got a for loop in that i am doing some calucation and adding some value to list box, (using AddString method of CListBox class), but i don't see values are not updated on dialog's listbox at the time of insertion, even i have place UpdateData(TRUE) before inserting a string and UpdateData(FALSE) after inserting a string,but at the end calucation i see all values placed in listbox. can any one suggest what am i doing wrong.
Best Regards,
Mushq
Mushtaque Ahmed Nizamani
Software Engineer
Ultimus Pakistan
"English is my second language; please excuse any grammatical or spelling mistakes"
|
|
|
|
|
|
Thanxs
Best Regards,
Mushq
Mushtaque Ahmed Nizamani
Software Engineer
Ultimus Pakistan
"English is my second language; please excuse any grammatical or spelling mistakes"
|
|
|
|
|
Welcome
For your information:
While populating the items in the list, the GUI thread is blocked. That's why it is not updated by default. So if it takes much time for populating the list, the application will go to "not responding" state. In order to avoid that case you can use a worker thread to populate the list.
- NS -
|
|
|
|
|
There is no need to call UpdateData() when populating a listbox. You either need to update the listbox window after each insertion, or do this work in a separate thread so the main thread is not blocked. The former is obviously easier.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi,
How to find wheather a dilaog window is opened or not programatically.
Thanks
|
|
|
|
|
I'd try retrieving something from the window, such as DialogName.GetDC(), and then see if the function returns nothing, or something like that, although there should be a better way of checking.
|
|
|
|
|
You can use IsWindow, IsWindowVisible, etc
- NS -
|
|
|
|
|
Hi,
I have an option in my application tray menu to display a dialog.When i have used the IsWindowVisible also that particular dalog is displaying as many times the option in the tray menu is selected.If the dialog is already opened it should not open again.I have used the following code.But it doesn't work.How can i go further.
CDialog dlg;
if(dlg.IsWindowVisible())
{
dlg.ShowWindow(SW_HIDE);
}
Thanks
|
|
|
|
|
How do you show the dialog? DoModal?
Can you show me the code snippet of the menu option handling?
- NS -
|
|
|
|
|
void CMainFrame::OnSettings()
{
// TODO: Add your command handler code here
CSettings dlg;
if(!(dlg.IsWindowVisible()))
{
dlg.DoModal();
}
}
When i right click on my application's tray icon a tray menu will display.My tray menu have one of the option called "Settings".When click on "settings" the settings dialog( class name:CSettings) will display.But my problem is when i click on the settings n times,then n number Settings dilaog is opening.What i required is,if dilaog is already opened it should not open again.How can i do this.
Thanks.
|
|
|
|
|
The problem is that you are using the DoModal and the dlg is local in OnSettings(). In this case I will suggest a simple solution.
1. Make the CSettings dlg as class member, CSettings m_dlgSettings.
2. Change the code as,
void CMainFrame::OnSettings() <br />
{<br />
if( IsWindow( m_dlgSettings.m_hWnd )) return;<br />
m_dlgSettings.DoModal();<br />
}
3. Let me know the result...
- NS -
|
|
|
|
|
Thanks for ur reply.But it doesn't work.The dialog is displaying again and again when i click on the settings option in the menu again and again .
Thanks.
|
|
|
|
|
Oops really? I had tested the code in some sample application and it is working fine.
Are you sure that when you select the settings, on the second time, the control is coming to the same MainFrame object's OnSettings? And are you sure that the object is now member of the class?
Can you show me the relevant updations that you made?
- NS -
|
|
|
|
|
Thanks NS17.The problem was that i have given same ID for the two menu options in two menus.It is working fine.
Thanks
-- modified at 4:47 Friday 10th August, 2007
|
|
|
|
|
So you have two Settings dialog objects, rt? Can you make it global, instead of two member objects? If so only one object will be there.
- NS -
|
|
|
|
|
Welcome...
- NS -
|
|
|
|
|
This is obviously not going to work. When DoModal() is called, it does not return until the dialog has been dismissed. Therefore, OnSettings() will not get called more than once.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Is it possible to execute C, C+, and C# in C++?
|
|
|
|
|
Jay Minor wrote: Is it possible to execute C, C+, and C# in C++
Can you please explain what exactly do you mean by "executing". If you have exe's developed in any of the language you can execute them in C++ using the ShellExecute API.
It would be good if you can put some more thought and explain to everyone here what do you exactly want to achieve.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Can you more explain do you have any code on the C# if yes you cant use of them on the c++.
|
|
|
|
|
Well I don't care much about C#; most importantly I want to know if I can code C and C+ in C++. ex. a very basic app like some calculations
|
|
|
|
|
Sometime its possible use of C code on the c++ but for C# its different.
|
|
|
|
|
From what I understand if you want the C++ compiler to interpet a peice of code as C you preface it with extern "C" However I have a typedef of a fucntion with the word "class" and another with the word private I preface these typedef with extern "C" and still get an error re: the class syntax e.g the C code would be foo( int *class) I changed the code to read extern "C" foo(in *class) and it still flags the class keyword shoudn't the compiler compile the code as C becuase of extern "C" keyword ???
|
|
|
|
|
ForNow wrote: From what I understand if you want the C++ compiler to interpet a peice of code as C you preface it with extern "C"
Nope, that's not the purpose of extern "C". The purpose of extern "C" is taht your C++ compiler will create a C linkage of the functions inside the block. The difference between C and C++ linkage is that in C++ there is function overloading, meaning that you can have several functions with the same name but different arguments. The linker, to differentiate those functions uses name mangling (the function is identified by its name and with special characters that 'describe' its parameter list). In C, you don't have function overloading so the linker uses the name of the function only to identify a function.
So, when you specify an extern "C" block, all the functions inside that block will have a C linkage (meaning also that you won't be able to overload them).
So, you cannot simply have C++ code and wrap it with extern "C" so that it can be compiled with a C compiler.
|
|
|
|