var
  InputString: string;
begin
  InputString:= InputBox('Input Box', 'Prompt', '');
  if inputstring <> '' then
  begin
  //do your things
  end;
end;

解决方案 »

  1.   

    Use the InputBox function when there is a default value that should be used when the user chooses the Cancel button (or presses Esc) to exit the dialog. If the application needs to know whether the user chooses OK or Cancel, use the InputQuery function instead.
    -----
    delphi的文档说你这种情况用InputQuery。
      

  2.   

    procedure TForm1.Button1Click(Sender: TObject);
    var T:TINIfile;
    begin
       T.Create('c:\test.ini');
       if InputBox('Input Box', 'Prompt', '1') <>'1' then
       T.WriteString('Section','Key','string maybe get from inputbox');
    end;
      

  3.   

    好像实现楼主的功能不了。
    inputbox是一个调试函数,在帮助中也就:
    function InputBox(const ACaption, APrompt, ADefault: string): string;
    begin
      Result := ADefault;
      InputQuery(ACaption, APrompt, Result);
    end;
    根本没有判断返回的是yes还是no!
    要不你自己做个dialog模块!/*************************************/
    /*1、MY TOOL:*************************/
    /*2、Delphi,Oracle,Sybase,C++/C*******/
    /*3、PROJECT:*************************/
    /*3、Boss*****************************/
    /*4、为了五星的目标希望你早点结贴*****/
    /*************************************/
      

  4.   

    to netlib(河外孤星)
    mabey he must be uses default value
      

  5.   

    你用的是d5还是d6,
    我在d6下刚调试,可以的呀,没有问题。如果d5不行的话,这样吧,你把最后一个参数设为' '
    一个空格,如果用户按cancel,会反回这个空格
    你在判断它是不是空格就行了。
      

  6.   

    var str: String;  if InputQuery('Caption','ss',Str) then
      begin
        ............................
      end;
      

  7.   

    inputadd:=Inputbox('增加字典对话框', '请输入字典名:','' );
      if inputadd<>'' then
      begin
      

  8.   

    用Inputbox不好
    因为界面很普通,按钮上还是英文的。不爽
    不如自己做一个
      

  9.   

    var s: String;
    if InputQuery('Caption','ss',S) then
      begin
        //............................
      end;
    这样就可以了啊
      

  10.   

    假如输入了几个字母再Cancel有判断吗?
    还是根据你要得到的字符串做一些限制吧。
      

  11.   

    我有一个控件包你满意!联系[email protected]我发给你!