Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "KOL";
Текущий архив: 2008.07.13;
Скачать: [xml.tar.bz2];

Вниз

msg.result?   Найти похожие ветки 

 
Jon ©   (2007-10-08 04:36) [0]

How to change the result of a message?
I want to prevent standby or suspend while app is running.
Applet.OnMessage := TOnMessage(MakeMethod(nil,@AppMessage));
MSDN tells me that return value of message shoud be BROADCAST_QUERY_DENY
function AppMessage(Dummy: Pointer; var Msg: tagMSG; var Rslt: Integer): Boolean;
begin
 Result := False;
 case Msg.message of
   WM_POWERBROADCAST:
   begin
     case Msg.wParam of
       PBT_APMSUSPEND, PBT_APMSTANDBY:
       begin
         Msg.message := BROADCAST_QUERY_DENY;
//          Msg.Result := BROADCAST_QUERY_DENY;
         Result := True;
       end;
     end;
   end;
end;

Why can I not assign a msg.result?


 
thaddy   (2007-10-08 11:17) [1]

Use the OnClose and/or OnQueryEndSession events instead.
See kol.pas for good documentation.


 
Jon ©   (2007-10-08 12:37) [2]

I know that OnClose handles application exit and that OnQueryEndSession handles shutdown/logoff, but neither handle standby/suspend (I have tried).

Thanks for the suggestion, but I really think that I need to handle the APM requests and to return BROADCAST_QUERY_DENY as described in MSDN - unfortunately there seems to be no KOL documentation on how to return message values :-(


 
Vladimir Kladov ©   (2007-10-08 15:49) [3]

Rslt := BROADCAST_QUERY_DENY;


 
fellix   (2007-10-08 15:58) [4]

> Jon ©   (08.10.07 04:36)  
> I want to prevent standby or suspend while app is running.


This works.

if (Msg.message = WM_POWERBROADCAST) and
  ((Msg.wParam = PBT_APMQUERYSUSPEND) or
   (Msg.wParam = PBT_APMQUERYSTANDBY))
then begin
 Rslt := BROADCAST_QUERY_DENY;
 Result := True;
end
else Result := False;


Note, that under Vista you have to enable corresponding group policy.


 
Jon ©   (2007-10-08 17:08) [5]


> Rslt := BROADCAST_QUERY_DENY;


I need my eyes checked - thank you!


> PBT_APMQUERYSUSPEND, PBT_APMQUERYSTANDBY


Got it! I was incorrectly using PBT_APMSUSPEND and PBT_APMSTANDBY. Thanks!



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

Форум: "KOL";
Текущий архив: 2008.07.13;
Скачать: [xml.tar.bz2];

Наверх




Память: 0.45 MB
Время: 0.006 c
3-1201958594
Lamer666
2008-02-02 16:23
2008.07.13
Как узнать процент заполненности базы данных MSSQL


2-1213433398
Начинающий
2008-06-14 12:49
2008.07.13
OnDrawCell в DrawGrid


2-1213459535
VovKul
2008-06-14 20:05
2008.07.13
Как узнать полный путь к выделенному файлу в ShellListView?


15-1212050322
__mirage_
2008-05-29 12:38
2008.07.13
не надоело варианты моего ника регистрировать?


2-1213285768
ivan8511
2008-06-12 19:49
2008.07.13
Индекс в обратном порядке





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский