Click here to Skip to main content
15,917,177 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: can't set input focus Pin
Neville Franks12-Oct-04 10:49
Neville Franks12-Oct-04 10:49 
GeneralRe: can't set input focus Pin
hyling12-Oct-04 11:24
hyling12-Oct-04 11:24 
GeneralRe: can't set input focus Pin
Neville Franks12-Oct-04 11:43
Neville Franks12-Oct-04 11:43 
GeneralRe: can't set input focus Pin
David Crow12-Oct-04 10:53
David Crow12-Oct-04 10:53 
GeneralRe: can't set input focus Pin
hyling12-Oct-04 11:14
hyling12-Oct-04 11:14 
GeneralRe: can't set input focus Pin
Neville Franks12-Oct-04 11:38
Neville Franks12-Oct-04 11:38 
GeneralDisable Move Pin
nethaji12-Oct-04 7:52
nethaji12-Oct-04 7:52 
GeneralRe: Disable Move Pin
Andrzej Markowski12-Oct-04 19:41
Andrzej Markowski12-Oct-04 19:41 
Congratulations!!! Good question. I wasted two hours of my life today doing this s..t for you.
Below is a solution of the problem:
BOOL CYourDlg::PreTranslateMessage(MSG* pMsg) 
{
if((pMsg->message==WM_NCLBUTTONDOWN && SendMessage(WM_NCHITTEST,0,pMsg->lParam)==HTSYSMENU) || 
(pMsg->message==WM_NCRBUTTONDOWN && SendMessage(WM_NCHITTEST,0,pMsg->lParam)==HTCAPTION))
{
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
if(GetStyle()&WS_THICKFRAME)
pSysMenu->EnableMenuItem(SC_SIZE,MF_BYCOMMAND|MF_ENABLED);
else
pSysMenu->EnableMenuItem(SC_SIZE,MF_BYCOMMAND|MF_GRAYED);
if(GetStyle()&WS_MINIMIZEBOX||GetStyle()&WS_MAXIMIZEBOX)
{
if(GetStyle()&WS_MINIMIZEBOX)
{
if(IsIconic())
{
pSysMenu->EnableMenuItem(SC_MINIMIZE,MF_BYCOMMAND|MF_GRAYED);
pSysMenu->EnableMenuItem(SC_RESTORE,MF_BYCOMMAND|MF_ENABLED);
}
else
{
pSysMenu->EnableMenuItem(SC_MINIMIZE,MF_BYCOMMAND|MF_ENABLED);
pSysMenu->EnableMenuItem(SC_RESTORE,MF_BYCOMMAND|MF_GRAYED);
}
}
else
pSysMenu->EnableMenuItem(SC_MINIMIZE,MF_BYCOMMAND|MF_GRAYED);
if(GetStyle()&WS_MAXIMIZEBOX)
{
if(IsZoomed())
{
pSysMenu->EnableMenuItem(SC_MAXIMIZE,MF_BYCOMMAND|MF_GRAYED);
pSysMenu->EnableMenuItem(SC_RESTORE,MF_BYCOMMAND|MF_ENABLED);
}
else
{
pSysMenu->EnableMenuItem(SC_MAXIMIZE,MF_BYCOMMAND|MF_ENABLED);
pSysMenu->EnableMenuItem(SC_RESTORE,MF_BYCOMMAND|MF_GRAYED);
}
}
else
pSysMenu->EnableMenuItem(SC_MAXIMIZE,MF_BYCOMMAND|MF_GRAYED);
}	
<BR>pSysMenu->EnableMenuItem(SC_MOVE,MF_BYCOMMAND|MF_GRAYED); // gray MOVE item
int nRet = pSysMenu->TrackPopupMenu(TPM_LEFTALIGN|TPM_RIGHTBUTTON|TPM_RETURNCMD, LOWORD(pMsg->lParam), HIWORD(pMsg->lParam), this);
PostMessage(WM_SYSCOMMAND,nRet,pMsg->lParam);
return 1;
}
}
return CDialog::PreTranslateMessage(pMsg);
}

Regards,
Andrzej Markowski

My Latest ArticlesCCustomBitmapButton: An owner-draw button and a frame for the caption bar, in one class.
CCustomTabCtrl: A clone of the Excel tab sheet control.

GeneralUnicode &lt;-&gt; MBCS Pin
EurekaJim12-Oct-04 7:09
EurekaJim12-Oct-04 7:09 
GeneralRe: Unicode &lt;-&gt; MBCS Pin
jan larsen12-Oct-04 7:19
jan larsen12-Oct-04 7:19 
GeneralRe: Unicode &lt;-&gt; MBCS Pin
Michael Dunn12-Oct-04 20:32
sitebuilderMichael Dunn12-Oct-04 20:32 
GeneralRe: Unicode &lt;-&gt; MBCS Pin
EurekaJim13-Oct-04 5:11
EurekaJim13-Oct-04 5:11 
GeneralMFC CFile help! Pin
Anonymous12-Oct-04 7:03
Anonymous12-Oct-04 7:03 
GeneralRe: MFC CFile help! Pin
BlackDice12-Oct-04 7:08
BlackDice12-Oct-04 7:08 
GeneralRe: MFC CFile help! Pin
ANDYFA12-Oct-04 11:48
ANDYFA12-Oct-04 11:48 
GeneralWindow Media Player Control Pin
RockRock12-Oct-04 6:47
RockRock12-Oct-04 6:47 
GeneralRe: Window Media Player Control Pin
Ryan Binns12-Oct-04 18:30
Ryan Binns12-Oct-04 18:30 
GeneralRe: Window Media Player Control Pin
RockRock13-Oct-04 8:47
RockRock13-Oct-04 8:47 
GeneralRe: Window Media Player Control Pin
Ryan Binns14-Oct-04 1:55
Ryan Binns14-Oct-04 1:55 
GeneralaVisual C++ 6 editor Problem Pin
Leyu12-Oct-04 6:44
Leyu12-Oct-04 6:44 
GeneralRe: aVisual C++ 6 editor Problem Pin
Ryan Binns12-Oct-04 18:31
Ryan Binns12-Oct-04 18:31 
GeneralRe: aVisual C++ 6 editor Problem Pin
Aamir Butt12-Oct-04 19:50
Aamir Butt12-Oct-04 19:50 
GeneralFile Streaming Pin
RockRock12-Oct-04 6:43
RockRock12-Oct-04 6:43 
GeneralValidating control content when loosing focus Pin
JGranborg12-Oct-04 6:30
JGranborg12-Oct-04 6:30 
GeneralRe: Validating control content when loosing focus Pin
David Crow12-Oct-04 6:33
David Crow12-Oct-04 6:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.