[已解决]能麻烦大家帮忙转一段C++程序为AU3的吗?
本帖最后由 yinui 于 2013-9-8 01:00 编辑#include <iostream>
#include <conio.h>
#include <Windows.h>
using namespace std;
int main(int, char **, char **)
{
RECT rtWorkArea;
SystemParametersInfo(SPI_GETWORKAREA, 0, &rtWorkArea, 0);
RECT rtWorkAreaTmp;
rtWorkAreaTmp.left = rtWorkArea.left + 20;
rtWorkAreaTmp.top = rtWorkArea.top + 20;
rtWorkAreaTmp.right = rtWorkArea.right - 20;
rtWorkAreaTmp.bottom = rtWorkArea.bottom - 20;
SystemParametersInfo(SPI_SETWORKAREA, 0, &rtWorkAreaTmp, 0);
cout << "Open notepad.exe and maximize the window, then press any key...";
getch();
SystemParametersInfo(SPI_SETWORKAREA, 0, &rtWorkArea, 0);
return 0;
} 或者帮忙看一下,SystemParametersInfo函数SPI_SETWORKAREA怎样用,实在不懂API,谢谢 #Include <Misc.au3>
#include <WinApi.au3>
Local Const $SPI_GETWORKAREA = 0x0030
Local Const $SPI_SETWORKAREA = 0x002F
Local $stRect = DllStructCreate($tagRect);旧的矩形范围
Local $stRectNew = DllStructCreate($tagRect);新的矩形范围
Local $iResult = _WinAPI_SystemParametersInfo($SPI_GETWORKAREA, 0, DllStructGetPtr($stRect), 0)
;~ If $iResult Then
;~ MsgBox(0, "Desktop Working Area", "Left = " & _
;~ DllStructGetData($stRect, "left") & @CRLF & "Top = " & _
;~ DllStructGetData($stRect, "top") & @CRLF & "Right = " & _
;~ DllStructGetData($stRect, "right") & @CRLF & "Bottom = " & _
;~ DllStructGetData($stRect, "bottom"))
;~ Else
;~ MsgBox(0, "Desktop Working Area", "Faild to get Desktop work area")
;~ EndIf
;上下左右减小20像素
DllStructSetData($stRectNew, "left", DllStructGetData($stRect, "left") + 20)
DllStructSetData($stRectNew, "top", DllStructGetData($stRect, "top") + 20)
DllStructSetData($stRectNew, "right", DllStructGetData($stRect, "right") - 20)
DllStructSetData($stRectNew, "bottom", DllStructGetData($stRect, "bottom") - 20)
_WinAPI_SystemParametersInfo($SPI_SETWORKAREA, 0, DllStructGetPtr($stRectNew), 0)
TrayTip("说明","现在你可以打开一个窗口(比如记事本)然后最大化,看看最大化的效果!,按空格键退出!", 5)
Do
Sleep(10)
Until _IsPressed(20);等待按空格键,等待任意键不会写
_WinAPI_SystemParametersInfo($SPI_SETWORKAREA, 0, DllStructGetPtr($stRect), 0) 回复 3# seniors
谢谢,学到了新的东西,但能麻烦你再帮忙一下吗?这个对已经最大化的不立即生效,要再次最大化窗口才起作用,能直接刷新,或别的方法使他立即生效吗??
页:
[1]