|
Hi,
What is the difference in creating a CWnd derived or a CStatic derived owner-draw control (e.g. can I handle different messages, are there any limitations)?
I plan to rewrite some of my owner-draw controls (e.g. CStatic based image/text output). It seams for a CWnd based control the user needs to enter the exact class name in the resource editor, while with a CStatic based control the user can simply choose a static type in the resource editor. Thanks for feedback.
/Moak
|
|
|
|
|
In sense of limitations - no difference.
With CWnd you need to do a bit more work, that is register a new window class. With CStatic there is no need in registration as it is already done and called STATIC [as I could remember it correctly].
It seams for a CWnd based control the user needs to enter the exact class name in the resource editor, while with a CStatic based control the user can simply choose a static type in the resource editor.
Yes it is so.
--
=====
Arman
|
|
|
|
|
Thanks, seams I am going to be lazy and will design my owner-draw controls as CStatic derived classes.
/M
|
|
|
|
|
you're probably not knowing that CStatic inherits from CWnd...
|
|
|
|
|
seams I haven't done my homework.... that implies that there is no limitation using a CStatic. thanks
|
|
|
|
|
nope, that implies that inheriting a CStatic will bring you some stuff that CWnd haven't, which you probably don't want in your own control... but all depends what you want to do
|
|
|
|
|
Hi there,
I was wondering and i'd like to know..
How can I add a function to the file properties menu (when you right click a file)?
For example when you have installed Norton, when you right click a file a "scan file with norton" appears..
Anyone knows?
|
|
|
|
|
|
Is there an easy way to fix a path -- so that it matches the filesystem?
"C:\DOCUMENTS AND SETTINGS\PETER" to fix to "C:\Documents And Settings\Peter"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc.</A>
|
|
|
|
|
What made it all caps in the first place?
"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
|
|
|
|
|
a bug -- it remains a problem because this information got persisted into storage.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc.</A>
|
|
|
|
|
Never mind - it only works for one folder level!
-- modified at 16:53 Tuesday 1st May, 2007
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I found a way to fix it:
wstring CPathTools::FixPathToMatchFileSystem( const wstring& path )
{
TCHAR ShortPath[_MAX_PATH];
GetShortPathName( path.c_str(), ShortPath, sizeof(ShortPath)/sizeof(ShortPath[0]) );
TCHAR LongPath[_MAX_PATH];
GetLongPathName( ShortPath, LongPath, sizeof(LongPath)/sizeof(LongPath[0]) );
return _T2W(LongPath);
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc.</A>
|
|
|
|
|
Cool! Thanks for the update!
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
btw, did you know that windows didn't care about case in folders names ?
in your explorer, just paste C:\DOCUMENTS AND SETTINGS\PETER and see if it doesn't go to C:\Documents And Settings\Peter
|
|
|
|
|
duh.
The software I am working on deals with file synchronization. I scan the disk and I get change notifications -- and I report these to a server that puts them into a database...
Server is happier and faster when file/path names are consistent.
Download soonr.com -- get your files on your mobile phone...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc.</A>
|
|
|
|
|
Hello all,
I've subclassed a Cedit control just in order to be able to jump to the next control (with WS_TABSTOP) each time the user press the DOWN ARROW and to go to the previous control (with WS_TABSTOP) each time that the user press the UP ARROW.
well I'm using something like this in my subclassed control:
void CTAMEdit::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
switch (nChar)
{
case VK_UP:
{
GetParent()->GetNextDlgTabItem(this,TRUE)->SetFocus();
return;
}
case VK_DOWN:
{
GetParent()->GetNextDlgTabItem(this)->SetFocus();
return;
}
case VK_RETURN:
{
FinishEditing();
return;
}
}
CEdit::OnKeyDown(nChar, nRepCnt, nFlags);
} As you can see this is a very easy thing... but when I'm going forward (VK_DOWN) everything goes perfect, but when I'm going backwards (VK_UP) the focus enters into a MSChart that I have as the last control in my taborder. (I mean that the focus should bypass that control as it does when I go forward, but it don't).
Any idea? this is not critical, so I'm not very worried on that, but I'm being curious...
PS: I'm not handling cursor keys in any other place of my application.
As always thank you in advance...
|
|
|
|
|
If the parent window is a dialog, what happens if you use this...
// Move focus to Next
GetParent()->PostMessage(WM_NEXTDLGCTL, 0, 0);
// Move focus to Previous
GetParent()->PostMessage(WM_NEXTDLGCTL, 1, 0);
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Much better...
And moreover I've seen why this was failing... of course my fault...
I had subclassed two type of controls and one of them was not correctly subclassed.
Thank you for your answer.
|
|
|
|
|
Hi guys..
Pls help,how to i display a text of words on "edit control" when i press a button.
Pls advice.
Thks.
|
|
|
|
|
link a variable to that CEdit, that variable can be a "control variable" or a "value variable", if it is a control variable, you can do something like this:
CEdit m_Sample;
m_Sample.SetWindowText("");
if you prefer to use the value variable you can use that:
Cstring m_Sample = "";
UpdateData(XXXX); => I never remember if here I must use TRUE or FALSE... one of them is the good one...
Hope this helps.
Regards.
PS: in order to make those variables I'm sure that on the dialog you can right click over the control and select add variable or something like this... I've never used VC2003, only VC6 and a little bit 2005...
|
|
|
|
|
I am trying to write an app using MFC which allows me to drag small dialogs around and drop them in static windows. The idea is, the dialogs represent workers and the static windows represent a work position. The problem I am having is when I drop the second dialog in the same static window, it simply overlaps the first dialog so you can't tell there are two dialogs ( or three or four etc.).
I have been using this code to try and detect when the static has a dialog in it:
void CBoxes1Dlg::OnLButtonUp(UINT nFlags, CPoint point) <br />
{<br />
CRect rect;<br />
CWnd *pWnd1;<br />
CPoint pt;<br />
int y=0;<br />
<br />
CWnd *pWnd = ChildWindowFromPoint(point);<br />
if(pWnd!=NULL) {<br />
pWnd->GetWindowRect(rect);<br />
ScreenToClient (rect);<br />
pt.x=rect.left+5;<br />
pt.y=rect.top+5;<br />
pWnd1=pWnd->ChildWindowFromPoint(pt,CWP_ALL);<br />
<br />
if(pWnd1 == pWnd){<br />
}else{<br />
}<br />
}<br />
m_person->SetWindowPos(&CWnd::wndTop,(pt.x),(pt.y),0,0,SWP_NOSIZE|SWP_NOZORDER);<br />
}
This doesn't work properly.....
Anyone see the problem or think of an easier way to do it.
Thanks
|
|
|
|
|
I am using waveIn API to retrieve specific audio device for audio input. I get correct string to identify all audio devices, including USB "webcam". However waveInOpen with WAVE_FORMAT_QUERY parameter set returns "MMSYSERR_BADDEVICEID Specified device identifier is out of range".
Any idea what is wrong here?
I would prefer to stay with waveIn.
Thanks for reading.
|
|
|
|
|
What are you using as a device ID (second param passed to waveInOpen())?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Thanks Mark for reply.
I am passing the int returned from combobox under USB device...
I may be 1 off since it is the last one!
Also - if the combo box is "sorted" how does that match with right device?
Basically it seems weird that waveInOpen will accept item number from combo box.But that what the doc says.
I'll work on it when I get home.
I guess passing query is still not guarantee that I got the capable device.
|
|
|
|