Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running a VBScript from an NT Service

Status
Not open for further replies.

EzehM

Programmer
Feb 27, 2003
86
GB
I will like to be able to call a VBScript from an NT Service. The path of the VBScript will be stored in the registry, and I will like to read the registry, get the path of the script and call the vbs file from a function in my NT Service. Please can any one help?

This is my code so far:

BOOL CMyService::OnInit()
{
// Read the registry parameters
// Try opening the registry and getting key:
// HKEY_LOCAL_MACHINE\SOFTWARE\ICL\FTMS\GiroBank\ProcessCtr
HKEY hkey;



if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
"SOFTWARE\\ICL\\FTMS\\Push1\\GiroBank\\ProcessCtrl",
0,
KEY_QUERY_VALUE,
&hkey) == ERROR_SUCCESS) {
// Yes we are installed
DWORD dwType = 0;
DWORD dwSize = sizeof(m_iScriptParam);
RegQueryValueEx(hkey,
"Script",
NULL,
&dwType,
(BYTE*)&m_iScriptParam,
&dwSize);
dwSize = sizeof(m_iIncParam);
RegQueryValueEx(hkey,
"Inc",
NULL,
&dwType,
(BYTE*)&m_iIncParam,
&dwSize);
RegCloseKey(hkey);
}
else
DebugMsg("Something is wrong");




return TRUE;
}

void CMyService::Run()
{
//while (m_bIsRunning) {

// THIS IS WHERE I WANT TO EXECUTE THE SCRIPT ONCE}
}

Thanks in advance
 
just do it, if you have problems, put there exactly the description of your problem.

Ion Filipski
1c.bmp

ICQ: 95034075
AIM: IonFilipski
filipski@excite.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top