|
|
I have a CWinThread derived class CMyThread. I create modalless dialog :
BOOL CManThread::InitInstance()
{
m_dlg.Create(IDD_DIALOG);
m_dlg.ShowWindow(SW_SHOW);
return TRUE;
}
Dialog works fine, but how to notify my thread when dialog is closed, so that i could sent WM_QUIT message to end the thread ?
Thanks
rrrado
|
|
|
|
|
You may override OnOK() or OnCancel() function in your dialog class, and send a WM_QUIT at that moment.
~RaGE();
|
|
|
|
|
thanks, but I tried to call m_thread->PostThreadMessage(WM_QUIT,0,0) inside of OnCancel. But after closing of dialog some Asssertion fails and application crashes.
rrrado
|
|
|
|
|
If all your thread does is create the modeless dialog, you don't need the thread at all. Just create the dialog and presto.
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
i failed to intercept WM_NOTIFY when i attempt to edit fields of my CListCtrl control in my dialog application..?
Here's my OnNotify code:
BOOL CQGenInstallDlg::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
// TODO: Add your specialized code here and/or call the base class
//<norman: 27-nov-2002="" handle="" editing="" on="" list="" view="" control="" this-="">m_lvSettingList>
UINT nNotCode = 0; //Notification code.
INT nCtrlID = 0; //wParam
LV_DISPINFO* pDispInfo = NULL; //lParam
pDispInfo = (LV_DISPINFO*) lParam;
nNotCode = pDispInfo->hdr.code;
if(nNotCode==LVN_BEGINLABELEDIT)
{
//Pre-edit processing.
}
if(nNotCode==LVN_ENDLABELEDIT)
{
//Post-edit processing.
UINT itemindex = pDispInfo->item.iItem;
CString newText = pDispInfo->item.pszText;
if(newText!="")
{
this->m_lvSettingList.SetItemText(itemindex, 1, newText);
}
}
//
return CDialog::OnNotify(wParam, lParam, pResult);
}
Hope someone can spot this for me. Thanks!
norm
|
|
|
|
|
Did you check the checkbox in the ressource editor so that your control _really_ sends a notify message ?
~RaGE();
|
|
|
|
|
sorry, what's a "resource editor"??
norm
|
|
|
|
|
In Vc++, you have usually a window on the left showing the class browser, or the files in your project or what i call the ressource editor which you can choose on the middle tab. In the properties of your control on your dialog (right click on your control to open this one) you have usually several tabs. On one of the page you might have a checkbox to check if you want your notify messages to work correctly.
Maybe you are not using ressources at all, so i must have made a complete fool of myself
~RaGE();
|
|
|
|
|
Joan,
I use the following routines to iterate all child nodes with a specific name:
<br />
typedef MSXML::IXMLDOMNodePtr NodePtr;<br />
<br />
<br />
NodePtr CXMLDocument::GetChild(NodePtr pNode, LPCTSTR pszName)<br />
{<br />
if (pNode == 0)<br />
pNode = m_pDoc;<br />
pNode = pNode->firstChild;<br />
<br />
while(pNode)<br />
{<br />
if (pNode->nodeType == MSXML::NODE_ELEMENT)<br />
{<br />
if (!pszName || _tcsicmp((TCHAR*) pNode->nodeName, pszName) == 0)<br />
return pNode;<br />
}<br />
pNode = pNode->nextSibling;<br />
}<br />
return 0;<br />
}<br />
<br />
<br />
NodePtr CXMLDocument::GetNext(NodePtr pNode, LPCTSTR pszName)<br />
{<br />
if (pNode == 0)<br />
pNode = m_pDoc;<br />
pNode = pNode->nextSibling;<br />
<br />
while(pNode)<br />
{<br />
if (pNode->nodeType == MSXML::NODE_ELEMENT)<br />
{<br />
if (!pszName || _tcsicmp((TCHAR*) pNode->nodeName, pszName) == 0)<br />
return pNode;<br />
}<br />
pNode = pNode->nextSibling;<br />
}<br />
return 0;<br />
}<br />
alternatively, you could look into XPath (there is a reference in the XML Parser DSK, which allows you to use pDoc->selectSingleNode("//result/node/buffers") to reference one or more specific elements
in your document.
Alwin
|
|
|
|
|
You can't expect a BSTR string to behave like a char*. Use this code instead.
IXMLDOMElement *p = ...;
CString szName;
BSTR bstrName;
p->get_nodeName(&bstrName);
BSTR_to_CString(bstrName,szName);
void BSTR_to_CString(BSTR bstr, CString &s)
{
s.Empty();
_bstr_t bstrTag(bstr);
UINT uLen = bstrTag.length();
if (uLen==0) return;
TCHAR *szTemp= new TCHAR[uLen+1];
memset (szTemp, 0, uLen+1);
LPOLESTR wszTag = bstrTag;
int iBytes = ::WideCharToMultiByte(CP_ACP, 0,
wszTag, uLen,
szTemp, uLen, NULL, NULL);
s = szTemp;
delete [] szTemp;
::SysFreeString(bstr);
}
|
|
|
|
|
I'm coming fom Borland OWL environement
and i would like to know How paiting my dialog background with
VC++6 in MFC ?
I'm juste a little lost with the MFC
I'm a newbie with the MFC
Thanks for u're help
ps: oops sorry my english is not perfect
Leedoriden
|
|
|
|
|
|
Hi:
I want the algorithm of arranging classes.I have thought it for many days,but the program does not work.If you have seen the algorithm,please tell me.
Thanks a lot.
Got it
|
|
|
|
|
happyboy wrote:
I want the algorithm of arranging classes
I'm sure I am not alone in having no idea what you're talking about ? Do you mean you have a container full of class objects and want to sort them ? If so, read my STL functors article. If not, please explain.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
I have an SDI app that supports 1 data fileformat.
I would like to add support for a custom image format in a way
that enables users to double click these image files in windows and the program will show these in a simple frame. I don't want to Edit/Save these image files, just register the filetype & show them.
When my app starts normally it should use the standard original doctemplate.
(not ask: New format A, or new Format b etc) I tried messing around with CMultiDocTemplate, but that doesn't seem to be quite it. Any suggestions on how to go about this one?
I think I should have a doctemplate with a CFrameWnd&CView (all basic behaviour), but should it be 2x single? Multi but not add the 2nd one?
Thanks!
|
|
|
|
|
how can i make my open file dialog to select a single DIRECTORY and FOLDERS ONLY?
and if the directory does not exist, enter the name at the edit box and create it?
here's my code:
int nRetCode = 0;
CString sFilePath;
CFileDialog fdlg(
TRUE,
NULL,
NULL,
OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
NULL,
NULL
);
//Check to see if the selected item is installation folder. If so, launch the open file dialog.
int index_selected = this->m_lvSettingList.GetNextItem(-1, LVNI_SELECTED);
//Launch open file dialog:
if(index_selected==0)
{
nRetCode = fdlg.DoModal();
this->m_strInstallDir = fdlg.GetPathName();
UpdateData(TRUE);
this->m_lvSettingList.SetItemText(0, 1, sFilePath);
UpdateData(FALSE);
}
norm
|
|
|
|
|
You may take a look at this question in Mike's FAQ.
Hope this helps.
~RaGE();
|
|
|
|
|
thanks, just downloaded a sample from code guru
http://www.codeguru.com/dialog/folder_dialog.shtml
not sure if it's free for commercial dev however.
norm
|
|
|
|
|
Hi !!
My app, developped with VC++6 creates a window. I want the window to be invisible, so I create it with the style SW_HIDE. It works, the window is not shown, but it remains in the taskbar (or whatever the correct name is : on the right side of the Start button, where each apps has a button with its name).
I don't want to see anything of my window, neither on the screen nor on the taskbar.
How can I do that ?
Thank you for your help !
Jerome
|
|
|
|
|
|
Thanks for the link ! Very interessant stuff !
Jerome
|
|
|
|
|
I'm creating a program that allows multiple uploads and downloads between two computers. I want to create a similar interface to the one found in LeechFTP. Hopefully someone out there is familiar with it. Using Spy++ it's apparent that the upload/download list is not a window itself. I can think of about a million ways to implement this, but was wondering what everyone else has to say about it. For those of you who haven't seen LeechFTP, it has a list of the current uploads and downloads with a progress bar and static text info for each thread. I'm also curious as to what's going on behind the scene. In my version I have a vector that holds classes that represent each upload/download in progress. Should each of these classes be able to draw the progress bar w/ static text info? How would I make this list scrollable?
Thanks for any suggestions!
-Michael Anderson- 完成の円
|
|
|
|
|
I would like to create a program that uses one document and uses multiple views to it. The document needs to get into dialog boxes and I am having a dificult time getting the document into them. How does one access the single document when creating a new view?
Cheers,
Clint
PS. Please let me know if the above doesn't make sense.
|
|
|
|
|
You can create multiple views that all refer to the same document.
Just register multiple CMultiDocTemplates in your CWinApp::OnInitInstance
method refering to different views.
To make the views "dialogish", inherit from CFormView.
I hope these pointer help.
Iain Clarke.
|
|
|
|