高分请教如何实现旋转当前窗口及桌面任意角度?

hjkto 2010-08-20 06:31:08
请教如何实现旋转当前所有窗口及桌面任意角度?
如把桌面旋转到180度或95度,并且桌面上的图标,可以正常使用?
如把当前所有的窗口旋转到180度或95度,并且可以正常操作?
...全文
1677 33 打赏 收藏 转发到动态 举报
写回复
用AI写文章
33 条回复
切换为时间正序
请发表友善的回复…
发表回复
hjkto 2010-08-29
  • 打赏
  • 举报
回复
又没下文了,结帖!!
L3nnon 2010-08-27
  • 打赏
  • 举报
回复
学习啦!!
谢谢。。
dd_zhouqian 2010-08-26
  • 打赏
  • 举报
回复
mark,学习
hjkto 2010-08-26
  • 打赏
  • 举报
回复
我弄了一晚上,还是不行,真搞不定啊!!!!
kye_jufei 2010-08-26
  • 打赏
  • 举报
回复
其實使用ChangeDisplaySettingsEx函數是可以搞定的,只是需要多多研究而已。。。那麼試著用API的方法將statubutton的(任務欄旋轉180後的位置改變,先hide原的,先出現在新的位置)。。。當然只是一個拋磚引玉的小動作。。。
ShowWindow(FindWindowEx(FindWindow('Shell_TrayWnd', nil), 0, 'Button', nil), SW_HIDE); 
Windows.SetParent(FindWindowEx(FindWindow('Shell_TrayWnd', nil), 0, 'Button', nil), GetDesktopWindow);
kye_jufei 2010-08-26
  • 打赏
  • 举报
回复
我昨天抽了幾分鐘時間寫了一段將我們任務欄搞得是亂亂的,弄死我了。。。基本的思路是有了,現在手頭有很多項目,你自己也動手研究一下。。。。。。
hjkto 2010-08-25
  • 打赏
  • 举报
回复
我的意思是只旋转任务栏180度就行,不旋转桌面了
代码能否实现?
hjkto 2010-08-25
  • 打赏
  • 举报
回复
[Quote=引用 26 楼 kye_jufei 的回复:]
...
任务栏的窗口类名是:ShellTrayWnd。
开始按钮的窗口类名是:Button。
应用程序切换区的窗口类名是:ReBarWindow32。
任务栏通知区的窗口类名是:TrayNotifyWnd。
任务栏时钟的窗口类名是:TrayClockWClass。
(2)调用FindWindow函数得到任务栏的窗口句柄。
(3)调用FindWind……
[/Quote]
以否给出旋转任务栏180度的代码,我再给你加200分
kye_jufei 2010-08-25
  • 打赏
  • 举报
回复
...
任务栏的窗口类名是:ShellTrayWnd。
开始按钮的窗口类名是:Button。
应用程序切换区的窗口类名是:ReBarWindow32。
任务栏通知区的窗口类名是:TrayNotifyWnd。
任务栏时钟的窗口类名是:TrayClockWClass。
(2)调用FindWindow函数得到任务栏的窗口句柄。
(3)调用FindWindowEx函数得到任务栏各子区域的窗口句柄。
(4)根据窗口句柄,调用ShowWindow函数控制任务栏各区域显示或隐藏

...
gyk120 2010-08-24
  • 打赏
  • 举报
回复
如果硬件不支持,旋转180和旋转360不都是一个概念么……
hjkto 2010-08-24
  • 打赏
  • 举报
回复
郁闷,我和三位网友都无法旋转
降低难度
只要求旋转任务栏180度,即任务栏上的全部图标,像开始,都倒个儿?
10楼及各位高手能实现吗?我再开一个帖,200分?
lylin1010 2010-08-24
  • 打赏
  • 举报
回复
学习学习
kye_jufei 2010-08-24
  • 打赏
  • 举报
回复
[Quote=引用 18 楼 hjkto 的回复:]
我是直接复制你的代码,你发代码前测试了吗?
哪个网址打开后,里面根本没有什么文章?
[/Quote]
我用BETA部的高端電腦測試沒有問題。。。你一定要確認以下事項:

确认硬件或地层驱动支持吗?可通过该函数查询的。我也用过,发现不支持。不过不少lcd屏可通过跳线方法,实现屏幕翻转.....


.............
旋转屏幕90度ChangeDisplaySettingsEx实例——WinCE2010年03月14日 星期日 20:07 DEVMODE DevMode;
memset(&DevMode, 0, sizeof (DevMode));
DevMode.dmSize = sizeof (DevMode);
DevMode.dmFields = DM_DISPLAYORIENTATION;

if (DISP_CHANGE_SUCCESSFUL != ChangeDisplaySettingsEx(NULL, &DevMode, NULL, CDS_TEST, NULL))
{
RETAILMSG(1, (L"ChangeDisplaySettingsEx failed to get the supported rotation angles (error=%d).\n", GetLastError()));
}
else
{
if(DevMode.dmDisplayOrientation == 0)
{
DevMode.dmDisplayOrientation
.........
kye_jufei 2010-08-24
  • 打赏
  • 举报
回复
function ChangeDisplaySettingsEx(lpszDeviceName: PChar; var lpDevMode: TDeviceMode;        wnd: HWND; dwFlags: DWORD; lParam: Pointer): Longint; stdcall;In MSDN, the documentation for ChangeDisplaySettingsEx has the following comment for lpDevMode: "If lpDevMode is NULL, all the values currently in the registry will be used for the display setting."My objective is to change the Primary monitor on a system with two active monitors, without changing anything else - resolution, bit depth, etc, should all remain the same. It seems like passing lpDevMode as null (nil) is the method that is provided to accomplish this.However, lpDevMode is defined as a packed record type (TDeviceMode), not a pointer type, in Delphi's Windows.pas. Apparently, the Delphi interface to the Windows API performs the translation to the pointers used by Windows API 'behind the scenes'.I tried calling it like this:var   alldevs : array[0..maxdev] of TDisplayDevice;   lpDevMode : pointer;begin   lpDevMode := nil;   lparam := nil;   my_hwnd := nil;  {... snip....}  with alldevs[NewPri] do      ChangeDisplaySettingsEx(devicename,TDeviceMode(lpDevMode),my_hwnd,CDS_SET_PRIMARY,lparam);

You could tryChangeDisplaySettingsEx(devicename, PDeviceMode(0)^, my_hwnd, CDS_SET_PRIMARY, lparam);
it does at least compile on Delphi 2009. I can't test it though.
Edit:
According to the scarce information on the net (this is the most detailed I could find) changing the primary display isn't a simple process, so you may be missing a step along the way. I have two monitors, but can't change the primary device at all, not even with the control panel - looks like the dual-head display card driver doesn't allow it. The following therefore isn't tested, but maybe it will help you:
In order to set a new primary display you have to move the current primary display away from the (0, 0) position first. This is more tricky than it needs to be, because the Delphi Windows.pas file has an incomplete TDeviceMode type. It is given as
_devicemodeA = record dmDeviceName: array[0..CCHDEVICENAME - 1] of AnsiChar; ... dmOrientation: SHORT; dmPaperSize: SHORT; dmPaperLength: SHORT; dmPaperWidth: SHORT; dmScale: SHORT; dmCopies: SHORT; dmDefaultSource: SHORT; dmPrintQuality: SHORT; dmColor: SHORT; ...end;
when it should instead be
_devicemodeA = record dmDeviceName: array[0..CCHDEVICENAME - 1] of AnsiChar; ... case boolean of FALSE: ( dmOrientation: SHORT; dmPaperSize: SHORT; dmPaperLength: SHORT; dmPaperWidth: SHORT; dmScale: SHORT; dmCopies: SHORT; dmDefaultSource: SHORT; dmPrintQuality: SHORT; ); TRUE: ( dmPosition: TPoint; dmDisplayOrientation: DWORD; dmDisplayFixedOutput: DWORD; ); dmColor: SHORT; ...end;
You should add the fixed record type to your sources, as you need dmPosition to adjust the origin of the displays. It should go something like this:
// get current display settingsEnumDisplaySettings(PChar(AOldPrimaryDevice), ENUM_REGISTRY_SETTINGS, DevMode1);EnumDisplaySettings(PChar(ANewPrimaryDevice), ENUM_REGISTRY_SETTINGS, DevMode2);// move old primary display to new positionDevMode1.dmFields := DM_POSITION;DevMode1.dmPosition.x := DevMode2.dmPelsWidth;DevMode1.dmPosition.y := 0;Win32Check(ChangeDisplaySettingsEx(PChar(AOldPrimaryDevice), DevMode1, 0, CDS_UPDATEREGISTRY or CDS_NORESET, nil)):// move old secondary display to (0, 0) and make the primary displayDevMode2.dmFields := DM_POSITION;DevMode2.dmPosition.x := 0;DevMode2.dmPosition.y := 0;Win32Check(ChangeDisplaySettingsEx(PChar(ANewPrimaryDevice), DevMode2, 0, CDS_SET_PRIMARY or CDS_UPDATEREGISTRY or CDS_NORESET or DM_DISPLAYFLAGS, nil)):// magic ???Win32Check(ChangeDisplaySettingsEx(nil, PDeviceMode(0)^, 0, 0, nil));
kye_jufei 2010-08-24
  • 打赏
  • 举报
回复
http://www.cnblogs.com/sea918/archive/2010/03/22/1691763.html
以上介紹的是screen rotation的例子...
hjkto 2010-08-23
  • 打赏
  • 举报
回复
我是直接复制你的代码,你发代码前测试了吗?
哪个网址打开后,里面根本没有什么文章?
lyhoo163 2010-08-23
  • 打赏
  • 举报
回复
帮顶。。
kye_jufei 2010-08-22
  • 打赏
  • 举报
回复
[Quote=引用 13 楼 hjkto 的回复:]
10楼的代码,我测试了
90度和180度旋转,没有反映?
[/Quote]
補充:你認真檢查一下代碼。。。
kye_jufei 2010-08-22
  • 打赏
  • 举报
回复
[Quote=引用 14 楼 hjkto 的回复:]
引用 11 楼 kye_jufei 的回复:
http://www.cnblogs.com/sea918/archive/2010/03/22/1691763.html方法二:使用ChangeDisplaySettingsEx,可以參考這篇貼子:


这个网址里没有内容啊?
[/Quote]
LS的哥:這個網址裡是介紹SCREEN ROTATION的ChangeDisplaySettingsEx函數的中文實例。。。
iqyely 2010-08-22
  • 打赏
  • 举报
回复
来学习下
加载更多回复(11)

1,183

社区成员

发帖
与我相关
我的任务
社区描述
Delphi Windows SDK/API
社区管理员
  • Windows SDK/API社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧