|
发表于 2010-6-20 09:50:11
|
显示全部楼层
Entry Point u application PE GUI;
include "Windows.inc";
//entry main
//include "form.inc";
entry
WinMain();
end.?
FormMoudle ?
import srand lib "msvcrt.dll", 1;
import rand lib "msvcrt.dll", 0;
import StrToInt alias StrToIntA lib "shlwapi.dll", 1;
import lstrlen alias lstrlenA lib "kernel32.dll",1;
const AW_HOR_POSITIVE = $1;
const AW_HOR_NEGATIVE = $2;
const AW_VER_POSITIVE = $4;
const AW_VER_NEGATIVE = $8;
const AW_CENTER = $10;
const AW_HIDE = $10000;
const AW_ACTIVATE = $20000;
const AW_SLIDE = $40000;
const AW_BLEND = $80000;
const RAND_MAX = $7FFF;
const IDI_APPICON = 101;
MSG msg;
WNDCLASS wc;
RECT rect;
string strTitle[15];
string strTitleDemo[29];
string strName[14];
string strTime[5];
dword hWindow;
dword hDemoWindow;
dword hEditTime;
dword hBrushPrevious;
dword hBtnShow;
dword hBtnHide;
dword dwFlags;
dword dwTime;
dword dwColor;
dword FormLeft;
dword FormTop;
dword FormWidth;
dword FormHeight;
dword FormStyle;
frame StrToNum(dword ptrString);
return(StrToInt(ptrString));
end;
frame SetChildFonts(dword hControl, dword lParam);
SendMessage(hControl, WM_SETFONT, lParam, FALSE);
return(TRUE);
end;
frame CenterOnDesktop(dword hWindow);
local dword xPos; local dword yPos;
GetWindowRect(hWindow, @rect);
// Change this when order of operations is released.
xPos = (GetSystemMetrics(SM_CXSCREEN) - (rect.right - rect.left)) / 2;
yPos = (GetSystemMetrics(SM_CYSCREEN) - (rect.bottom - rect.top)) / 2;
SetWindowPos(hWindow, HWND_TOP, xPos, yPos, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
end;
frame main();
strName = "a2si Window";
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = @WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = 0;
wc.hIcon = LoadIcon(0, IDI_APPICON);
wc.hCursor = LoadCursor(0, IDC_ARROW);
wc.hbrBackground = 15 + 1;
wc.lpszMenuName = "";
wc.lpszClassName = @strName;
if (RegisterClass(@wc) = 0) {
MessageBox(0, "RegisterClass failed.", @strName, MB_OK);
ExitProcess(0);
}
hWindow = CreateWindowEx(0, @strName, @strTitle, FormStyle, FormLeft, FormTop, FormWidth, FormHeight, 0, 0, 0, 0);
if (hWindow = 0) {
MessageBox(0, "CreateWindowEx failed.", @strName, MB_OK);
UnregisterClass(@strName, 0);
ExitProcess(0);
}
ShowWindow(hWindow, SW_SHOWNORMAL);
UpdateWindow(hWindow);
// WS_OVERLAPPEDWINDOW doesn't work.
InitCommonControls();
srand(GetTickCount());
CreateControls();
EnumChildWindows(hWindow, @SetChildFonts, GetStockObject(ANSI_VAR_FONT));
CenterOnDesktop(hWindow);
while (GetMessage(@msg, 0, 0, 0) > 0) {
TranslateMessage(@msg);
DispatchMessage(@msg);
}
UnregisterClass(@strName, 0);
end;
? ModRun C
import StrToInt alias StrToIntA lib "shlwapi.dll",1;
import CreateThread lib "kernel32.dll",6;
import ExitThread lib "kernel32.dll",1;
import TerminateThread lib "kernel32.dll",2;
import Sleep lib "kernel32.dll",1;
import EnumWindows lib "user32.dll",2;
import SendMessage alias SendMessageA lib "user32.dll",4;
import GetWindowLong alias GetWindowLongA lib "user32.dll",2;
import ExitThread lib "kernel32.dll",0;
import SetWindowText alias SetWindowTextA lib "user32.dll",2;
dword TexthWnd;
boolean WorkThis;
dword ThreadId;
dword QQhWnd;
dword Sp;
string sBuffer[5];
frame EnumQQWindow(dword hWnd,dword lParam) as dword;
dword WinStyle;
WinStyle = GetWindowLong(hWnd, GWL_STYLE);
if (WinStyle = $96040044) {
QQhWnd = hWnd;
// Format(sBuffer,"QQ hWnd: %d",hWnd);
// MessageBox(0,sBuffer,strTitle,64);
}
return(1);
end;
frame QQStateChange() as dword;
while (1=1) {
SendMessage(QQhWnd, $111, $344C, 0);
SendMessage(QQhWnd, $111, $3429, 0);
if (WorkThis = FALSE) {
ExitThread(0);
//return(1);
}
Sleep(Sp);
}
return(1);
end;
frame InitQQ();
EnumWindows(@EnumQQWindow, 0);
end;
frame WinMain();
WorkThis=FALSE;
FormLeft=100;
FormTop=100;
FormWidth=150;
FormHeight=110;
FormStyle=WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU;
//FormStyle=WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX;
strTitle = "QQ2008快闪";
InitQQ();
main();
end;
frame CreateControls();
CreateWindowEx(0, "Static", "延时: ", SS_SIMPLE | WS_CHILD | WS_VISIBLE, 10, 10, 80, 20, hWindow, 121, 0, 0);
TexthWnd = CreateWindowEx(WS_EX_CLIENTEDGE ,"Edit", "0", ES_LEFT | ES_NUMBER | WS_CHILD | WS_VISIBLE, 60, 10, 50, 20, hWindow, 122, 0, 0);
hBtnShow = CreateWindowEx(0, "Button", "开始", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE, 10, 40, 100, 30, hWindow, 131, 0, 0);
end;
frame WndProc(dword hwnd, dword message, dword wparam, dword lparam);
dword ret;
if (message = WM_COMMAND) {
if (lparam = hBtnShow) {
ret=OnCommand();
return(ret);
}
return(1);
}
if (message = WM_DESTROY) {
ExitProcess(0);
}
return(DefWindowProc(hwnd, message, wparam, lparam));
end;
frame OnCommand() as dword;
if (QQhWnd = 0) {
MessageBox(0,"没有找到 QQ !",strTitle,64);
return(1);
}
if (WorkThis = FALSE) {
SetWindowText(hBtnShow,"停止");
GetWindowText(TexthWnd, @sBuffer, 5);
Sp=Str2Int(sBuffer);
ThreadId=CreateThread(0,0,@QQStateChange ,0,0,0);
}
if (WorkThis = TRUE) {
SetWindowText(hBtnShow,"开始");
//TerminateThread(ThreadId,0);
}
WorkThis=!WorkThis;
return(1);
end;
frame Str2Int(dword ptrString) as dword;
return(StrToInt(ptrString));
end;?
是C#? |
|