全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:2099
推到 Plurk!
推到 Facebook!

請問有人寫過控制應用程式的程式嗎

缺席
oujing
一般會員


發表:6
回覆:1
積分:1
註冊:2007-10-12

發送簡訊給我
#1 引用回覆 回覆 發表時間:2007-10-12 22:03:46 IP:218.168.xxx.xxx 訂閱
我想請問假設我開啟一個小算盤,能不能夠把裡頭的功能利用我寫的寫程式
把它 disable,不過我希望的 disable 是達到讓那個功能顏色變成灰階的的效果。
本來我是利用中間蓋一層透明的 Form 來做控制,不過結果不是很好。
打擾各位了,感謝各位不吝指教 ^____^
shunchia63
高階會員


發表:26
回覆:141
積分:198
註冊:2007-05-22

發送簡訊給我
#2 引用回覆 回覆 發表時間:2007-10-12 22:27:04 IP:61.64.xxx.xxx 訂閱
The EnableWindow function enables or disables mouse and keyboard input to the specified window or control. When input is disabled, the window does not receive input such as mouse clicks and key presses. When input is enabled, the window receives all input.
BOOL EnableWindow(
HWND hWnd, // handle to window
BOOL bEnable // flag for enabling or disabling input
);

Parameters
hWnd
Identifies the window to be enabled or disabled.
bEnable
Specifies whether to enable or disable the window. If this parameter is TRUE, the window is enabled. If the parameter is FALSE, the window is disabled.

Return Values
If the window was previously disabled, the return value is nonzero.
If the window was not previously disabled, the return value is zero. To get extended error information, call GetLastError.
Remarks
If the enabled state of a window is changing, a WM_ENABLE message is sent before the EnableWindow function returns. If a window is already disabled, all its child windows are implicitly disabled, although they are not sent a WM_ENABLE message.
A window must be enabled before it can be activated. For example, if an application is displaying a modeless dialog box and has disabled its main window, the application must enable the main window before destroying the dialog box. Otherwise, another window will receive the keyboard focus and be activated. If a child window is disabled, it is ignored when Windows tries to determine which window should receive mouse messages.
By default, a window is enabled when it is created. To create a window that is initially disabled, an application can specify the WS_DISABLED style in the CreateWindow or CreateWindowEx function. After a window has been created, an application can use EnableWindow to enable or disable the window.
An application can use this function to enable or disable a control in a dialog box. A disabled control cannot receive the keyboard focus, nor can a user gain access to it.

oujing
一般會員


發表:6
回覆:1
積分:1
註冊:2007-10-12

發送簡訊給我
#3 引用回覆 回覆 發表時間:2007-10-13 00:00:54 IP:218.168.xxx.xxx 訂閱
我看函式的解釋,他是把諸如滑鼠鍵盤對於某個特定的視窗,把這些事件 disable,不過我又再去
看看我原來PO的內容,是我描述不好(我其實只是想把某些我期望的功能給disable ),例如我開了
一個踩地雷好了,然後我的程式可以把踩地雷的假設 "遊戲->新遊戲" 這個功能給 disable (如果可以
把這個 menuitem 給灰階掉那效果更好),謝謝你的回覆!!
編輯記錄
oujing 重新編輯於 2007-10-13 00:03:02, 註解 無‧
JustinShen
中階會員


發表:22
回覆:104
積分:80
註冊:2003-09-20

發送簡訊給我
#4 引用回覆 回覆 發表時間:2007-10-16 10:25:29 IP:222.188.xxx.xxx 訂閱
shunchia63 的方法可以Enable和Disable一些窗口类控件(不能控制菜单项),但如果不做轮巡可能不能保证一直有效,因为原程序自己可能会去改变窗口的状态。补充办法就是Hook掉原程序的消息处理函数,这样就可以知道那些消息去使用控件了,不过不一定能令控件灰掉。
------
====================
我为一切作努力!
Justin Shen

系統時間:2024-03-29 8:43:28
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!