在启动app,exe文件之前显示没有边框的图像?

时间:2015-04-11 18:58:27

标签: html vbscript hta

好的,所以有些工具,一些转换工具,可以在启动转换后的应用程序之前显示图像,完成之后! 这是我非常有趣的事情,我非常想知道, 所以问题是: 你怎么能用vbs,js,html,hta,css ......-显示一个图像(基本上不是默认的windows图像查看器,你知道我在说什么)?

我首先强调它与该图像作为背景并且没有边框但是在尝试之后图像仍然具有小边框。

任何想法,!?希望有

4 个答案:

答案 0 :(得分:1)

尝试仅在 Windows 7

上测试此示例

注意:此示例不适用于Windows XP

[VBS / HTA]在后台弹出播放歌曲的图像

Option Explicit
Dim URL,ws,fso,Srcimage,Temp,PathOutPutHTML,fhta,stRep,stFichier,oShell,oFolder,oFichier,Dimensions
Dim arrSize,intLength,intHorizontalSize,intVerticalSize,Tab
URL = "http://www.animatedimages.org/data/media/902/animated-tunisia-flag-image-0023.gif"
Set ws = CreateObject("wscript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Temp = WS.ExpandEnvironmentStrings("%Temp%")
PathOutPutHTML = Temp & "\image.hta"
Set fhta = fso.OpenTextFile(PathOutPutHTML,2,True)
stRep = Temp
Tab = split(url,"/")
stFichier = Tab(UBound(Tab))
Srcimage = stRep & "\" & stFichier
If Not fso.FileExists(Srcimage) Then
   Call DownloadingFile(URL,Srcimage)
Set oShell = CreateObject("Shell.Application")
Set oFolder = oShell.Namespace(stRep)
Set oFichier = oFolder.Items.Item(stFichier)
Dimensions = oFolder.GetDetailsOf(oFichier,31)
arrSize = Split(Dimensions,"x")
'***************************************Important à savoir **********************************************
'Instead, we ended up retrieving item 31, which gave us the total dimensions of the picture,
'using an output format similar to this: ?150 x 354?
'http://blogs.technet.com/b/heyscriptingguy/archive/2008/05/16/how-can-i-search-a-folder-for-all-the-image-files-that-are-not-a-specified-height-and-width.aspx
'Un grand merci à omen999 ==>
'http://www.developpez.net/forums/d1504644/autres-langages/general-visual-basic-6-vbscript/vbscript/passage-variables-procedure/#post8163406
intLength = Len(arrSize(0))
intHorizontalSize = Right(arrSize(0),intLength -1)
intLength = Len(arrSize(1))
intVerticalSize = Left(arrSize(1),intLength - 1)
'***************************************Important à savoir **********************************************
   Call LoadImage(Srcimage,intHorizontalSize,intVerticalSize,Timeout(51))
   ws.run "mshta.exe " & PathOutPutHTML
Else
Set oShell = CreateObject("Shell.Application")
Set oFolder = oShell.Namespace(stRep)
Set oFichier = oFolder.Items.Item(stFichier)
Dimensions = oFolder.GetDetailsOf(oFichier,31)
arrSize = Split(Dimensions,"x")
intLength = Len(arrSize(0))
intHorizontalSize = Right(arrSize(0),intLength -1)
intLength = Len(arrSize(1))
intVerticalSize = Left(arrSize(1),intLength - 1)
   Call LoadImage(Srcimage,intHorizontalSize,intVerticalSize,Timeout(51))
   ws.run "mshta.exe " & PathOutPutHTML
End If
'********************************************************************************************************
Function TimeOut(T)
   TimeOut = T * 1000
End Function
'********************************************************************************************************
Sub LoadImage(Srcimage,intHorizontalSize,intVerticalSize,TimeOut)
   fhta.WriteLine "<html>"
   fhta.WriteLine "   <hta:application id=""oHTA"" "
   fhta.WriteLine "     border=""none"" "
   fhta.WriteLine "     caption=""no"" "
   fhta.WriteLine "     contextmenu=""no"" "
   fhta.WriteLine "     innerborder=""no"" "
   fhta.WriteLine "     scroll=""no"" "
   fhta.WriteLine "     showintaskbar=""no"" "
   fhta.WriteLine "   />"
   fhta.WriteLine "<style>"
   fhta.WriteLine "{ margin: 0; padding: 0; }"
   fhta.WriteLine "body {background: url(" & DblQuote(Srcimage) & ") no-repeat center center fixed;}"
   fhta.WriteLine "</style>"
   fhta.WriteLine "   <script language=""VBScript"">"
   fhta.WriteLine "     Sub Window_OnLoad()"
   fhta.WriteLine "       width = " & intHorizontalSize
   fhta.WriteLine "       height = " & intVerticalSize
   fhta.WriteLine "       window.resizeTo width, height"
   fhta.WriteLine "       window.moveTo screen.availWidth\2 - width\2, screen.availHeight\2 - height\2"
   fhta.WriteLine "       idTimer = window.setTimeout(""vbscript:window.close"","& TimeOut &")"
   fhta.WriteLine "        window.setInterval ""setfocus()"",100"
   fhta.WriteLine "     End Sub"
   fhta.WriteLine "     Function setfocus"
   fhta.WriteLine "       Window.Focus()"
   fhta.WriteLine "     End Function"
   fhta.WriteLine "   </script>"
   fhta.WriteLine "<body>"
   fhta.WriteLine "<bgsound src=""http://upload.wikimedia.org/wikipedia/commons/2/23/Humat_al-Hima.ogg"">"
   fhta.WriteLine "</body>"
   fhta.WriteLine "</html>"
End Sub
'**********************************************************************************************
Function DblQuote(Str)
   DblQuote = Chr(34) & Str & Chr(34)
End Function
'**********************************************************************************************
Sub DownloadingFile(URL,strHDLocation)
Dim Titre,objFSO,Ws,objXMLHTTP,PathScript,Tab,objADOStream,Command,Start,File
Dim MsgTitre,MsgAttente,StartTime,DurationTime,ProtocoleHTTP
Set objFSO = Createobject("Scripting.FileSystemObject")
Set Ws = CreateObject("wscript.Shell")
ProtocoleHTTP = "http://"
If Left(URL,7) <> ProtocoleHTTP Then
URL = ProtocoleHTTP & URL
End if
Tab = split(url,"/")
File =  Tab(UBound(Tab))
File = Replace(File,"%20"," ")
File = Replace(File,"%28","(")
File = Replace(File,"%29",")")
   Set objXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP.3.0")
   strHDLocation = PathScript & "\" & File
   On Error Resume Next
  objXMLHTTP.open "GET",URL,false
   objXMLHTTP.send()
If Err.number <> 0 Then
  MsgBox err.description,16,err.description
  Exit Sub
  Else
  If objXMLHTTP.Status = 200 Then
  strHDLocation = Temp & "\" & File
  Set objADOStream = CreateObject("ADODB.Stream")
  objADOStream.Open
  objADOStream.Type = 1 'adTypeBinary
  objADOStream.Write objXMLHTTP.ResponseBody
  objADOStream.Position = 0  'Set the stream position to the start
  objADOStream.SaveToFile strHDLocation,2 '2=adSaveCreateOverWrite
  objADOStream.Close
  Set objADOStream = Nothing
  End If
End if
Set objXMLHTTP = Nothing
End Sub

答案 1 :(得分:1)

@Hackoo你总是有这些WOW代码,我的意思是我从来没有强硬我可以面对这样的事情,而且thx的快速回复和帮助,我可能会使用,但基本上我认为我发现了一些有趣的,有效的,并且比你发布的代码容易得多,我会让代码说话:
注意这段代码需要3个文件{“data / background.jpg”和“data / 1.mp3”}和hta文件为“ new2.hta“

<html>
<head>

<script Language="VBScript">


Sub window_onload
 window.setTimeout"Script", 3000, "VBScript"
End Sub


Sub Script
Set obj=CreateObject("Wscript.shell")
obj.run "new2.hta"
Self.close
End Sub

</script>
<HTA:APPLICATION
border="none"
InnerBorder="no">
<title>title is useless here :D</title>
<style type="text/css">
.bg {background-image:url(data/background.jpg)}
</style>
</head>
<body class="bg">
<embed src="data/1.mp3" hidden="true" loop="false" autostart="1">
</body>
</html>

实际上我不确定这是否可以在其他计算机上运行,​​但它确实适用于Windows XP,是的,感谢帮助@Hackoo你很棒:D 注意:对于复制此代码的人,请确保更改变量并将窗口大小调整为适合图像的大小;)

答案 2 :(得分:1)

这是我做的另一个老例子,希望它能在你的 windows xp 上为你工作。只是试一试并告诉我结果。

效果就像在这个视频中==&gt; https://www.youtube.com/watch?v=3OQdJT6xVqo

enter image description here     的 SplashScreen.vbs

此代码的优点是它可以在任何用Vbscript编写的应用程序中使用,并且可以轻松编辑和自定义。     所以只需调用程序SplashScreen最重要的主程序!和瞧(-_°)

'The advantage of this code is that it can be used in any application written in Vbscript and is easily editable and customizable!
'So just call the procedure SplashScreen foremost Main program! and voila (-_°)
'Un Splash Screen ou bien un écran d'acceuil en Vbscript en utilisant la puissance du HTML Application [HTA] Réalisé par © Hackoo © le 02/01/2012
'L'avantage de ce code est qu'il est utilisable dans n'importe quelle Application écrite en Vbscript et il est facilement modifiable et personnalisable !
'Donc il suffit d'appeller la procédure SplashScreen avant tout programme Principal ! et le tour est joué (-_°)
'**************************************************************************************************
Call SplashScreen
Call MainProgram
'**************************************************************************************************
Sub SplashScreen()
Dim shell : Set shell = CreateObject("WScript.Shell")
Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")
Dim tempFolder : Set tempFolder = fso.GetSpecialFolder(2)
Dim SplashName : SplashName = "Splash.hta"
Dim tempFile : Set tempFile = tempFolder.CreateTextFile(SplashName)
tempFile.Writeline "<html>"
tempFile.Writeline "<head>"
tempFile.Writeline "<bgsound src=""http://hackoo.alwaysdata.net/Matrix.mp3"" loop=""infinite"">"
tempFile.Writeline "<title>Splash Screen</title>"
tempFile.Writeline "<HTA:APPLICATION ID=""Splash Screen"""
tempFile.Writeline "APPLICATIONNAME=""Splash Screen"""
tempFile.Writeline "BORDER=""none"""
tempFile.Writeline "CAPTION=""no"""
tempFile.Writeline "SHOWINTASKBAR=""no"""
tempFile.Writeline "SINGLEINSTANCE=""yes"""
tempFile.Writeline "SYSMENU=""no"""
tempFile.Writeline "SCROLL=""no"""
tempFile.Writeline "WINDOWSTATE=""normal"">"
tempFile.Writeline "<link rel=""stylesheet"" media=""screen"" type=""text/css"" title=""design_encoder"" href=""http://hackoo.alwaysdata.net/design_encoder.css""/>"
tempFile.Writeline "</head>"
tempFile.Writeline"<SCRIPT LANGUAGE=""VBScript"">"
tempFile.Writeline "Sub CenterWindow(x,y)"        
tempFile.Writeline     "window.resizeTo x, y"      
tempFile.Writeline     "iLeft = window.screen.availWidth/2 - x/2"      
tempFile.Writeline     "itop = window.screen.availHeight/2 - y/2"    
tempFile.Writeline       "window.moveTo ileft, itop"      
tempFile.Writeline "End Sub"    
tempFile.Writeline "Sub Window_OnLoad"
tempFile.Writeline      "CenterWindow 400,300"
tempFile.Writeline      "iTimerID = window.setInterval(""ShowSplash"", 120000)"
tempFile.Writeline "End Sub"
tempFile.Writeline "Sub ShowSplash"
tempFile.Writeline     "Splash.Style.Display = ""None"""
tempFile.Writeline     "Window.Close()"
tempFile.Writeline     "End Sub"
tempFile.Writeline "</SCRIPT>"
tempFile.Writeline "<body bgcolor=""black"">"
tempFile.Writeline "<DIV id=""Splash"">"
tempFile.Writeline "<CENTER>"
tempFile.Writeline "<p>"
tempFile.Writeline "<img src=""http://nsm05.casimages.com/img/2011/07/23//1107230741401311048506419.gif""/>"
tempFile.Writeline "<center onselectstart=""return false"" ondragstart=""return false"" oncontextmenu=""return false"">"
tempFile.Writeline  "<marquee DIRECTION=""UP"" HEIGHT=""200"" WIDTH=""350"" SCROLLAMOUNT=""3"" onselectstart=""return false"">"
tempFile.Writeline   "<center><font face=""Comic sans MS"" color=RED size=10><b><i> Splash Screen </i></b></font></center><br><br>"
tempFile.Writeline    "<center><font face=""Comic sans MS"" color=RED>This an example of Splash Screen</b></font></center>"
tempFile.Writeline "<br><center><font face=""Comic sans MS"" color=RED>By © Hackoo 2013<br><br></font></center><center><img src=""http://nsm05.casimages.com/img/2011/07/23//1107230741401311048506419.gif""></center></marquee>"
tempFile.Writeline "</center>"
tempFile.Writeline "</p>"
tempFile.Writeline "</CENTER>"
tempFile.Writeline "</DIV>"
tempFile.Writeline "</body>"
tempFile.Writeline "</html>"
tempFile.Writeline "tempFile.Close"
shell.Run tempFolder & "\" & SplashName,1,True
End Sub
'**************************************************************************************************
Sub MainProgram
MsgBox "Welcome! your in your main Program !"& VbCRLF & "Bienvenue ! dans votre Programme Principal !",64,"Programme Principal by © Hackoo 2013"
End Sub

答案 3 :(得分:0)

我是个白痴!!!! 点击发布按钮2秒后,我想起了有关HTA:APPLICATION标签的内容 是的 “InnerBorder”属性!! 抱歉浪费你的时间读者:D但我很高兴了解这一点,我想!

编辑:但这会带我们另一个问题是“文件打开安全检查”,当我在显示第一个HTA /图像文件后尝试打开第二个文件时,它只是弹出一个从IE浏览器的安全窗口,我确实尝试使用
<a href="secondfile.hta">click here</a>

,并且与{
<HTA:APPLICATION Navigable="yes">选项完全兼容但问题在于,我不想显示带有恼人的文字链接的图像等待点击,启动hta!对此的问题是:如何自动点击&lt;一个&GT;链路&LT; / a&gt;
或者如果可能的话我如何克服这个安全弹出窗口?