Program chat2001; uss windows, messages, sysutils; {$ r * .res} const crlf = # 13 # 10; exename: pchar = 'brush screen robot 2001'; VAR / / ----------- ----------- wclass: twndclass; // window variable MSG: TMSG; // message variable hinst, // program instance handle, // main window handle HFONT, // font handle // --------------- HButtonStart, // Start button hButtonStop, // Stop button hButtonhelp, // Help button HButtoneXIT, // Exit button HLABELEMAIL, / MAIL Edit HLABELEMAIL, / / e-mail Tips Mcount, TempWnd, QQmainw, Richedit: Integer; LP: Longint; NewTime: Integer; // ------------------ // Tour one window Write the title Procedure Writecaption (hwnd: hwnd; text: pchar); begin sendMessage (hwnd, wm_settext, 0, integer (text)); end; // From a window read title Procedure Readcaption (hwnd: hwnd; text: pchar); Begin SendMessage (HWND, WM_GETTEXT, 400, Integer (Text)); End; Procedure ButtonHelp; var S1: String; Begin S1: = 'This software is only learning, unaracted,' CRLF 'program to QQ2000B input box Enter text and send it! ' CRLF ' Details, and source code on ' CRLF ' Home: Hotsky.363.net ' CRLF; MessageBox (Handle, Pchar (S1),' Help ', 0); END; / / Main program end procedure shutdown; begin // Delete font object deleteObject (hfont); // Cancel the registration of window classes UnregisterClass (wclass.lpszclassname, hinst); // End the main process EXITPROCESS (HINST); END; procedure Ontimer; var LEN: INTEGER; STR: Array [0..500] of char; begin inc (McOUNT); // stropy (str, pchar (format ('I am% D brush machine ... ", [ McOUNT]))); readcaption (Heditemail, Str); IF (Mcount Mod 2) <> 0 THEN BEGIN: = Strlen (STR); STR [LEN]: = '; STR [LEN 1]: = # 0; End; QQMainw: = FindWindow ('AFXFrameorView42s', NIL); QQMainw: = FindWindowEx (QQMAINW, 0, 'AFXMDIFRAME42S', NIL); QQMAINW: =
FindWindowEx (qqmainw, 0, 'AfxFrameOrView42s', nil); qqmainw: = GetNextWindow (qqmainw, GW_HWNDNEXT); qqmainw: = FindWindowEx (qqmainw, 0,' # 32770 ', nil); richedit: = FindWindowEx (qqmainw, 0,' RICHEDIT ', nil); SendMessage (richedit, EM_SETSEL, 0, -1); SendMessage (richedit, EM_REPLACESEL, 1, integer (@str)); PostMessage (richedit, WM_KEYDOWN, VK_RETURN, $ 001c0001); PostMessage (richedit, WM_KEYUP , VK_RETURN, $ C01C0001); END; // This is the message processing function of the main window Function WINDOWPROC (HWND, MSG, WPARAM, LPARAM: Integer): Longint; stdcall; begin Result: = DefWindowProc (hwnd, msg, wparam, lparam Case MSG of WM_COMMAND: Begin if lparam = hButtonStart the beginning: = 0; newtime: = setTimer (handle, 100, 3000, nil); end; if lparam = hbuttonstop dam mcount: = 0; KillTimer (Handle, newtime); end; if lParam = hButtonHelp then ButtonHelp; if lParam = hButtonExit then ShutDown; end; WM_TIMER: ontimer; WM_DESTROY: ShutDown; end; end; // Create a window function defines several 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 creteedit (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_lev, x1, y1, x2, y2, handle, 0, hinst, nil); end; function cretemain (name: PCHAR; X1, Y1, X2, Y2: Integer: hWnd; Begin // acquire application instance handle Hinst: = getModuleHandle (nil); // Etennad window information 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; / / register window class RegisterClass (wClass); // creates a main window Result: = CreateWindow (wClass.lpszClassName, name, WS_OVERLAPPEDWINDOW or WS_VISIBLE, x1, y1, x2, y2,0,0, hInst, nil); end; function EnumChildProc (hwnd: integer; uint; 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; // --------- Main process, similar to WinMain () Begin / / Establish the main window Handle: = Createmain (Exename, 0, 0, 384, 140); // Establish four control buttons hbuttonsta RT: = CreateButton ('start brush screen', 300, 4 26 * 0, 70, 24); hButtonStop: = CreateButton ('Stop Brush ", 300, 4 26 * 1, 70, 24); HButtonHelp: = CreateButton ('Help ", 300, 4 26 * 2, 70, 24); HButtoneXit: = CreateButton (' Detailed ', 300, 4 26 * 3, 70, 24); // Establish two editing Box Heditemail: = CreateEdit ('I am a brush-screen robot 1.0', 4, 26, 286, 80); // Establish three labels hlabelemail: = CreateLabel ('Brush Screen Information:', 4, 8, 286, 16); // Created Font objects HFONT: = CreateFont (-12, 0, 0, 0, 0, 0, 0, GB2312_Charset, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, Default_Quality, Default_pitch or FF_DONTCARE, 'Song Body');