一个月搞定,有一段程序不甚明了,求助高手 !!!
__fastcall TForm1::TForm1(TComponent* Owner): TForm(Owner)
{ // if(Use_Window_Control) Application->OnMessage = ProcessMessage ;
CustomCaption = "软件";
Caption = "";
WindowCanvas = new TCanvas;
// this code determines if we are running on NT3.X
TOSVersionInfo ver;
ver.dwOSVersionInfoSize = sizeof(TOSVersionInfo);
GetVersionEx( &ver);
if(ver.dwMajorVersion < 4)
{
// if the OS is NT 3.5, the custom caption won't be drawn
// use the Caption property as usual, since the custom
// caption won't be able to draw the string.
IsNT35 = true;
Caption = CustomCaption;
}
else IsNT35 = false;
}
/*void __fastcall TForm1::WM_Not_Close (TMessage &message)
{
//message.Result=1; //禁止关机
TForm::Dispatch(&message);
}*/
void __fastcall TForm1::ProcessMessage (TMsg &message, bool &handled)
{ //去掉屏保两方法
if (message.message == WM_SYSCOMMAND && message.wParam == SC_SCREENSAVE)
handled = true ;
else handled = false ;
}
void __fastcall TForm1::WM_Screen_Start(TMessage &msg)
{
if(msg.WParam!=SC_SCREENSAVE)
TForm::Dispatch(&msg);
}
///&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
void __fastcall TForm1::WMNCActivate(TWMNCActivate &Msg)
{
Msg.Result = true; // always handle this message;
if ((bool)Msg.Active == false) // if non-active draw default
{ // non-active title bar
DefWindowProc( Handle, Msg.Msg, Msg.Active, 0 );
// add code here to draw caption when window is inactive.
// in this example, we leave the inactive caption alone.
return;
}
TMessage PaintMsg; // if active, do same thing as WMNCPaint
PaintMsg.Msg = Msg.Msg; // create a MSG to pass to WMNCPaint and
PaintMsg.WParam = Msg.Active; // call the function directly so painting
WMNCPaint(PaintMsg); // happens now.
}