如何用代码直接打开桌面“显示 属性”中“设置”选项卡的“高级”属性对话框?

HollyBeing 2008-04-09 01:23:37
如题,已知用
Shell "C:\windows\system32\control.exe desk.cpl", vbNormalFocus

Shell "rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,3"
可以打开“显示 属性”对话框,但我想跳过这一步直接用代码打开其中由“设置-->高级”弹出的“(xx监视器)和NVIDIA FeForce xxxx 属性”对话框,请问能否实现?最好别用sendkeys之类,api之类可以。
...全文
576 点赞 收藏 11
写回复
11 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
UltraBejing 2008-04-30
不会,帮顶
回复
meiZiNick 2008-04-30
不会,帮顶
回复
guyehanxinlei 2008-04-11
UP
回复
[Quote=引用 6 楼 Chen8013 的回复:]
引用 3 楼 myjian 的回复:

...........

这个对话框的资源我没有在desk.cpl里面找到...

在没有找到"直接打开"的办法前,我也支持1楼老魏的做法~~



老马,你想找的东东在 Systm32\themeui.dll 中,资源 ID 为 1007 的 Dialog
它没有在 desk.cpl 中。

我想看一下你如何对它开刀 ^_^
[/Quote]

这个只是对话框的模板,Windows调用的时候要做很多处理,所以对我们来说用途不大。
另外附送vb调用该对话框资源的源码:

Option Explicit

Private Declare Function LoadLibrary Lib "kernel32.dll" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
Public Declare Function FreeLibrary Lib "kernel32.dll" (ByVal hLibModule As Long) As Long
Public Declare Function CreateDialogParam Lib "user32.dll" Alias "CreateDialogParamA" (ByVal hInstance As Long, ByVal lpName As Long, ByVal hWndParent As Long, ByVal lpDialogFunc As Long, ByVal lParamInit As Long) As Long

Public Const SW_SHOW As Long = 5
Public Declare Function ShowWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long

Public Const WM_SYSCOMMAND As Long = &H112
Public Const SC_CLOSE As Long = &HF060&
Public Declare Function EndDialog Lib "user32.dll" (ByVal hDlg As Long, ByVal nResult As Long) As Long

Public Declare Function GetMessage Lib "user32.dll" Alias "GetMessageA" (ByRef lpMsg As MSG, ByVal hwnd As Long, ByVal wMsgFilterMin As Long, ByVal wMsgFilterMax As Long) As Long
Public Declare Function TranslateMessage Lib "user32.dll" (ByRef lpMsg As MSG) As Long
Public Declare Function DispatchMessage Lib "user32.dll" Alias "DispatchMessageA" (ByRef lpMsg As MSG) As Long
Public Declare Sub PostQuitMessage Lib "user32.dll" (ByVal nExitCode As Long)
Public Type POINTAPI
x As Long
y As Long
End Type

Public Type MSG
hwnd As Long
message As Long
wParam As Long
lParam As Long
time As Long
pt As POINTAPI
End Type

Public Function DialogProc(ByVal hwndDlg&, ByVal uMsg&, ByVal wParam&, ByVal lParam&) As Long
If uMsg = WM_SYSCOMMAND Then
If wParam = SC_CLOSE Then
Call EndDialog(hwndDlg, 0)
PostQuitMessage 0
DialogProc = 0
End If
End If
End Function

Public Sub Main()
Dim hDlg&
Dim tMsg As MSG
Dim hIns&

hIns = LoadLibrary("themeui.dll")
hDlg = CreateDialogParam(hIns, 1008, 0, AddressOf DialogProc, 0)
FreeLibrary hIns

ShowWindow hDlg, SW_SHOW

While GetMessage(tMsg, 0, 0, 0)
Call TranslateMessage(tMsg)
Call DispatchMessage(tMsg)
Wend
End Sub
回复
舉杯邀明月 2008-04-11
看来这个问题不好搞定呀。
回复
东方之珠 2008-04-10
支持
回复
资料没找到,反汇编无果(菜菜)。
不得已的方法:FindWindow + SendMessage
回复
舉杯邀明月 2008-04-10
[Quote=引用 3 楼 myjian 的回复:]

...........

这个对话框的资源我没有在desk.cpl里面找到...

在没有找到"直接打开"的办法前,我也支持1楼老魏的做法~~

[/Quote]

老马,你想找的东东在 Systm32\themeui.dll 中,资源 ID 为 1007 的 Dialog
它没有在 desk.cpl 中。

我想看一下你如何对它开刀 ^_^
回复
舉杯邀明月 2008-04-10
先做个记号,关注一下。
回复
我想反汇编跟踪一下那个按钮调用的api,结果连事件过程入口都没找到,地址直接为FFFFxxxx。
回复
[Quote=引用楼主 HollyBeing 的帖子:]
如题,已知用
Shell "C:\windows\system32\control.exe desk.cpl", vbNormalFocus

Shell "rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,3"
可以打开“显示 属性”对话框,但我想跳过这一步直接用代码打开其中由“设置-->高级”弹出的“(xx监视器)和NVIDIA FeForce xxxx 属性”对话框,请问能否实现?最好别用sendkeys之类,api之类可以。
[/Quote]

要直接打开的话,就不清楚了.

这个对话框的资源我没有在desk.cpl里面找到...

在没有找到"直接打开"的办法前,我也支持1楼老魏的做法~~
回复
相关推荐
发帖
VB基础类
创建于2007-09-28

7489

社区成员

VB 基础类
申请成为版主
帖子事件
创建了帖子
2008-04-09 01:23
社区公告
暂无公告