一个我写的
unit ViewPassword_Unit;interfaceuses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ExtCtrls, StdCtrls, Buttons;type
  TForm1 = class(TForm)
    Label1: TLabel;
    Timer1: TTimer;
    BitBtn1: TBitBtn;
    procedure Timer1Timer(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;var
  Form1: TForm1;
  ct:boolean;implementation{$R *.DFM}procedure TForm1.Timer1Timer(Sender: TObject);
var
 p:tpoint;
 h:hwnd;
begin
  getcursorpos(p);
  label1.Caption:='X= '+inttostr(p.x)+'   Y= '+inttostr(p.y);
  h:=windowfrompoint(p);
  if iswindow(h) then
  begin
  sendmessage(h,em_setpasswordchar,0,0);
  invalidaterect(h,nil,false);
  end;
end;procedure TForm1.BitBtn1Click(Sender: TObject);
begin
  if ct then
    begin
      timer1.Enabled:=true;
      bitbtn1.Caption:='&Stop';
    end else
    begin
      timer1.Enabled:=false;
      bitbtn1.Caption:='&Start';
    end;
  ct:=not ct;
end;procedure TForm1.FormCreate(Sender: TObject);
begin
  timer1.Enabled:=false;
  label1.Caption:='';
  ct:=true;
end;{
function TfrmMain.GetPassword(Sender:TObject):string;
var
hWnd:THandle;
lpCurPos:TPoint;
lntLen:Longint;
pchPass:pchar;
begin
GetCursorPos(lpCurPos);//»ñÈ¡µ±Ç°Êó±êλÖÃ
hWnd:=WindowFromPoint(Sender);//»ñÈ¡µ±Ç°Êó±êλÖõĴ°¿Ú¾ä±ú
lntLen:=SendMessage(hWnd,WM_GETTEXTLENGTH,0,0);
//if GetWindowLong(hWnd,GWL_STYLE) and ES_PASSWORD <> 0 then //&Aring;&ETH;&para;&Iuml;&Ecirc;&Ccedil;·&ntilde;&Icirc;&ordf;&Atilde;&Uuml;&Acirc;&euml;&iquest;ò
begin
  GetMem(pchPass,lntLen+1);
  if lntLen > 0 then
  SendMessage(hWnd,WM_GETTEXT,lntLen+1,Integer(pchPass));//&raquo;&ntilde;&Egrave;&iexcl;&Atilde;&Uuml;&Acirc;&euml;&acute;&reg;
  Result:=String(pchPass);
  FreeMem(pchPass,lntLen+1);
end;
end;
}end.

解决方案 »

  1.   

    GetPassword(Sender:TObject)函数的用法我看不太明白,你能再注释清楚些吗?
    取得鼠标的句柄我知道怎么做,我有一个是静态的查*号的,请看看
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm1 = class(TForm)
        Label1: TLabel;
        Button1: TButton;
        Edit1: TEdit;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
    var
    name:pchar;
    L:integer;
    begin
       L:=getwindowtextlength(edit1.handle)+1;
       getmem(name,l);
       getwindowtext(edit1.Handle,name,l);
       label1.Caption:=string(name);
       freemem(name,0);
    end;end.但是我想要的是滑动试的,能离开控件的查看*号,再在edit框中显现的那种,请帮帮忙
      

  2.   

    通过改.ini文件是可以屏蔽掉,不过我是说的是开机启动的时候啊,改.ini文件恐怕不行吧?
      

  3.   

    屏蔽F4、F8
    //以下修改Msdos.sys
      SetFileAttributes(PChar(MsdosSysPathName),FILE_ATTRIBUTE_NORMAL);
      SysIni:=TIniFile.Create(MsdosSysPathName);
      SysIni.WriteInteger('Options','BootMulti',0);//不能进行多重引导
      SysIni.WriteInteger('Options','BootGUI',1);  //直接进入图形界面
      SysIni.WriteInteger('Options','BootKeys',0); //启动时按键失效
      SysIni.WriteInteger('Options','AutoScan',0); //启动失败也不进行磁盘扫描
      SysIni.Free;
      SetFileAttributes(PChar(MsdosSysPathName),FILE_ATTRIBUTE_HIDDEN+FILE_ATTRIBUTE_READONLY);********************
    密码查看,如果别人的Edit做了处理的话,以下就不行了~
    unit Show_MM_f;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, ExtCtrls, TFlatEditUnit;type
      TShow_MM = class(TForm)
        Timer1: TTimer;
        FlatEdit1: TFlatEdit;
        Label1: TLabel;
        procedure Label1MouseDown(Sender: TObject; Button: TMouseButton;
          Shift: TShiftState; X, Y: Integer);
        procedure Label1MouseUp(Sender: TObject; Button: TMouseButton;
          Shift: TShiftState; X, Y: Integer);
        procedure Label1MouseMove(Sender: TObject; Shift: TShiftState; X,
          Y: Integer);
        procedure Timer1Timer(Sender: TObject);
        procedure FormShow(Sender: TObject);
        procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
        procedure FormClose(Sender: TObject; var Action: TCloseAction);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Show_MM: TShow_MM;implementation
    var str:array[0..19] of char;
    {$R *.dfm}procedure TShow_MM.Label1MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    begin
      SetCapture(Handle);
    end;procedure TShow_MM.Label1MouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    begin
      ReleaseCapture;
    end;procedure TShow_MM.Label1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    var p1,p2:TPoint;
    begin
      p1.X :=x;
      p1.Y :=y;
      p2:=ClientToScreen(p1);
      FlatEdit1.Text :=IntToStr(p2.X);
    end;procedure TShow_MM.Timer1Timer(Sender: TObject);
    var p:TPoint;
      hd:HWND;
      l:integer;
    begin
      GetCursorPos(p);
      hd:=WindowFromPoint(p);
      l:=SendMessage(hd,WM_GETTEXTLENGTH,0,0);
      SendMessage(hd,WM_GETTEXT,l+1,integer(@str));
      FlatEdit1.Text :=str;
    end;procedure TShow_MM.FormShow(Sender: TObject);
    begin
      Timer1.Enabled:=True;
    end;procedure TShow_MM.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    begin
      Timer1.Enabled:=False;
    end;procedure TShow_MM.FormClose(Sender: TObject; var Action: TCloseAction);
    begin
      Timer1.Enabled:=False;
    end;end.
      

  4.   

    修改Msdos.sys是在控制台里做吗?
      

  5.   

    你用的是win2k啊?我不知道win2k里是否有msdos.sys~~它是个隐藏文件~~
      

  6.   

    我有这个文件,但是它好象一个DLL文件,在程序里动态调用这个文件再修改它吗?还有问一下:procedure TForm1.FormCreate(Sender: TObject);
    begin
      EnableMenuItem(GetSystemMenu(Handle, False), SC_maximize, MF_GRAYED);
    end;
    怎么最大化窗口不能变灰呢??
      

  7.   

    msdos.sys是个系统文件,格式与ini差不多的,可以用我上面的进行操作
    屏蔽F4、F8
    //以下修改Msdos.sys
      SetFileAttributes(PChar(MsdosSysPathName),FILE_ATTRIBUTE_NORMAL);
    //属性设为普通
      SysIni:=TIniFile.Create(MsdosSysPathName); 
    //msdos.sys的位置。可为Create('msdos.sys'); 
      SysIni.WriteInteger('Options','BootMulti',0);//不能进行多重引导
      SysIni.WriteInteger('Options','BootGUI',1);  //直接进入图形界面
      SysIni.WriteInteger('Options','BootKeys',0); //启动时按键失效
      SysIni.WriteInteger('Options','AutoScan',0); //启动失败也不进行磁盘扫描
      SysIni.Free;
      SetFileAttributes(PChar(MsdosSysPathName),FILE_ATTRIBUTE_HIDDEN+FILE_ATTRIBUTE_READONLY);
    //属性设为隐藏、只读另外,最大化窗口的问题,我没用过你说的,可以在form的属性里设置为窗口样式呀