d;
//定义几个窗口创建函数
function CreateButton(name:pchar;x1,y1,x2,y2:integer):hwnd;begin Result:=CreateWindow(''Button'',name,WS_VISIBLE or WS_CHILD or BS_PUSHLIKE or BS_TEXT,x1,y1,x2,y2,Handle,0,hInst,nil);end;
function CreateEdit(name:pchar;x1,y1,x2,y2:integer):hwnd;begin Result:=CreateWindowEx(WS_EX_CLIENTEDGE,''Edit'',name,WS_VISIBLE or WS_CHILD or ES_LEFT or ES_AUTOHSCROLL,x1,y1,x2,y2,Handle,0,hInst,nil);end;
function CreateLabel(name:pchar;x1,y1,x2,y2:integer):hwnd;begin Result:=CreateWindow(''Static'',name,WS_VISIBLE or WS_CHILD or SS_LEFT,x1,y1,x2,y2,Handle,0,hInst,nil);end;
function CreateMain(name:pchar;x1,y1,x2,y2:integer):hwnd;
begin
//取得应用
程序实例句柄
hInst:=GetModuleHandle(nil);
//初使化窗口类的信息
with wClass do
begin
Style:= CS_PARENTDC;
hIcon:= LoadIcon(hInst,''MAINICON'');
lpfnWndProc:= @WindowProc;
hInstance:= hInst;
hbrBackground:= COLOR_BTNFACE+1;
lpszClassName:= ''MainClass'';
hCursor:= LoadCursor(0,IDC_ARROW);
end;
// 注册窗口类
RegisterClass(wClass);
// 建立主窗口
Result:=CreateWindow(wClass.lpszClassName,name,WS_OVERLAPPEDWINDOW or WS_VISIBLE,x1,y1,x2,y2,0,0,hInst,nil);
end;
function EnumChildProc(hwnd:integer;uint:integer):bool;
var classname,c2:array[0..100] of char;
hp:integer;
begin
if hwnd<>0 then
begin
hp:=hwnd;
//hp:=getparent(hwnd);
// hp:=getparent(hp);
// hp:=getparent(hp);
// hp:=getparent(hp);
writeCaption(hlabelemail,pchar(format(''%x'',[hp])));
end;
// GetClassName(hwnd,classname,100);
// GetClassName(hp,c2,100);
// if (strcomp(classname,pchar(''RICHEDIT''))=0) and (strcomp(c2,pchar(''AfxFrameOrView42s''))=0) then richedit:=hwnd;
result:=true;
end;
//---------主过程,类似于 C语言 中的 WinMain()
begin
//建立主窗口
handle:=CreateMain(exename,0,0,384,140);
//建立四个控制按钮
hButtonStart:=CreateButton(''开始刷屏'',300,4+26*0,70,24);
hButtonStop:=CreateButton(''停止刷屏'' ,300,4+26*1,70,24);
hButtonHelp:=CreateButton(''帮 助'' ,300,4+26*2,70,24);
hButtonExit:=CreateButton(''退 出'' ,300,4+26*3,70,24);
//建立两个编辑框
hEditEmail:=CreateEdit(''我是刷屏机器人1.0'',4,26,286,80);
//建立三个标签
hLabelEmail:=CreateLabel(''刷屏信息:'',4,8,286,16);
//创建字体对象
hFont:=CreateFont(-12,0,0,0,0,0,0,0,GB2312_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH or FF_DONTCARE,''宋体'');
//改变字体
SendMessage(hButtonStart,WM_SETFONT,hFont,0);
SendMessage(hButtonStop,WM_SETFONT,hFont,0);
SendMessage(hButtonHelp,WM_SETFONT,hFont,0);
SendMessage(hButtonExit,WM_SETFONT,hFont,0);
SendMessage(hEditEmail,WM_SETFONT,hFont,0);
SendMessage(hLabelEmail,WM_SETFONT,hFont,0);
//
// qqmainw:=FindWindow(''AfxFrameOrView42s'',nil);
// if qqmainw<>0 then messagebox(0,'''','''',0);
// tempwnd:=FindWindowEx(qqmainw,0,''AfxMDIFrame42s'',nil);
lp: