windows

[알림판목록 I] [알림판목록 II] [글목록][이 전][다 음]
[ windows ] in KIDS
글 쓴 이(By): Zaharang ( 자하랑)
날 짜 (Date): 2003년 7월  1일 화요일 오후 01시 36분 52초
제 목(Title): Re: [질문]바탕 화면에 바로가기 만드는 함



음. 이 보드는 너무 가끔씩 들어오는 보드라서...
너무 늦은 답이 아닐까 하는데, 여튼...

지금 문서를 다시 좀 봤는데 ms에서 applet을 다운받고
CLSID로 shell object를 불러서 shortcut 생성이 되도록 푸는 방법이군요.


문서를 통째로 올려드립니다.

Put an Internet Shortcut on Desktop
In order to keep our website visitor always remember where our website is, 
we can offer them to bookmark our site by using javascript:AddToFavorites 
function from IE but it  obsolete, today we should give them a better 
offer by offering them to put our website shortcut on their desktop, you 
can done it by using the JavaScript.

Here is the first line that you have to put on your HTML files.

document.write("<APPLET HEIGHT=0 WIDTH=0 
code=com.ms.activeX.ActiveXComponent></APPLET>");

This code will download an applet from Microsoft, this applet very useful 
because it will allow us to put a shortcut anywhere in client computer.

After you wrote that code, you should continue to the next code :

function AddFavLnk(loc, DispName, SiteURL) {
  var Shor = Shl.CreateShortcut(loc + "\\" + DispName +".URL");
  Shor.TargetPath = SiteURL;
  Shor.Save();
}


This code allow us to create a shortcut in loc by utilizing Shell Object. 
The next code is

function f() {
try {
a1=document.applets[0];
a1.setCLSID("{F935DC22-1CF0-11D0-ADB9-00C04FD58A0B}");
a1.createInstance();
Shl = a1.GetObject();
a1.setCLSID("{0D43FE01-F093-11CF-8940-00A0C9054228}");
a1.createInstance();
FSO = a1.GetObject();
a1.setCLSID("{F935DC26-1CF0-11D0-ADB9-00C04FD58A0B}");
a1.createInstance();
Net = a1.GetObject();
try 
{
var WF, Shor, loc;

WF = FSO.GetSpecialFolder(0);
if (language.indexOf('en') >-1) loc = WF + "\\desktop"; else
document.writeln('Unable to place a shortcut on your desktop');

AddFavLnk(loc, "Jazarsoft.com", "http://www.jazarsoft.com");
document.writeln('A shortcut has been placed on your desktop'); 
}
catch(e) {}
}
catch(e) {}
}

This is the backbone of the script as you look there is a call to 
AddFavLoc. As the result of this call there will be a new shortcut to 
http://www.jazarsoft.com on your desktop. 

The last code is :

function init() {
setTimeout("f()", 1000);
}

init();

This will give a chance to the the browser (in this case Internet 
Explorer) to download from Microsoft site, after the applet was downloaded 
then we can try to use it to create an internet shortcut on client 
desktop. Pretty cool hah ? 

Here is the coolest idea (but crazy) :
You can force your visitor to re-visit your site again everything time 
they start their computer. All you have to do it change 

WF + "\\desktop" to  WF + "\\Start Menu\\Programs\\StartUp" 

Here is the complete code:

<HTML>
<HEAD>
<LINK REL="stylesheet" TYPE="text/css" 
HREF="http://www.jazarsoft.com/css/general.css">
<TITLE>Desktop Shortcut Maker</TITLE>
</HEAD>

<SCRIPT>
document.writeln('Putting a shortcut on your desktop\n\n');

document.write("<APPLET HEIGHT=0 WIDTH=0 
code=com.ms.activeX.ActiveXComponent></APPLET>");

if (navigator.appName == 'Netscape') 
var language = navigator.language;
else 
var language = navigator.browserLanguage;

function AddFavLnk(loc, DispName, SiteURL) {
var Shor = Shl.CreateShortcut(loc + "\\" + DispName +".URL");
Shor.TargetPath = SiteURL;
Shor.Save();
}

function f() {
try {
a1=document.applets[0];
a1.setCLSID("{F935DC22-1CF0-11D0-ADB9-00C04FD58A0B}");
a1.createInstance();
Shl = a1.GetObject();
a1.setCLSID("{0D43FE01-F093-11CF-8940-00A0C9054228}");
a1.createInstance();
FSO = a1.GetObject();
a1.setCLSID("{F935DC26-1CF0-11D0-ADB9-00C04FD58A0B}");
a1.createInstance();
Net = a1.GetObject();
try 
{
var WF, Shor, loc;

WF = FSO.GetSpecialFolder(0);
if (language.indexOf('en') >-1) loc = WF + "\\desktop"; else
document.writeln('Unable to place a shortcut on your desktop');

AddFavLnk(loc, "Jazarsoft.com", "http://www.jazarsoft.com");
document.writeln('A shortcut has been placed on your desktop'); 
}
catch(e) {}
}
catch(e) {}
}

function init() {
setTimeout("f()", 1000);
}

init();
</SCRIPT>



[알림판목록 I] [알림판목록 II] [글 목록][이 전][다 음]
키 즈 는 열 린 사 람 들 의 모 임 입 니 다.