?? bcjq095.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
當前位置
:
編程技巧
在C++
Builder程序中控制Windows關機
我們在應用程序編制完成后,需要設計應用程序的包裝和分發功能。在編寫安裝程序時,經常會遇到這樣的問題:程序安裝完成后需要重新啟動計算機。那么在代碼中如何控制Windows的關機或重新啟動呢?
要實現這個功能,需要用到Windows
API提供的一個ExitWindowsEx函數。我們可以通過查看C++
Builder提供的幫助文件得到這個函數的使用格式:
BOOL ExitWindowsEx(
UINT uFlags,
// 設置關機參數
DWORD dwReserved
// 系統保留字
);
其中uFlags的主要設置值及意義見表1。
dwReserved是系統保留字,隨便填入個0即可。
了解ExitWindowsEx函數的使用格式后,下面以實例說明在C++
Builder中控制Windows關機或重新啟動的方法。
設計步驟如下:
1.運行C++ Builder系統后,先激活選單“File/New
Application”,創建一個新工程。
2.激活選單“File/Save As”把窗體單元以文件名exitu.cpp存盤,然后激活選單“File/Save
Project As”把工程文件以文件名exitp.bpr存盤。(注意:工程文件名與窗體單元文件名不要同名。)
3.在窗體上增加四個TButton組件Button1、Button2、Button3和Button4,分別設置它們的Caption屬性為“其它身份登錄”、“關機”、“重新啟動”和“強制關機”。
4.分別設置Button1、Button2、Button3和Button4組件的OnClick事件響應代碼如下:
void __fastcall TForm1::Button1Click(TObject
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -