看看我用Delphi写的仅有13KB的程序,呵呵~~下载地址:
http://www.goomoo.net/tmp/fallwin.exe注意:按 Esc 键退出。

解决方案 »

  1.   

    你第一次运行还未退出,先按esc退出,或重启一下计算机。
    本程序一次只能运行一个实例。
      

  2.   

    这儿还有一个40KB的,捉弄人的东东,大家玩的时候之前先看看解除方法,不然可不要怪我哦 ^…^▲▲▲解除方法:将鼠标光标移到屏幕左上角,然后按下组合键: Ctrl + Alt + Shift + Z 就可以解除了。■■■注意,运行之前先看看上面的解除方法,否则可别怪我未事先声明哦。■■■
    下载地址:
    http://www.goomoo.net/tmp/happy.exe源代码明天贴出来请各位前辈斧正.
      

  3.   

    这儿还有一个40KB的,捉弄人的东东,大家玩的时候之前先看看解除方法,不然可不要怪我哦 ^…^▲▲▲解除方法:将鼠标光标移到屏幕左上角,然后按下组合键: Ctrl + Alt + Shift + Z 就可以解除了。■■■注意,运行之前先看看上面的解除方法,否则可别怪我未事先声明哦。■■■
    下载地址:
    http://www.goomoo.net/tmp/happy.exe源代码明天贴出来请各位前辈斧正.怎么解不了?99
      

  4.   

    怎么可能解不了啊,光标一定先要放在屏幕的左上角,然后按下 Ctrl + Alt + Shift + Z,就解开了。注意四个键按住不放,最后一起放开。
      

  5.   

    hoho,对不起啦,第一个可以还原,第二个未设还原的功能。
      

  6.   

    没反应。另外,那个13KB用UPX搞过的。
      

  7.   

    昏~~~~用masm写个简单程序,最多不会超过4KB,一个空窗体的也只有1000多字节。还没有压缩过
      

  8.   

    你应该至少要依赖VCLXX.BPL吧.除非你自己全部用WIN API 或WIN SDK的东西.
      

  9.   

    是啊直接用win api代码就很小。13k?难道你是用汇编 + WinApi?
      

  10.   

    编译后2560字节的GUI程序的代码:.486
    .model flat, stdcall
    option casemap:noneincludelib \masm32\lib\kernel32.lib
    includelib \masm32\lib\user32.lib
    includelib \masm32\lib\gdi32.libinclude \masm32\include\windows.inc
    include \masm32\include\kernel32.inc
    include \masm32\include\user32.inc
    include \masm32\include\gdi32.inc
    WinMain PROTO STDCALL :DWORD, :DWORD, :DWORD, :DWORD
    WndProc PROTO STDCALL :DWORD, :DWORD, :DWORD, :DWORD
    .data?
    hInstance dd ?.data
    ClassName db "FirstWindowClass",0
    AppName db "FirstWindow",0.code
    start:invoke GetModuleHandle, NULL
    mov hInstance, eax
    invoke WinMain, hInstance, NULL, NULL, SW_SHOWNORMAL
    invoke ExitProcess, NULLWinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD
    LOCAL wc:WNDCLASSEX
    LOCAL hwnd:DWORD
    LOCAL msg:MSG
    mov wc.cbSize,SIZEOF WNDCLASSEX
    mov wc.style, CS_HREDRAW or CS_VREDRAW
    mov wc.lpfnWndProc, OFFSET WndProc
    mov wc.cbClsExtra,NULL
    mov wc.cbWndExtra,NULL
    push hInst
    pop wc.hInstance
    mov wc.hbrBackground,COLOR_WINDOW
    mov wc.lpszMenuName,NULL
    mov wc.lpszClassName,OFFSET ClassName
    invoke LoadIcon,NULL,IDI_APPLICATION
    mov wc.hIcon, eax
    mov wc.hIconSm, eax
    invoke LoadCursor,NULL,IDC_ARROW
    mov wc.hCursor,eax
    invoke RegisterClassEx, addr wcINVOKE CreateWindowEx,NULL,ADDR ClassName,ADDR AppName,\
    WS_OVERLAPPEDWINDOW-WS_SIZEBOX-WS_MAXIMIZEBOX,CW_USEDEFAULT,\
    CW_USEDEFAULT,400,300,NULL,NULL,\
    hInst,NULL
    mov hwnd,eax
    invoke ShowWindow, hwnd,SW_SHOWNORMAL
    invoke UpdateWindow, hwnd
    .WHILE TRUE
    invoke GetMessage, ADDR msg,NULL,0,0
    .BREAK .IF (!eax)
    invoke TranslateMessage, ADDR msg
    invoke DispatchMessage, ADDR msg
    .ENDW
    mov eax,msg.wParam
    ret
    WinMain endpWndProc proc hWnd:DWORD, uMsg:DWORD, wParam:DWORD, lParam:DWORD
    mov eax, uMsg
    .IF eax==WM_CREATE
    invoke MessageBox, NULL, ADDR AppName, ADDR AppName, NULL
    .ELSEIF eax==WM_DESTROY
    invoke PostQuitMessage, NULL
    .ELSE
    invoke DefWindowProc, hWnd, uMsg, wParam, lParam
    .ENDIF
    ret
    WndProc endp
    end start 
      

  11.   

    我用复制粘贴网上代码用Delphi做了一个小程序:
    http://hanlin.hbu.edu.cn/personal/slave/mysoft/ip.exe
    只有15.5K其实不用ASM也可以做得很少,用C就可以,大家试过LCC吗??用它写出来的windows程序和用win32ASM写出来的差不多.
      

  12.   

    用Delphi 写的肯定要比asm的大不少啦。那个13KB 的是用upx压缩过,未压缩的大小为20K.呆会儿贴出源代码。其实很简单,就是全部用 api 来写就可以达到很小的尺寸了。
      

  13.   

    //源代码program fallWin;uses
      windows, messages;{$R *.res}type
      TWindowInfo = record
        Handle: THandle;
        Caption: String;
        Rect: TRect;
        Speed: Byte;
      end;
    const
      gDebug = False;
    var
      windowsInfoList: array of TWindowInfo;
      gAtom: ATOM;
      winCount, aInt, gScreenHeight, gScreenWidth, gIndex: Integer;
      msg: tagMsg;
      threadIdList: array of DWORD;
      //speedFactor:UINT;procedure debugMsg(s: String);
    begin
      if gDebug then
        messageBox(0, PChar(s), 'Debug Message', 0);
    end;function enumWindowsProc(_hwnd: HWND; _lparam: LPARAM): BOOL; stdcall;
    var
      Caption: array[0..511] of Char;
      rect: TRect;
      _length: Integer;
    begin
      Result := True;  if _hwnd = HWND_DESKTOP then 
        exit;
      if not isWindowVisible(_hwnd) then 
        exit;  getWindowText(_hwnd, Caption, 512);
      if (String(Caption) = '') or (String(Caption) = 'Program Manager') then 
        exit;  //debugMsg(string(caption));  getWindowRect(_hwnd, rect);  if ((rect.Bottom - rect.Top) = gScreenHeight) then 
        exit;  if isIconic(_hwnd) then 
        exit;   //showWindow(_hwnd,SW_RESTORE);  setLength(windowsInfoList, length(windowsINfoList) + 1);
      _length := length(windowsInfoList) - 1;
      windowsInfoList[_length].Handle := _hwnd;
      windowsInfoList[_length].Rect := rect;
      windowsInfoList[_length].Caption := String(Caption);
      windowsInfoList[_length].Speed := random(127) + 1;
    end;procedure restoreWindows;
    var
      i: Integer;
      _hwnd: HWND;
      x, y: Integer;
    begin
      for i := 0 to winCount - 1 do
      begin
        _hwnd := windowsInfoList[i].Handle;
        x     := windowsInfoList[i].Rect.Left;
        y     := windowsInfoList[i].Rect.Top;
        setWindowPos(_hwnd, 0, x, y, 0, 0, SWP_NOZORDER or SWP_NOSIZE);
      end;
    end;procedure getWindowsInfo;
    begin
      enumWindows(@enumWindowsProc, 0);
    end;function threadProc(lpdData: LPDWORD): DWORD; stdcall;
    var
      x, y, sn: Integer;
      rect: TRect;
    begin
      inc(gIndex);
      sn := gIndex;
      //debugMsg(intToStr(gIndex));
      while (True) do
      begin
        getWindowRect(windowsInfoList[sn].Handle, rect);
        x := Rect.Left;
        y := Rect.Top;
        y := y + windowsInfoList[sn].Speed;    if y > gScreenheight then
        begin
          y := -gScreenHeight;
          x := random(gScreenWidth);
        end;    setWindowPos(windowsInfoList[sn].Handle, 0, x, y, 0, 0,
          SWP_NOSIZE or SWP_NOZORDER);    sleep(32);
      end;  Result := 1;
    end;
      //////////////////////////////////////////////////////////////////////////////
      //  start from here    ///////////////////////////////////////////////////////
      //////////////////////////////////////////////////////////////////////////////
    begin  gAtom := globalFindAtom('fallWindowsScreen');
      if gAtom <> 0 then    // program have a previous instance
      begin
        //globalDeleteAtom(gAtom);
        exit;
      end;  // get screen's height
      gScreenWidth := getSystemMetrics(SM_CXFULLSCREEN);
      gScreenHeight := getSystemMetrics(SM_CYFULLSCREEN);  //register hotkey
      gAtom := globalAddAtom('fallWindowsScreen');
      registerHotKey(0, gAtom, 0, VK_ESCAPE);     // press ESC to exit  getWindowsInfo;  winCount := length(windowsInfoList);
      //debugMsg(intToStr(winCount));  setLength(threadIdList, winCount);  for aInt := 0 to winCount - 1 do
      begin
        //create threads for every window
        createThread(nil, 0, @threadProc, nil, 0, threadIdList[aInt]);
        //setTimer(0,0,160,@timerProc);
      end;  // message loop
      while (getMessage(msg, 0, 0, 0)) do
      begin
        if msg.message = WM_HOTKEY then
        begin
          globalDeleteAtom(gAtom);
          restoreWindows;
          //MessageBox(0,'Please visit http://www.goomoo.net to get more goodies! ;-)','Information',0);
          exit;
        end
        else
        begin
          translateMessage(msg);
          dispatchMessage(msg);
        end;
      end;
    end.