📄 index.html
字号:
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="Template"
content="C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\html.dot">
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
<title>Girish</title>
</head>
<body bgcolor="#FFFFFF" link="#0000FF" vlink="#800080">
<h1>YAHP:(Yet another home page)</h1>
<p>This page is under (a lot of) construction. This page will
contain the information i spread around, usually in the
newsgroups. Oh, BTW, This is <a href="mailto:girishb@mvps.org">Girish
Bharadwaj</a>, one of the many guys who answer questions on
microsoft.public.vc.* newsgroups. This page will have some of the
interesting questions (and answers) so that you can get what you
need before you will raise the same question in the newsgroups.
Most of the time, someone else would have faced similar problems.
This page tries to act like a FAQ but this might not be truly
organized for some time to come. For the authoritative FAQ on
MFC, try <a href="http://www.stingsoft.com/mfc_faq">here</a>. For
an ATL FAQ, try <a href="http://www.worldofatl.com/">here</a>.
For ATL and Activex control FAQ try <a
href="http://www.widgetware.com/">here</a>.</p>
<p>Some tips for searching the answer for your question..</p>
<ol>
<li>Try to organize your thoughts. Get to the bottom of the
question. For e.g., you are trying to get the keyboard
input to your dialog application. Right now, it just
beeps.What should you do? Well, the first thing you can
think is WM_KEYDOWN needs to be handled.Now, you need to
know why is the **** dialog not getting WM_KEYDOWN. So,
whip up the infoviewer and go to the search page and say
WM_KEYDOWN AND CDialog. You will get a list of articles
dealing with those two keys. IMHO, its better to create a
subset of the infoviewer stuff to include only Knowledge
base and conduct search on that.</li>
<li>If you dont find anything useful there, try going to <a
href="http://support.microsoft.com/support">http://support.microsoft.com/support</a>
and conduct the search there. Who knows, there might be
an updated KB article over there..</li>
<li>If you dont find there, then go to well known FAQ sites
like the ones listed above and the good and relevant
sites and search there.</li>
<li>If you dont find it there, Then, go to <a
href="http://www.dejanews.com/">www.dejanews.com</a> and
search for those keywords there. I am not sure you will
find anything interesting unless you have pretty specific
keywords, but hey, its worth a try.</li>
<li>If you dont find it even there, Then you can be sure that
you have stumbled on a problem which is pretty weird and
needs some attention from other developers. Then, post it
on the newsgroups. But, dont hold your breath.</li>
<li>If the problem is really severe and you cannot wait, you
can contact microsoft support engineers. They will be
able to help you but they do charge per incident. For
more details contact microsoft at <a
href="http://www.microsoft.com/support">www.microsoft.com/support</a>.</li>
</ol>
<p> </p>
<p>Ok, To learn about yours truly, you can visit this <a
href="http://members.tripod.com/%7eGBharadwaj">site</a>. I am
thinking of moving it over here. Until then, it will be there.</p>
<h2>Q & A:</h2>
<p><strong>Note</strong>: When you are going thru this Q & A
list, if you find a Microsoft KB (Knowledge base) reference
(which you will find a lot) and has a ID like QAAABCC then you
will be able to access it directly without having to go through
the Microsoft search site like this <font color="#800000">http://support.microsoft.com/support/kb/articles/QAAA/B/CC.ASP</font>
. Dont click here since it does not point to any valid site.</p>
<p>There is no particular order in which this is added. And this
page will be updated as questions are asked and answered.</p>
<h3>Questions:</h3>
<p><img src="Bullet7.gif" tppabs="http://www.codeguru.com/gurus/GirishB/Bullet7.gif" width="15" height="12"><var> </var><a
href="#WM_KEYDOWN">How to get WM_KEYDOWN in a Dialog based
Application</a><var>?</var></p>
<p><img src="Bullet7.gif" tppabs="http://www.codeguru.com/gurus/GirishB/Bullet7.gif" width="15" height="12"><a
href="#static_listbox">I have two list box's in my pogram. In the
list boxes I have set up my own tab stops. Is there anyway to put
some sort of static header box with the same tab stops so I can
label the listbox?</a></p>
<p><img src="Bullet7.gif" tppabs="http://www.codeguru.com/gurus/GirishB/Bullet7.gif" width="15" height="12"><var> </var><a
href="#tab_caption">You can set the caption of a property page in
it's constructor to be different than the caption of the
template, but how do you change the tab caption at some later
time?</a></p>
<p><img src="Bullet7.gif" tppabs="http://www.codeguru.com/gurus/GirishB/Bullet7.gif" width="15" height="12"><var> </var><a
href="#wizard_caption">How do you set the title of the Property
sheet when you are in Wizard mode?</a></p>
<p><img src="Bullet7.gif" tppabs="http://www.codeguru.com/gurus/GirishB/Bullet7.gif" width="15" height="12"><var> </var><a
href="#Remove_X">I have a floating toolbar and would like to
remove the X button (close/hide) and the 'hide' option from the
right button properties menu. Does anyone know how I can do this?</a><var>
</var></p>
<p><img src="Bullet7.gif" tppabs="http://www.codeguru.com/gurus/GirishB/Bullet7.gif" width="15" height="12"><var> </var><a
href="#accel_modeless">How to use accelerators in a modeless
dialog box with MFC?</a></p>
<p><img src="Bullet7.gif" tppabs="http://www.codeguru.com/gurus/GirishB/Bullet7.gif" width="15" height="12"><var> </var><a
href="#arrow_cform">I've wrote a custom control and use it in
CFormView. Now the problem is, that I want to use the arrwokeys
in this control. I can't catch this key with WM_KEYDOWN. By
default the key changes the focus to the next control. How can I
capture the arrow-keys in my custom control ?</a></p>
<p><img src="Bullet7.gif" tppabs="http://www.codeguru.com/gurus/GirishB/Bullet7.gif" width="15" height="12"><var> </var><a
href="#default_propsheet">How to set the default button in a
property Sheet?</a></p>
<p><img src="Bullet7.gif" tppabs="http://www.codeguru.com/gurus/GirishB/Bullet7.gif" width="15" height="12"><var> </var><a
href="#disable_propsheet">How to disable a property page in a
property Sheet?</a></p>
<p><img src="Bullet7.gif" tppabs="http://www.codeguru.com/gurus/GirishB/Bullet7.gif" width="15" height="12"><var> </var><a
href="#Richedit_dlg">How do I use RichEdit Control in a dialog?
If I just insert it on the dialog, the application just does not
start</a><var>.</var></p>
<p><img src="Bullet7.gif" tppabs="http://www.codeguru.com/gurus/GirishB/Bullet7.gif" width="15" height="12"><var> </var><a
href="#DoPrompt">Does anyone know what parameters are passed to
CWinApp::DoPromptFileName()?</a></p>
<p><img src="Bullet7.gif" tppabs="http://www.codeguru.com/gurus/GirishB/Bullet7.gif" width="15" height="12"><var> </var><a
href="#redirect_dos">Can someone tell me how to redirect (or
catch) a DOS window output to a file or array. The output
is a black screen that comes up with a
WinExec("doscommand",SW_SHOWMINIMIZED) line. I tried to
have the command use the standard redirection parameters
">", but this doesn't get any output</a><var>.</var></p>
<p><img src="Bullet7.gif" tppabs="http://www.codeguru.com/gurus/GirishB/Bullet7.gif" width="15" height="12"><var> </var><a
href="#append_top">How do I append a couple of Menu resources
during run time at the top level?</a></p>
<p><img src="Bullet7.gif" tppabs="http://www.codeguru.com/gurus/GirishB/Bullet7.gif" width="15" height="12"><a
href="#app_path">I need to open a file which is in the same
directory as the application. How do I get the application path?</a></p>
<p><img src="Bullet7.gif" tppabs="http://www.codeguru.com/gurus/GirishB/Bullet7.gif" width="15" height="12"><var> </var><a
href="#resize_jumps">How to resize a window in jumps?</a></p>
<p><img src="Bullet7.gif" tppabs="http://www.codeguru.com/gurus/GirishB/Bullet7.gif" width="15" height="12"><a
href="#process_list">Is there an API or MFC call I can make to
see what applications are currently running on someone's
workstation?</a></p>
<p><img src="Bullet7.gif" tppabs="http://www.codeguru.com/gurus/GirishB/Bullet7.gif" width="15" height="12"><var> </var><a
href="#proppage_font">How to change fonts on a property page?</a></p>
<p><a href="#toolbar_dlg"><img src="Bullet7.gif" tppabs="http://www.codeguru.com/gurus/GirishB/Bullet7.gif" border="0"
width="15" height="12"> Is there any way to attach a toolbar
and a status bar to a dialog box?</a></p>
<p><img src="Bullet7.gif" tppabs="http://www.codeguru.com/gurus/GirishB/Bullet7.gif" width="15" height="12"><var> </var><a
href="#trackpopup">Can anyone tell me why TrackPopupMenu (and
variations thereof) won't return if the user clicks on any window
my app doesn't own?</a></p>
<p><img src="Bullet7.gif" tppabs="http://www.codeguru.com/gurus/GirishB/Bullet7.gif" width="15" height="12"><var> </var><a
href="#activex_size">I have created an ActiveX control. At design
time, I would like it to behave like the Timer control in Visual
Basic. That is, when it is drawn on a from it automatically sizes
down (or up) to a certain size.How do I do that?</a></p>
<p><img src="Bullet7.gif" tppabs="http://www.codeguru.com/gurus/GirishB/Bullet7.gif" width="15" height="12"><var> </var><a
href="#side_frame">Is there a way to find out on which side of
the frame a controlbar is docked?</a></p>
<p><a href="#default_folder"><img src="Bullet7.gif" tppabs="http://www.codeguru.com/gurus/GirishB/Bullet7.gif" border="0"
width="15" height="12"> How do you set a default folder to
be selected when you call SHBrowseFolder?</a></p>
<p><img src="Bullet7.gif" tppabs="http://www.codeguru.com/gurus/GirishB/Bullet7.gif" width="15" height="12"><var> </var><a
href="#long_filename">How can I get the complete long filename of
a file (path and filename) if I know his short filename (8.3
format)</a><var> ?</var></p>
<p><img src="Bullet7.gif" tppabs="http://www.codeguru.com/gurus/GirishB/Bullet7.gif" width="15" height="12"><var> </var><a
href="#drive_type">I know how to get a drive type, but how do i
know if the drive is a 3 1/2, 5 3/4?</a></p>
<p><img src="Bullet7.gif" tppabs="http://www.codeguru.com/gurus/GirishB/Bullet7.gif" width="15" height="12"><var> </var><a
href="#Enter_tab">How to make Enter (VK_ENTER) to act like a tab
in a dialog box?</a> </p>
<p><img src="Bullet7.gif" tppabs="http://www.codeguru.com/gurus/GirishB/Bullet7.gif" width="15" height="12"><a
href="#disabled_tooltip"> How can I display tooltips for disabled
controls (for example CEdit)??</a></p>
<p><img src="Bullet7.gif" tppabs="http://www.codeguru.com/gurus/GirishB/Bullet7.gif" width="15" height="12"> <a
href="#tab_problem">I have embedded a property sheet and it's
pages to a CFormView.Both property pages and CFromView contains
controls such like edit-fields,buttons, comboboxes etc.The
problem is that sometimes when the focus is in property page it
does not come out of there and go to CFormview's controls. Why??
I have tried to set WS_EX_CONTROLPARENT and sometimes it
works.BUT when I embed ocx-control to property page I can't EVER
set focus to CFormViews controls with tab key ...Is there any
flags to set? Or any methos to override in ocx-control?</a></p>
<h3> Answers:</h3>
<h4><a name="WM_KEYDOWN">How to get WM_KEYDOWN in a Dialog based
Application?</a></h4>
<p>See this kb article "How to Trap WM_KEYDOWN Messages in a
CDialog" Article ID: Q117563. (<a
href="http://support.microsoft.com/support/kb/articles/q117/5/63.asp">http://support.microsoft.com/support/kb/articles/q117/5/63.asp</a>).</p>
<h4><a name="static_listbox"></a>I have two list box's in my
pogram. In the list boxes I have set up my own tab stops. Is
there anyway to put some sort of static header box with the same
tab stops so I can label the listbox?</h4>
<p>Check out this KB article "How to Place Static Text
Labels Over Columns in a List Box" ID:Q140158. </p>
<h4><a name="tab_caption"></a>You can set the caption of a
property page in it's constructor to be different than the
caption of the template, but how do you change the tab caption at
some later time?</h4>
<p>Check out this KB article"How to Change the Text in the
Tabs of a CPropertySheet"ID:Q141487. That shows the methods
to do this.</p>
<h4><a name="wizard_caption"></a>How do you set the title of the
Property sheet when you are in Wizard mode?</h4>
<p><code>BOOL CWizardSheet::SetPageTitle (int nPage, LPTSTR
pszText) </code></p>
<p><code>{ </code></p>
<blockquote>
<p><code>CPropertyPage *pPage = GetPage (nPage);</code></p>
</blockquote>
<blockquote>
<p><code>CTabCtrl* pTab = GetTabControl();</code></p>
</blockquote>
<blockquote>
<p><code>ASSERT (pTab);</code></p>
</blockquote>
<blockquote>
<p><code>if (GetActivePage() == pPage) </code></p>
</blockquote>
<blockquote>
<blockquote>
<p><code>SetWindowText (pszText); //If its the active
page</code></p>
</blockquote>
</blockquote>
<blockquote>
<p><code>//If its not the active page, just set the tab item</code></p>
</blockquote>
<blockquote>
<p><code>TC_ITEM ti;</code></p>
</blockquote>
<blockquote>
<p><code>ti.mask = TCIF_TEXT;</code></p>
</blockquote>
<blockquote>
<p><code>ti.pszText = pszText;</code></p>
</blockquote>
<blockquote>
<p><code>VERIFY (pTab->SetItem (nPage, &ti));</code></p>
</blockquote>
<blockquote>
<p><code>return TRUE;</code></p>
</blockquote>
<p><code>}</code></p>
<p>Use SetPageTitle anywhere you want to change the title text.</p>
<p> </p>
<h4><a name="Remove_X"></a>I have a floating toolbar and would
like to remove the X button (close/hide) and the 'hide' option
from the right button properties menu. Does anyone know how I can
do this? </h4>
<p>This is possible bot it might be a bit hacky..:-) I did this
to remove the caption..</p>
<p>First create a timer for a small interval SetTimer
(1,100,NULL)in CMainFrame..</p>
<p>In the OnTimer ()</p>
<p><code>void CMainFrame::OnTimer(UINT nIDEvent) </code></p>
<p><code>{</code></p>
<blockquote>
<p><code>static bool bFirstTime = true;</code></p>
</blockquote>
<blockquote>
<p><code>if (m_wndToolBar.IsFloating ())</code></p>
</blockquote>
<blockquote>
<p><code>{</code></p>
</blockquote>
<blockquote>
<blockquote>
<p><code>if (bFirstTime)</code></p>
</blockquote>
<blockquote>
<p><code>{</code></p>
</blockquote>
<blockquote>
<blockquote>
<p><code>CRect rect;</code></p>
</blockquote>
<blockquote>
<p><code>//GetParentOwner is to get to the
CMiniDockFrameWnd which is the</code></p>
</blockquote>
<blockquote>
<p><code>owner of the Toolbar..</code></p>
</blockquote>
<blockquote>
<p><code>//Earlier i used GetParent()->GetParent
()..Now this..</code></p>
</blockquote>
<blockquote>
<p><code>m_wndToolBar.GetParentOwner()->ModifyStyle(WS_SYSMENU,0);</code></p>
</blockquote>
<blockquote>
<p><code>m_wndToolBar.GetParentOwner()->GetWindowRect(rect);</code></p>
</blockquote>
<blockquote>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -