close

最近因為客戶需要使用EWF功能

因此我用VS2012包EWF指令製作出exe,再用hta來執行這些exe

hta如下

<html>
<head>
<title>EWF 控制台</title>
<hta:application
icon = "favicon.ico"
id="HelloWorld"
applicationName="HelloWorld"
border="5pt"
borderStyle="raised"
caption="yes"
maximizeButton="yes"
minimizeButton="yes"
showInTaskBar="yes"
singleInstance="yes"
sysMenu="yes"
windowState="maximize"
>
<SCRIPT Language="VBScript">
sub Window_onLoad
window.resizeTo 600,480
end sub
sub helloWorld
document.getElementById("hier").innerHTML="You click Button 1!"
Set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "EWF_show_status.exe", , , , NORMAL_WINDOW
'Set ws = CreateObject("WScript.Shell")
'ws.Run "EWF_show_status.exe"
'Set ws = CreateObject("WScript.Shell")
'set cmd = ws.Exec("cmd /k")
'cmd.stdin.writeline("dir")
'cmd.stdin.close 'close stdin [can't reopen!]
'ws.popup cmd.stdout.readall 'get+show output
end sub
sub button2
document.getElementById("hier").innerHTML="EWF開啟中, 稍後將會重開機!"
Set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "EWF_Enable.exe", , , , 0
'Set ws = CreateObject("WScript.Shell")
'ws.Run "EWF_Enable.exe"

end sub
sub button3
document.getElementById("hier").innerHTML="EWF關閉中, 稍後將會重開機!"
Set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "EWF_Disable.exe", , , , 0
'Set ws = CreateObject("WScript.Shell")
'ws.Run "EWF_Disable.exe"
end sub
</script>
</head>
<body>
<p>EWF 使用方式: </p>
<p>1. 您可以點擊 EWF狀態 來觀看目前EWF的狀態</p>
<p>2. 您透過點擊 EWF啟動 來鎖定C槽</p>
<p>3. 您透過點擊 EWF解除 來解除鎖定</p>
<form>
<input type="button" onClick="self.helloWorld()" value="EWF狀態" style="width:150px;height:60px;font-size:30px;">
<input type="button" onClick="self.button2" value="EWF啟動" style="width:150px;height:60px;font-size:30px;">
<input type="button" onClick="self.button3" value="EWF解除" style="width:150px;height:60px;font-size:30px;">
</form>
<div id="hier"> 狀態 </div>
</body>
</html>

 

EWF_show_status.cpp

#include "stdafx.h"

#include "windows.h"

int _tmain(int argc, _TCHAR* argv[])
{
wprintf(L"show EWF status\n");
system( "cd c:\\windows\\system32");
system( "ewfmgr.exe c:");
system( "pause");
return 0;
}

 

EWF_Enable.cpp

#include "stdafx.h"
#include "windows.h"

int _tmain(int argc, _TCHAR* argv[])
{
wprintf(L"show EWF status\n");
system( "cd c:\\windows\\system32");
system( "ewfmgr.exe c: -enable");
system( "shutdown /r /t 0");
return 0;
}

 

EWF_Disable.cpp


#include "stdafx.h"
#include "windows.h"

int _tmain(int argc, _TCHAR* argv[])
{
wprintf(L"show EWF status\n");
system( "cd c:\\windows\\system32");
system( "ewfmgr.exe c: -commitanddisable");
system( "shutdown /r /t 0");
return 0;
}

 

arrow
arrow

    ooieueioo 發表在 痞客邦 留言(0) 人氣()