⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bcjq049.txt

📁 c++ builder 的一些txt文档
💻 TXT
字号:

C++ Builder开发者:程序员之家
var how_many_ads = 3;
var now = new Date()
var sec = now.getSeconds()
var ad = sec % how_many_ads;
ad +=1;
 
  
  
    
      
        
          
            首页   
              | 控件天堂 | 控件使用                    
              | 编程技巧                     
              |  源代码 |  编程工具 |         
               系统补丁 |  电子书籍 | 技术论坛                     
              |  相关链接                  
                            
                          
                        
                      
                      
                        
                          
                            
                              
                            
                  
       if (ad==1) {document.write(''+'');}                
       if (ad==2) {document.write(''+'');}                
       if (ad==3) {document.write(''+'');}                
                               
                            
                         
                                     
                         
                       
                     
                   
                   
                     
                       
                         
                           
                        
                      
var marqueecontents=''+scroll_text+''            
if (document.all)            
document.write(''+marqueecontents+'')            
function regenerate(){            
window.location.reload()            
}            
function regenerate2(){            
if (document.layers){            
setTimeout("window.onresize=regenerate",450)            
intializemarquee()            
}            
}            
function intializemarquee(){            
document.cmarquee01.document.cmarquee02.document.write(marqueecontents)            
document.cmarquee01.document.cmarquee02.document.close()            
thelength=document.cmarquee01.document.cmarquee02.document.height            
scrollit()            
}            
function scrollit(){            
if (document.cmarquee01.document.cmarquee02.top>=thelength*(-1)){            
document.cmarquee01.document.cmarquee02.top-=speed            
setTimeout("scrollit()",100)            
}            
else{            
document.cmarquee01.document.cmarquee02.top=marqueeheight            
scrollit()            
}            
}            
window.onload=regenerate2            
                        
                          
                        
                      
                    
                  
                  
                    
                      
                        
                          
                            
                              
                                
                  当前位置
     
     
                    编程技巧             
                             
                           
                         
                         
                         
                           
                             
                               
                    让应用程序禁止Windows屏幕保护         
                           
                     
                       
                         
                           
                          --- 
            如果在你的程序中需要一个很长的时间段来进行大量的数据处理,这段时间长得足以使Windows因检测不到用户动作而激活屏幕保护程序,一旦启动了屏幕保护程序,你的程序运行实际上就变慢了,这会大大影响程序的正常运行。有没有一种方法,使程序在进行长时间的数据处理前关掉屏幕保护呢?答案是肯定的。Windows在启动屏幕保护程序前会向当前激活的应用程序发送WM_SYSCOMMAND消息,其中wParam参数指定了即将执行的系统命令类型,在本例中其值为SC_SCREENSAVE。问题在于程序如何捕获这个消息呢?在C++  
            Builder中可以利用TApplication类的OnMessage事件句柄来处理这个消息。应用程序在接收到任何Windows消息后都会触发TApplication类的OnMessage事件,通过定义这个事件的处理程序,可以捕获发送给应用程序的所有Windows消息(这当然不包括在程序中用SendMessage函数发送的消息)。 
            
---- OnMessage事件的定义如下: 
            typedef void__fastcall(__closure 
*TMessageEvent)(tagMSG &Msg,bool&Handled);
__property TMessageEvent OnMessage=
{read=FOnMessage,write=FOnMessage};
 
            
---- 其中TMessageEvent类型是OnMessage事件的类型,它定义了处理消息的方法,Msg参数给出了Windows消息的相关信息,其结构如下: 
            typedef struct tagMSG{
        HWND hwnd;
        UINT message;
        WPARAM wParam;
        LPARAM lParam;
        DWORD time;
        POINT pt;}
 
            
---- Handled参数决定了如何对消息进行下一步处理,如果在接收到一个消息后将Handled参数设为true,则这个消息将不会得到进一步的处理,在本例中就是取消屏幕保护程序的激活。 
            
---- 启动C++ Builder,新建一工程文件,在头文件中的Private段增加对成员函数CaptureMessage的声明: 
            class TForm1 : public TForm
{
__published:	
private:	
    void __fastcall CaptureMessage(tagMSG &Msg,bool &Handled);
public:		
    __fastcall TForm1(TComponent* Owner);
};
 
            
---- 在.cpp文件中增加CaptureMessage的定义: 
            void __fastcall TForm1::CaptureMessage(tagMSG &Msg,bool &Handled)
{
    if(Msg.message= =WM_SYSCOMMAND && Msg.wParam= =SC_SCREENSAVE)
        Handled=true;  //阻止屏幕保护的启动
    else
        Handled=false;  //进行该消息的缺省处理
}
 
            
---- 再将定义好的CaptureMessage函数作为OnMessage事件的事件处理器,将以下代码加到主窗体的OnCreate事件处理器中: 
            void __fastcall TForm1::FormCreate(TObject *Sender)
{
Application->OnMessage=CaptureMessage;
}
 
            
---- 按F9编译并运行程序,你可以事先将屏幕保护的等待时间设为一个尽可能小的值来检验程序的运行情况。你会发现在程序运行期间,屏幕保护程序将无法被激活,关闭运行的程序后再等待一会儿,屏幕保护程序就会正常出现。以上代码在C++  
            Builder3、win98环境中运行通过 
            
--周新栋---      
                              
                            
                                
                        
                              
                                
                              
                  if (ad==1) {document.write(''+'');}              
                  if (ad==2) {document.write(''+'');}              
                  if (ad==3) {document.write(''+'');}              
                                                
                              
                            
                          
                        
                   
                    
                      
                        
                      
                      
                          
                      
                    
                       
                     
                   
                 
               
               
                 
                   
                     
                       
            C++ Builder开发者®            
              2000年06月01日 站长:唐朝            
                      
                    
                  
                
                
                  
                
              
              
            
            
            
            

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -