오전 11:54 2003-03-26
조경민 (bro@shinbiro.com)
=================================================
1. win 2k/xp에서 포커스 받기
by Nishant S
//Attach foreground window thread
//to our thread
AttachThreadInput(
GetWindowThreadProcessId(
::GetForegroundWindow(),NULL),
GetCurrentThreadId(),TRUE);
//Do our stuff here ;-)
SetForegroundWindow();
SetFocus(); //Just playing safe
//Detach the attached thread
AttachThreadInput(
GetWindowThreadProcessId(
::GetForegroundWindow(),NULL),
GetCurrentThreadId(),FALSE);
2. 톱레벨 윈도우에서 데스크탑안으로 위치 조정하기
SendMessage(DM_REPOSITION);
3. 커서바꾸기
BOOL CTest_deleteDlg::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
// TODO: Add your message handler code here and/or call default
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_UPARROW));
// Now we return instead of calling the base class
return 0;
// return CDialog::OnSetCursor(pWnd, nHitTest, message);
}
4. 배경 바꾸기
//Red background with Green colored controls
SetDialogBkColor(RGB(255,0,0),RGB(0,255,0));
5. 태스크바에서 없애기
CFrameWnd *abc=new CFrameWnd();
abc->Create(0,0,WS_OVERLAPPEDWINDOW);
CNoTaskBarIconDlg dlg(abc);
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
delete abc;
Now we need to modify the dialog window's style. So put this code in your CDialog-derived class's OnInitDialog. We need to remove the WS_EX_APPWINDOW style.
BOOL CNoTaskBarIconDlg::OnInitDialog()
{
CDialog::OnInitDialog();
ModifyStyleEx(WS_EX_APPWINDOW,0);
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
}
6. 컨텍스트 헬프 만들기
BOOL HelpDialog::OnInitDialog()
{
//blah blah blah
//blah blah blah
ModifyStyleEx(0, WS_EX_CONTEXTHELP);
return CDialog::OnInitDialog();
}
BOOL HelpDialog::OnHelpInfo(HELPINFO* pHelpInfo)
{
short state = GetKeyState (VK_F1);
if (state < 0) // F1 key is down, get help for the dialog
return CDialog::OnHelpInfo(pHelpInfo);
else
{ // F1 key not down, get help for specific control
if (pHelpInfo->dwContextId)
WinHelp (pHelpInfo->dwContextId,
HELP_CONTEXTPOPUP);
return TRUE;
}
}
조경민 (bro@shinbiro.com)
=================================================
1. win 2k/xp에서 포커스 받기
by Nishant S
//Attach foreground window thread
//to our thread
AttachThreadInput(
GetWindowThreadProcessId(
::GetForegroundWindow(),NULL),
GetCurrentThreadId(),TRUE);
//Do our stuff here ;-)
SetForegroundWindow();
SetFocus(); //Just playing safe
//Detach the attached thread
AttachThreadInput(
GetWindowThreadProcessId(
::GetForegroundWindow(),NULL),
GetCurrentThreadId(),FALSE);
2. 톱레벨 윈도우에서 데스크탑안으로 위치 조정하기
SendMessage(DM_REPOSITION);
3. 커서바꾸기
BOOL CTest_deleteDlg::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
// TODO: Add your message handler code here and/or call default
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_UPARROW));
// Now we return instead of calling the base class
return 0;
// return CDialog::OnSetCursor(pWnd, nHitTest, message);
}
4. 배경 바꾸기
//Red background with Green colored controls
SetDialogBkColor(RGB(255,0,0),RGB(0,255,0));
5. 태스크바에서 없애기
CFrameWnd *abc=new CFrameWnd();
abc->Create(0,0,WS_OVERLAPPEDWINDOW);
CNoTaskBarIconDlg dlg(abc);
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
delete abc;
Now we need to modify the dialog window's style. So put this code in your CDialog-derived class's OnInitDialog. We need to remove the WS_EX_APPWINDOW style.
BOOL CNoTaskBarIconDlg::OnInitDialog()
{
CDialog::OnInitDialog();
ModifyStyleEx(WS_EX_APPWINDOW,0);
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
}
6. 컨텍스트 헬프 만들기
BOOL HelpDialog::OnInitDialog()
{
//blah blah blah
//blah blah blah
ModifyStyleEx(0, WS_EX_CONTEXTHELP);
return CDialog::OnInitDialog();
}
BOOL HelpDialog::OnHelpInfo(HELPINFO* pHelpInfo)
{
short state = GetKeyState (VK_F1);
if (state < 0) // F1 key is down, get help for the dialog
return CDialog::OnHelpInfo(pHelpInfo);
else
{ // F1 key not down, get help for specific control
if (pHelpInfo->dwContextId)
WinHelp (pHelpInfo->dwContextId,
HELP_CONTEXTPOPUP);
return TRUE;
}
}
'KB > MFC/Win32' 카테고리의 다른 글
새창으로 웹브라우저 띄우기 (0) | 2004.04.28 |
---|---|
동적으로 생성된 컨트롤이 메시지를 받지 못할때 (0) | 2004.04.28 |
VC++에서 제공하는 property를 에뮬레이트 (0) | 2004.03.19 |
msn6 코드 스니펫 (0) | 2004.03.19 |
MSN 코드 모음 (0) | 2004.03.19 |