GARANTIR DESCONTO

Fórum Pisca Pisca no minimizado do ChatClient #177044

23/08/2003

0

Oi pessoal, acontece o seguinte, to fazendo um chatclient e acontece que quero a seguinte ação. que quando chegar a mensagem pra a pessoa, e tiver minimizado a janela, a janela começe a piscar, assim como no messenger, alguem sabe como? e alguem ai sabe onde eu acho um codigo fonte de um chatclient pra eu estudar ele??
Obrigado


Sergio Luiz

Sergio Luiz

Responder

Posts

24/08/2003

Aroldo Zanela

Colega,

No evento que manipula o recebimento de mensagem adicione o seguinte código (substituir Form1 pelo nome do seu formulário);

SetForegroundWindow(Form1.Handle);



Responder

Gostei + 0

24/08/2003

Cebikyn

Acho que [b:22bf41c806]SetForegroundWindow();[/b:22bf41c806] não é exatamente o que o Sergio precisa, pois esta função apenas tras a janela para frente, e ele quer que a janela pisque. Para isso deve-se usar a [i:22bf41c806]procedure[/i:22bf41c806] [b:22bf41c806]FlashWindow[/b:22bf41c806] ou a [b:22bf41c806]FlashWindoEx[/b:22bf41c806].

Para usar a [b:22bf41c806]FlashWindowEx[/b:22bf41c806], declare:

type
  TFlashWInfo = record
    cbSize    : LongInt;
    hWndMe    : LongInt;
    dwFlags   : LongInt;
    uCount    : LongInt;
    dwTimeout : LongInt;
  end;


Depois use:

var
  FWinfo: TFlashWInfo;
begin
  with FWinfo do
  begin
    cbSize := 20;
    hwnd := Application.Handle; // O handle do aplicativo
    dwflags := FLASHW_ALL;
    ucount := 10; // número de vezes para piscar
    dwtimeout := 0; // Tempo entre alternar as cores (0 é o padrão)
  end;

  FlashWindowEx(FWinfo);
end;


Você pode trocar [b:22bf41c806]FLASH_ALL[/b:22bf41c806] por:

FLASHW_STOP = 0
FLASHW_CAPTION = 1   // Pisca apenas a barra de título
FLASHW_TRAY = 2      // Pisca o botão da barra de tarefas
FLASHW_ALL = 3       // Pisca o botão e a barra de título
FLASHW_TIMER = 4     // Pisca até que a função seja
                     // chamada com o FLASHW_STOP
FLASHW_TIMERNOFG = 5 // Pisca até a janela ter foco


Caso esta função não funcione na sua versão do Windows, deixe uma msg que eu coloco como usar a [b:22bf41c806]FlashWindow[/b:22bf41c806].


Responder

Gostei + 0

24/08/2003

Aroldo Zanela

[quote:82e82b9beb=´Sergio Luiz´]e tiver minimizado a janela, a janela começe a piscar, assim como no messenger, [/quote:82e82b9beb]

Colega,

SetForegroundWindow faz exatamente isso.


Responder

Gostei + 0

24/08/2003

Cebikyn

[quote:e90b5b24a3=´Aroldo Zanela´][quote:e90b5b24a3=´Sergio Luiz´]e tiver minimizado a janela, a janela começe a piscar, assim como no messenger, [/quote:e90b5b24a3]

Colega,

SetForegroundWindow faz exatamente isso.[/quote:e90b5b24a3]

Não sabia, eu apenas li este trecho do site do Micro$oft:

The SetForegroundWindow function puts the thread that created the specified window into the foreground and activates the window. Keyboard input is directed to the window, and various visual cues are changed for the user. The system assigns a slightly higher priority to the thread that created the foreground window than it does to other threads.


e já achei que a função não piscasse a janela... acho que esta parte de piscar esta implícita em ´[i:e90b5b24a3]various visual cues[/i:e90b5b24a3]´...


Responder

Gostei + 0

24/08/2003

Aroldo Zanela

Colega,

Windows NT 5.0 will not allow an application to force a window to the foreground while the user is working with another window. Instead, SetForegroundWindow will activate the window (see SetActiveWindow) and call the FlashWindowEx function to notify the user.


Responder

Gostei + 0

26/08/2003

Cebikyn

[quote:e6ed95f93b=´Aroldo Zanela´]Colega,

Windows NT 5.0 will not allow an application to force a window to the foreground while the user is working with another window. Instead, SetForegroundWindow will activate the window (see SetActiveWindow) and call the FlashWindowEx function to notify the user.[/quote:e6ed95f93b]

Como eu disse, eu apenas li [b:e6ed95f93b]aquele[/b:e6ed95f93b] trecho... :D


Responder

Gostei + 0

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar