📄 bcjq043.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获取应用程序图标
现在,网上有大量的有关图标的共享软件或免费软件,而且很多也很好用,也方便。但是那毕竟是别人的,用起来总有些哪个,况且自己又喜欢编程,何不自己动手呢!说干就干,而且手头上有可视化编成的利器――C++Builder4.0,想来应该是很简单的一件事。
首先启动C++Builder,新建一工程,在窗体上放置一个Button控件,一个Image控件,和一个OpenDialog控件,它们的名称均不必改动。双击Button控件,写如下代码:
if(OpenDialog1->Execute())
{
FileName = OpenDialog1->FileName;
HICON hIcon;
// Total =(int) ExtractIcon( Form1->Handle, FileName.c_str(),
-1);
Icon = new Ticon();
hIcon = ExtractIcon( Form1->Handle, FileName.c_str(), 0);
Icon->Handle=hIcon;
Icon->SaveToFile(TempFile);
Image1->Picture->LoadFromFile(TempFile);
}
其中:FileName,TempFile,Icon在其头文件中定义:AnsiString TempFile,
FileName ; Ticon *Icon;
这样,你所选定的程序的第一个图标就在Image控件中显示了出来。本程序所用的是Windows
API ExtractIcon来获取图表的,因此它只能获取可执行文件的图标,如果想获取任意文件的图标,那末你可以调用Windows
API 的SHGetFileInfo函数来完成,SHGetFileInfo所能完成的任务有很多,具体用法可参见Win32的帮助文件。
本人有完整的源程序,如有兴趣可参看一下,你可以在http://wbear.126.com或http://members.tripod.co.uk/lsw处获得
--刘四委--
if (ad==1) {document.write(''+'');}
if (ad==2) {document.write(''+'');}
if (ad==3) {document.write(''+'');}
C++ Builder开发者®
2000年06月01日 站长:唐朝