|
Hi,
Here I send the code written.This works in main dlgbox(dlg1),but displys empty boxes in dlg2 dlgbox.
//This is used for connection//
void CClientsDlg::CreateConnection(CString czDBPath)
{
_glbDB.sDriver ="MICROSOFT ACCESS DRIVER (*.mdb)";
_glbDB.sFile = czDBPath;
_glbDB.sDsn.Format("ODBC;DRIVER={%s};DSN='';DBQ=%s",_glbDB.sDriver,_glbDB.sFile);
_glbDB.database.Open(NULL,false,false,_glbDB.sDsn);
}
//method to retrieve data dynamically from a database
void CClientsDlg::LoadProjects()
{
CString czProjName;
CString lProjID;
CString SqlString;
CRecordset recset( &_glbDB.database);
// Build the SQL statement
SqlString = "SELECT * from tbl_Project order by ProjectName";
recset.Open(CRecordset::forwardOnly,SqlString,CRecordset::readOnly);
m_cboProject.ResetContent();
while( !recset.IsEOF() )
{
// Copy each column into a variable
recset.GetFieldValue("ProjectID",lProjID);
recset.GetFieldValue("ProjectName",czProjName);
// Insert values into the list control
m_cboProject.SetItemData(m_cboProject.AddString(czProjName),atol(lProjID));
// goto next record
recset.MoveNext();
}
// Close the database
recset.Close();
}
swapna_signsin
|
|
|
|
|
If CClientsDlg is dlg1, then this code snippet is doing exactly what it is supposed to do. Why would you think it could populate controls on another modal dialog box?
You need to explain further what it is that you are after.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
Now I want to insert another dlgbox say dlg2,with a combobox that displays the data as the combobox of CClientDlg,I am not able to retrieve the data into the combobox of 2nd dlgbox.
Wht do I need to do for that.
swapna_signsin
|
|
|
|
|
In one of dlg1's methods:
dlg2.m_strValue = some_value_from_dlg1;
dlg2.DoModal();
...
BOOL dlg2::OnInitDialog()
{
CDialog::OnInitDialog();
m_combobox.AddString(m_srValue);
} Does that make sense?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
HI,
Thankyou,but,I didn't understand "some value from dlg1",.. is it should be one of the records we retreive or wht it could be.How will the local var of dlg1 be available in dlg2.
Will this hlp in retrieving the data "dynamically"
swapna_signsin
|
|
|
|
|
How to compile a dialog-resource, header file, and source file into a DLL file.
I want make a dll including a dialog-resource, header file, and source file,
I want to reuse it in another project.
Is any one can help me?
I develop in VC6++.
|
|
|
|
|
|
Hi
Could some one pls explain the difference between OnDraw and OnPaint in CView?
I have a MDI application and I find that OnPaint is getting called on window resize but OnDraw is not getting called. However, for a SDI application I find that OnDraw is being called on window resize.
Is it something related to SDI, MDI? What is the basic difference between both these functions??
|
|
|
|
|
OnPaint() is the handler for WM_PAINT . OnDraw() is an MFC-specific function. The framework calls OnDraw() for both drawing on the screen and printing, that way the same drawing code can be used for both situations.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
thanks for the info.. I have this mdi appln wherein the OnDraw handler was not being called till the point I had removed the handler for the OnPaint message.
What is the connection between both, are they supposed to be mutually exclusive? I guess all that should happen is the both thye handlers shall be called twice but it does not happen that way. Why is it so?
|
|
|
|
|
Hi All,
I have a window that on the left side it has a list control, and selecting an item in that list , switch between child dialogs (same as in all property pages).
my problem is that before i jump into the new page i validate the current page and if it is not invalid i show a message. here i want to prevent the list from jumping to the new selected item.
here is the code i use:
BEGIN_MESSAGE_MAP(...)
ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST,OnListItemChanged)
ON_NOTIFY(LVN_ITEMCHANGING,IDC_LIST,OnListItemChanging)
END_MESSAGE_MAP(...)
void CMyWnd::OnListItemChanged(NMHDR* pNMHDR, LRESULT* pResult)
{
NMLISTVIEW *pState = (NMLISTVIEW *)pNMHDR;
//... do whatever
*pResult = 0;
}
void CMyWnd::OnListItemChanging(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pState = (NM_LISTVIEW*)pNMHDR;
if (pState->iItem == m_iCurrentItem)
{
if (!ValidatePage(...)
{
*pResult = TRUE;
return;
}
}
*pResult = FALSE;
}
the problem is that the OnTopicListItemChanging is being called twice so i get twice a message box.....i tried to prevent that using a static bool variable, but didn't do me good...
any suggestions?
thanks in advanced
Yaron
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
-- modified at 10:33 Wednesday 10th May, 2006
|
|
|
|
|
YaronNir wrote: the problem is that the OnTopicListItemChanging is being called twice...
You get a notification for the item that is no longer selected, and another for the item that is being selected. You should be able to look at NMLISTVIEW 's uNewState and uOldState member variables.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
problems...
look at the following code:
void CMyWnd::OnListItemChanging(NMHDR* pNMHDR, LRESULT* pResult)
{
NMLISTVIEW *pState = (NMLISTVIEW *)pNMHDR;
if (0 == pState->uNewState && 2 == pState->uOldState)
{
if (!m_pDlg->ValidatePage())
{
AfxMessageBox(_T("aa"));
*pResult = TRUE;
}
else
{
*pResult = FALSE;
}
}
}
First time i step into the function, the uNewState is 0 and uOldState is 2 therefor validation is being checked and a message box pops. the function then returns TRUE which means it doesn't allow the new selection to be made.
but i see i step into this function again, with the same parameter values (for uNewState and uOldState) so once again i see the message box for validation
how can i solve this?
thanks
Yaron
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote 
|
|
|
|
|
The msdn says the following:
Programming Considerations
For WIN32 graphical applications: when the currently logged-in user is logging-off, all WIN32 top-level windows receive WM_QUERYENDSESSION and WM_ENDSESSION messages. Some WIN32 applications choose to terminate upon receipt of such messages. In order for your WIN32 application to survive logoff, it must not do that: instead, your windows procedure should call the default windows procedure on these messages.
But I have no idea how to develop this?
Can anybady give me an advice or example, how to make my srvany-service "logoff-save"?
Thank you!
|
|
|
|
|
steff.k@gmx.net wrote: Can anybady give me an advice or example, how to make my srvany-service "logoff-save"?
Just return 0 when you receive the WM_QUERYENDSESSION message.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
|
hi experts
i have a dialog-based application in which i had placed two buttons.when the first button is pushed it wil start generating some strings.so when i pushed the next button it should stop generating strings.itried it with some bool variables .but control is not received to stop button.how can i do that?
joy
|
|
|
|
|
When you start you first button, how the data is generated ? In a loop ?
If yes, start a new thread to process the data and like that, it won't freeze the GUI. Then, you can simply have a boolean set to true/false to continue the loop or not.
|
|
|
|
|
hi
sorry to disturb you.can you please tell me how can i start a thread?
thanking you
joy
|
|
|
|
|
You can use the CreateThread[^] function for that. Anyhow, I think you need to read a little bit how to work with threads. Make a search in the articles of this website, perhaps you'll find something usefull. Also, google can help
It is a little bit long to explain how it works in a post.
|
|
|
|
|
either use a separate thread for the 'generate some strings' part, or use the old-fashioned "message pump" function inside your string generating code.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
What is msgsrv.exe? What is it responsible for?
|
|
|
|
|
Aryan S wrote: What is msgsrv.exe?
Windows' 32-bit message server.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
MS has a kb article about it: http://support.microsoft.com/kb/q138708/
|
|
|
|
|
Hi,
I'd like to know how it's possible de edit a EMF with visualC++
I want to be able to import an EMF image and explode it, to be able to eddit the text in the image
thanks
|
|
|
|