VB.NET - ActiveX Component
Asked By vinayaga moorthi A
02-Feb-10 07:33 AM

when call this vb script function in body on load event it display the error
Activex Component object can't created 'GetObject'
My Code
<
html xmlns="http://www.w3.org/1999/xhtml" >
<
head runat="server">
<
script type="text/vbscript">
Function greeting()
strComputer =
"."
Set objWMIService = GetObject(
"winmgmts:" _
&
"{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colServiceList = objWMIService.ExecQuery _
(
"Select * from Win32_Service where Name='Spooler'")
For each objService
in colServiceList
errReturn = objService.StopService()
Set FileList = objWMIService.ExecQuery(
"ASSOCIATORS OF {Win32_Directory.Name='C:\Windows\system32\spool\printers'} Where " & "ResultClass = CIM_DataFile")
For Each objFile In FileList
objFile.Delete
Next
Next
Set colServiceList = objWMIService.ExecQuery _
(
"Select * from Win32_Service where Name='Spooler'")
For each objService
in colServiceList
errReturn = objService.StartService()
Next
//WScript.Echo ("Script Complete")
End Function
</
script>
<title>Untitled Page</title>
</
head>
<
body onload=greeting()>
<form id="form1" runat="server">
<div>
<asp:Button ID="Print" runat="server" Text="Print" />
<asp:Button ID="Clear" runat="server" Text="Clear" /></div>
</form>
</
body>
</
html>
Sakshi a replied to vinayaga moorthi A
see the Microsoft solution http://msdn.microsoft.com/en-us/library/aa231060(VS.60).aspx and one more also see http://www.pcreview.co.uk/forums/thread-531766.php.
regards,
http://www.codecollege.net
alot var Hi What are Master Pages in ASP.NET? or What is a Master Page? ASP.NET master pages allow you to create a consistent layout for the pages in your application. A single master page defines the look and feel and standard behavior that you want for all of the you want to display. When users request the content pages, they merge with the master page to produce output that combines the layout of the master page with the content from the content page. What are the 2 important parts of a master page? The following are the 2 important parts of a master page 1. The Master Page itself 2. One or more Content Pages Can Master Pages be nested? Yes, Master Pages
types? (B) What is concept of Boxing and Unboxing ? (B) What is the difference between VB.NET and C#? (I) what is the difference between System exceptions and Application exceptions? (I)What using cache object of ASP.NET? (B) How can you cache different version of same page using ASP.NET cache object? (A) How will implement Page Fragment Caching? (B) Can you compare ASP.NET sessions with classic ASP? (B) Which are of using Query Strings? (I) What is Absolute and Sliding expiration? (I) What is cross page posting? 93 (I) How do we access viewstate value of this page in the next page ? (I) Can we post and access view state in another application? (I) What is SQL are different properties provided by Object-oriented systems? (B) How can we achieve inheritance in VB.NET? (I) what are abstract classes? (B) What is a Interface? (A) What is difference
Difference between vb and vb.net Hai, I want to know about the main difference between vb and vb.net. • The greatest change in VB6 and VB.NET is of runtime environment. VB6 used the VB-Runtime while VB.NET uses the .Net Common Language Runtime (.Net CLR). The CLR is much better designed and
Differences for vb.net and c# with Example Dear all Differences for vb.net and c# with Example., plz give the solutions Thanks to all Hi See the bellow comparission :: This comparission is with syntax and example. . . Comments VB.NET 'Single line only Rem Single line only C# / / Single line / * Multiple line * / / / / XML comments on single line / * * XML comments on multiple lines * / Program Structure VB.NET Imports System Namespace MyNameSpace Class HelloWorld 'Entry point which delegates to C-style main Private
Printer Queue Hai, I'm working in vb.net webapplication.My Requirment is IF ANYJOB ARE PENDING IN QUEUE THAT IS IN PRINTER, I WANT DELETE THE THROUGH THE VB.NET CODE . Please any one help me , Immediatly Thanks Hi Morthi, You can dowload a code daniweb.com / forums / thread78751.html Ok. . . . . you can also use this vb script strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel = impersonate}! \ " & strComputer & " \ root \ cimv2") Set colInstalledPrinters = objWMIService.ExecQuery _ ("Select * from Win32_Printer Where Name = 'HP QuietJet'") For Each objPrinter in colInstalledPrinters objPrinter.CancelAllJobs() Next in VB.NET show this link http: / / www.webtropy.com / articles / wmi.asp?wmi = Win32_Printer call the