Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2005.10.23;
Скачать: CL | DM;

Вниз

Что было нажато: Да или Нет?   Найти похожие ветки 

 
Kripton   (2005-08-19 05:27) [0]

Привет вам, господа! У меня мизерная проблемка. Надо узнать, когда пользователь нажимает Да и когда Нет в диалоге удаления файла. Удаление происходи при нажатии на кнопку. Код такой:

From:="";
 with Struct do
 begin
   Wnd := Handle;
   wFunc := FO_DELETE;
   for i:=0 to ListBox2.Items.Count-1 do
    if ListBox2.Selected[i] then
    From:=From+ListBox2.Items.Strings[i]+#0#0;
    From := From+#0#0;
   pFrom := PChar(From);
   pTo := nil;
   fFlags := 0;
   fAnyOperationsAborted := False;
   hNameMappings := nil;
   lpszProgressTitle := nil;
 end;
 Err := SHFileOperation(Struct);

if Err <> S_OK then MessageDlg("ла-ла-ла",mtError,[mbOk],0);

Безвозвратно. Как дописать программно: Было нажато Да?


 
alpet ©   (2005-08-19 07:05) [1]

Документацию надо читать.
SHFILEOPTSTRUC
.fAnyOperationsAborted
Value that receives TRUE if the user aborted any file operations before they were completed, or FALSE otherwise.


 
psa247 ©   (2005-08-20 12:47) [2]

Возможно ли задать фокус на кнопки Yes | No в MessageBox по умолчанию?


 
alpet ©   (2005-08-20 14:33) [3]

psa247 ©   (20.08.05 12:47) [2]

Предполагаю что можно, но только наверное из отдельного потока или по обработчику WM_TIMER для своей процедуры.

Вот кривой примерчик:

uses windows;

var bFocus: Boolean = False;

procedure TimerProc (hwnd, uMsg, idEvent, dwTime: dword); stdcall;
var h: THandle;
begin
if bFocus then exit;
h := FindWindow (nil, "Message Caption");
if IsWindow (h) then
 begin
  h := GetDlgItem (h, IDNO);
  if IsWindow (h) then
    begin
     SetFocus (h);
     bFocus := true;  
    end;
 end;
end;

begin
SetTimer (0, 0, 100, @TimerProc);
MessageBoxA (0, "Message Text", "Message Caption", MB_YESNO);
end.


 
psa247 ©   (2005-08-20 15:06) [4]


> alpet ©

Хоть кривой, но работает.
Благодарю...


 
GuAV ©   (2005-08-20 15:41) [5]

psa247 ©   (20.08.05 12:47) [2]
Flag Meaning
MB_DEFBUTTON1 The first button is the default button. MB_DEFBUTTON1 is the default unless MB_DEFBUTTON2, MB_DEFBUTTON3, or MB_DEFBUTTON4 is specified.
MB_DEFBUTTON2 The second button is the default button.
MB_DEFBUTTON3 The third button is the default button.
MB_DEFBUTTON4 The fourth button is the default button.



Страницы: 1 вся ветка

Текущий архив: 2005.10.23;
Скачать: CL | DM;

Наверх




Память: 0.48 MB
Время: 0.045 c
14-1128062530
Карелин Артем
2005-09-30 10:42
2005.10.23
Использование 2-х модемов при выходе в инет.


4-1124289081
NikNet
2005-08-17 18:31
2005.10.23
Как правельно передать Handle иконки другому Handle иконки?


2-1127907181
Гость22
2005-09-28 15:33
2005.10.23
Как не дать закрыть свое приложение?


2-1128050000
Pop_Max
2005-09-30 07:13
2005.10.23
Работа в сети


3-1126260681
Monk
2005-09-09 14:11
2005.10.23
Компонент DBLookupListBox