日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > windows >内容正文

windows

【转载】windows mobile 上隐藏和关闭X以及OK的处理

發(fā)布時間:2025/6/17 windows 23 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【转载】windows mobile 上隐藏和关闭X以及OK的处理 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
【轉(zhuǎn)自】http://blog.csdn.net/czbever
1、隱藏X:
?在WM_CREATE里?SetWindowLong(hWnd,GWL_STYLE,WS_NONAVDONEBUTTON );
3、如果想將X按鈕改為退出程序而不是最小化,可以在初始化window時用:?SHDoneButton(hWnd,SHDB_SHOWCANCEL);?然后在OnCommand中的IDCANCEL中向窗口發(fā)送WM_CLOSE消息就可以關(guān)閉程序了
這樣子程序一開始就是ok按鈕。
4、對話框中將屏幕右上角ok隱藏:
在win32中需要在WM_INITDIALOG消息加入以下:SHDoneButton(hWnd,SHDB_HIDE);?SetWindowLong(hWnd,GWL_STYLE,WS_NONAVDONEBUTTON );
在MFC中,需要按以下方法處理:
BOOL CtestmfcDlg::OnWndMsg(UINT message, WPARAM wParam, LPARAM?
lParam, LRESULT* pResult){?if(message == WM_INITDIALOG)?{?? ? ? ? ? ? ? ?// 創(chuàng)建一個“完成”按鈕并調(diào)整其大小。?? ? ? ? ? ? ? ?SHINITDLGINFO shidi;?? ? ? ? ? ? ? ?shidi.dwMask = SHIDIM_FLAGS;?? ? ? ? ? ? ? ?shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_SIPDOWN?
| SHIDIF_SIZEDLGFULLSCREEN | SHIDIF_EMPTYMENU;?? ? ? ? ? ? ? ?shidi.hDlg = m_hWnd;?? ?::SHInitDialog(&shidi);
?? ?::SHDoneButton(m_hWnd,SHDB_HIDE);??? ?::SetWindowLong(m_hWnd,GWL_STYLE,WS_NONAVDONEBUTTON );
?? ? ? ? ? ? ? return (INT_PTR)TRUE;?}?return CDialog::OnWndMsg(message,wParam,lParam,pResult);}
或者在直接在OnInitDialog里替換掉CDialog::OnInitDialog.
BOOL CtestmfcDlg::OnInitDialog(){?? SHINITDLGINFO shidi;?? ? ? ? ? ? ? ?shidi.dwMask = SHIDIM_FLAGS;?? ? ? ? ? ? ? ?shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_SIPDOWN?
| SHIDIF_SIZEDLGFULLSCREEN | SHIDIF_EMPTYMENU;?? ? ? ? ? ? ? ?shidi.hDlg = m_hWnd;?? ?::SHInitDialog(&shidi);
?? ?::SHDoneButton(m_hWnd,SHDB_HIDE);??? ?::SetWindowLong(m_hWnd,GWL_STYLE,WS_NONAVDONEBUTTON );
?// 設(shè)置此對話框的圖標。當應(yīng)用程序主窗口不是對話框時,框架將自動?// ?執(zhí)行此操作?SetIcon(m_hIcon, TRUE); ? // 設(shè)置大圖標?SetIcon(m_hIcon, FALSE); ?// 設(shè)置小圖標
?// TODO: 在此添加額外的初始化代碼?return TRUE; ?// 除非將焦點設(shè)置到控件,否則返回TRUE}
The button at the right of the Task Bar (the bar at the top of your?
Pocket PC) is called the "Smart Minimize Button".

5、另外一種把X處理為退出程序的方法為子類化TaskBar:
But how do we manage to have the "Smart Minimize Button" close the?
application for us?
We have to hook it. Here's how it works: First, subclass the task?
bar window. The new window procedure must be looking for?
WM_LBUTTONUP messages in the rectangle of the button. When you?
intercept the message, post a WM_CLOSE message to your main frame.?
You will have to be careful when subclassing the task bar window?
procedure: you have to make sure that you will un-subclass it when?
your application loses the focus (deactivated) or when it is closed?
(essentially the same thing).
The Recipe for MFCAll the work you need to do is restricted to the CMainFrame class.?
First, let's look at the definitions you need to add to the header?
file:
extern HWND g_hWndMain, g_hWndTask;extern WNDPROC g_fnProcTask;static LRESULT CALLBACK TaskWndProc(HWND hWnd, UINT msg, WPARAM?
wParam, LPARAM lParam);

The static variables will store the task bar and main frame's?
window handles. The WNDPROC will store the task bar's original?
window proc. Now, go to the implementation file (CPP) and add these?
declarations:
//// Static variables for task bar subclassing//static HWND g_hWndMain = NULL;static HWND g_hWndTask = NULL;static WNDPROC g_fnProcTask = NULL;

Now, add the following protected methods to CMainFrame:
// CMainFrame::HookTaskBar//// Hook into the task bar//BOOL CMainFrame::HookTaskBar(){?//?// Already hooked??//?if(g_fnProcTask)??return FALSE;
?g_hWndTask = ::FindWindow(_T("HHTaskBar"), NULL);?if(g_hWndTask)?{??g_hWndMain = GetSafeHwnd();
??g_fnProcTask = (WNDPROC)::GetWindowLong(g_hWndTask, GWL_WNDPROC);
??::SetWindowLong(g_hWndTask, GWL_WNDPROC, (LONG)TaskWndProc);?}?return g_hWndTask != NULL;}

// CMainFrame::FreeTaskBar//// Free the task bar//BOOL CMainFrame::FreeTaskBar(){?//?// Already freed??//?if(!g_fnProcTask)??return FALSE;?::SetWindowLong(g_hWndTask, GWL_WNDPROC, (LONG)g_fnProcTask);?g_fnProcTask = NULL;?return TRUE;}

Add an OnActivate handler to the class (WM_ACTIVATE message):
// CMainFrame::OnActivate//// The frame is being activated / deactivated//void CMainFrame::OnActivate(UINT nState, CWnd* pWndOther, BOOL?
bMinimized)?{?CFrameWnd::OnActivate(nState, pWndOther, bMinimized);?if(nState == WA_INACTIVE)??FreeTaskBar();?else??HookTaskBar();}

Finally, here is the new task bar window proc.
// TaskWndProc//// ?Handles the WM_LBUTTONUP message//LRESULT TaskWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM?
lParam){?if(msg == WM_LBUTTONUP)?{??RECT rc;??POINT pt;
??rc.left ?= 240 - 26;??rc.top ?= 0;??rc.bottom = 26;??rc.right = 240;
??pt.x ?= LOWORD(lParam);??pt.y ?= HIWORD(lParam);
??if(::PtInRect(&rc, pt))??{?? ::PostMessage(g_hWndMain, WM_CLOSE, 0, 0);?? return ::CallWindowProc(?? ?g_fnProcTask,??? ?hWnd,??? ?WM_MOUSEMOVE,??? ?0,??? ?MAKELPARAM(200, 0));??}?}?return ::CallWindowProc(g_fnProcTask, hWnd, msg, wParam, lParam);}

Why the WM_MOUSEMOVE? It simulates the user dragging the stylus out?
of the button, and thereby restoring it to the normal state.
4、另外在win32中還有另外一種去掉 (OK) 和 [x] 的辦法:在對話框的風格上加 WS_NONAVDONEBUTTON 屬性#define WS_NONAVDONEBUTTON WS_MINIMIZEBOX注意這個 WS_MINIMIZEBOX 和 PC 上的意義不一樣
5、隱藏輸入法按鈕:在 SHCreateMenuBar 時使用 SHCMBF_HIDESIPBUTTON 標志,最好還要調(diào)用?
SipShowIM( SIPF_OFF );因為可能程序的調(diào)用者打開著輸入法(調(diào)用者打開著輸入法有時候會導致被調(diào)用者也
打開輸入法)

轉(zhuǎn)載于:https://www.cnblogs.com/IamEasy_Man/archive/2009/11/05/1596570.html

總結(jié)

以上是生活随笔為你收集整理的【转载】windows mobile 上隐藏和关闭X以及OK的处理的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。