|
Well, that memory error might have something to do with it. It appears you've run the machine out of memory. WHat are you doing that's allocating so much memory?
|
|
|
|
|
thanks for your reply Dave..
i just retrieving so much data from database..maybe my local machine cant handle it thats why it raised that error.. but when i put my app in pur server, i dont encounter that error.
jyn
|
|
|
|
|
How much RAM is in the server compared to the workstation??
|
|
|
|
|
Does anybody know if there is a way to Shutdown a computer without using CMD. I know that you can use
System.Diagnostics.Process.Start("ShutDown", "/s")
and C:\>shutdown but both of these use CMD where the user that is going to be using this program has CMD and batch disabled. If there isn't another way to do this then could you please tell me how to run a batch file as another user.
Thanks for your help in advance!
modified 8-Sep-21 21:01pm.
|
|
|
|
|
You're looking for ExitWindowsEx[^]. The user running the code, of course, has to have the permission to shutdown the machine though.
|
|
|
|
|
Ok I have figured out how to install an LPR port like so : (using the shell command of course)
Code:
Cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prnport.vbs -a -r CSE-ATLAB-BWQ -h at-cetus.ad.ufl.edu -o lpr -q CSE-ATLAB-BWQ
rundll32 printui.dll, PrintUIEntry /if /b "test_1" /f "%SYSTEMDRIVE%\7760.inf" /q /r "CSE-211-CLQ" /m "Xerox Phaser 7760GX PS" /z /u
Now the issue is when I do a check for it to be installed or already installed I do:
Code:
Cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prnport.vbs -l -r CSE-211-CLQ
The issue is that the above command shows all the ports, not just the one that I am looking for. and If I get that working, how on earth to I trap the output and
get a specific word that would show that it is installed out of:
Server name
Port name CSE-211-CLQ
Host address at-cetus.ad.ufl.edu
Protocol LPR
Queue cse-211-clq
Byte Count Disabled
SNMP Disabled
How do I accomplish this??
Also How do I use the shell commands in the background worker?
|
|
|
|
|
The easiest way would be to change the command line to pipe the output to a file, then read the file and process it.
Cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prnport.vbs -l -r CSE-211-CLQ > filepath
As for launching those commands, it doesn't matter it it's launched from a background thread or not. The process you launch will get it's own process space and it's own threads.
|
|
|
|
|
The problem is that the shell commands never get ran it seems. When I type it in the command prompt it works fine, but when I:
Shell("Cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\Prnport.vbs -a -r CSE-ATLAB-BWQ -h at-cetus.ad.ufl.edu -o lpr -q CSE-ATLAB-BWQ")
It never runs. Did I use the wrong command?
|
|
|
|
|
Look into the Process class and it's Start method.
|
|
|
|
|
Process.Start("Cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\prnport.vbs -a -r CSE-211-CLQ -h at-cetus.ad.ufl.edu -o lpr -q cse-211-clq")
The above doesn't execute. Nothing else after it gets run either. When I do a Process.Start("Iexplorer.exe") it runs. What am I doing wrong? Does it help that I am running 2 shell commands per printer for 18 printers?
|
|
|
|
|
Trey5498 wrote: The above doesn't execute. Nothing else after it gets run either
It appears youre thread quit for an unexpected reason or it threw an exception that you ate and ignored.
Trey5498 wrote: What am I doing wrong?
I have no idea without seeing the code that setups up the thread and the code it's running.
|
|
|
|
|
Imports Microsoft.Win32
Public Class prnProcessing
Dim x As New System.Diagnostics.Process
Public arrInstalled As New ArrayList()
Dim WithEvents ToDoWork As New System.ComponentModel.BackgroundWorker
Public Sub prnProcessing_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If prnSelection.arrToInstall.Count > 0 Then
'added 10-2-08
prnProgress.Style = ProgressBarStyle.Continuous
'prnProgress.Dock = DockStyle.Bottom
prnProgress.Visible = False
prnProgress.Minimum = 1
prnProgress.Maximum = prnSelection.arrToInstall.Count
'end add 10-2-08
ToDoWork.WorkerReportsProgress = True
ToDoWork.WorkerSupportsCancellation = True
ToDoWork.RunWorkerAsync(prnSelection.arrToInstall)
Me.CenterToScreen()
Else
MsgBox("There are no printers to install. Please choose the printers you wish to install.")
prnSelection.Show()
Me.Close()
End If
End Sub
Public Sub ToDoWork_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles ToDoWork.DoWork
Dim worker As System.ComponentModel.BackgroundWorker = CType(sender, System.ComponentModel.BackgroundWorker)
If e.Argument IsNot Nothing AndAlso TypeOf (e.Argument) Is ArrayList Then
Dim arrToInstall As ArrayList = e.Argument
If arrToInstall.Count > 0 Then
Dim i As Integer = 1
For Each printer As String In arrToInstall
CallByName(Me, printer, CallType.Method)
worker.ReportProgress(i)
i += 1
System.Threading.Thread.Sleep(200)
Next
End If
End If
End Sub
Public Sub ToDoWork_ProgressChanged(ByVal sender As Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs) Handles ToDoWork.ProgressChanged
prnProgress.Visible = True
prnProgress.Value = e.ProgressPercentage
End Sub
Public Sub PrinterProgress(ByVal i As Integer, ByVal worker As System.ComponentModel.BackgroundWorker, ByVal e As System.ComponentModel.DoWorkEventArgs)
worker.ReportProgress(i)
End Sub
Public Sub ToDoWork_EndProgress() Handles ToDoWork.RunWorkerCompleted
ToDoWork.Dispose()
prnWrapup.Show()
Me.Close()
End Sub
Public Sub CSE211CLQ()
'Added on 10/27/2008
Process.Start("cmd", "Cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\prnport.vbs -a -r CSE-211-CLQ -h at-cetus.ad.ufl.edu -o lpr -q cse-211-clq")
Process.Start("cmd", "rundll32 printui.dll, PrintUIEntry /if /b ""CSE-211-CLQ"" /f ""C:\7760.inf"" /q /r ""CSE-211-CLQ"" /m ""Xerox Phaser 7760GX PS"" /z /u")
arrInstalled.Add("CSE-211-CLQ")
'end Added on 10/27/2008
'for test purposes
MsgBox("CSE-211-CLQ Installed", vbOK)
End Sub
End Class
Here is the form that contains the BGworker and Dos commands. I truncated the printers to one so that it wont be spam. I added the "cmd" to see if that would make a difference and it still doesnt work, however the command prompt pops up and everything else executes, just not the adding of the printer/port.
|
|
|
|
|
Utter spaghetti. There's stuff that there's no definitions for. Example: What's prnSelection.arrToInstall ? Where is it defined? How is it getting passed to this code, ...
And what's with this CallByName garbage?? Don't. Just put the printer names and the two command lines you need to run for them into an array and you can loop through building the command lines and launching them from that. If you think you need to use CallByName, you really need to rethink your design.
You may also want to look into changing the Process.Start commands. The .exe to run would be "Cscript" and "rundll32", not "cmd".
|
|
|
|
|
there are 4 forms in this project
(form 1) prnSelections - Has 18 checkboxes so the user can select what they wish and ONLY install those.
arrToInstall is an arraylist that is filled when the check boxes are check upon clicking the next button
(form 2) prnOverView - Doesn't show up here as it is just the middle man for the user to make sure of the printers
(form 3) prnProcessing - which installs the printers.
(form 4) prnWrapup - Another form just to show which have successfully been installed hince the reason I was looking for an easy way to check the port/printer has been created so I do not attempt to install it more than once.
CallByName is used to call the installation function because printer is the value of that particular spot in the arraylist.
I tried without the BGworker before, however the progressbar would not get filled as that is what I need.
I hope this clears up a few things of what I am trying to accomplish.
and do you mean Process.Start("Cscript.exe %WINDIR%\System32\Printing_Admin_Scripts\en-US\prnport.vbs -a -r CSE-211-CLQ -h at-cetus.ad.ufl.edu -o lpr -q cse-211-clq") ?
modified on Wednesday, October 29, 2008 10:07 AM
|
|
|
|
|
Trey5498 wrote: Process.Start("Cscript.exe %WINDIR%\System32\Printing_Admin_Scripts\en-US\prnport.vbs -a -r CSE-211-CLQ -h at-cetus.ad.ufl.edu -o lpr -q cse-211-clq")
No, I mean:
Process.Start("cscript.exe", """%WINDIR%\System32\Printing_Admin_Scripts\en-US\prnport.vbs"" -a -r CSE-211-CLQ -h at-cetus.ad.ufl.edu -o lpr -q cse-211-clq")
|
|
|
|
|
it brought up the cmd prompt quick, then went away and still never installed the port/printer. Here is what I changed it to:
Process.Start("Cscript.exe", """%WINDIR%\System32\Printing_Admin_Scripts\en-US\prnport.vbs"" -a -r CSE-211-CLQ -h at-cetus.ad.ufl.edu -o lpr -q cse-211-clq")
Process.Start("rundll32.exe", "printui.dll, PrintUIEntry /if /b ""CSE-211-CLQ"" /f ""C:\7760.inf"" /q /r ""CSE-211-CLQ"" /m ""Xerox Phaser 7760GX PS"" /z /u")
It is like it just ignores the arguments completely! I am using VS 2008 if that helps
|
|
|
|
|
I have a vb.net application, In which the use of MS ScriptControl invoke Perl app.
e.g:
-------------------------------------------
DIM MSS AS NEW SCRIPTCONTROL
MSS.Language = "PerlScript"
MSS.Reset()
MSS.AllowUI = False
MSS.UseSafeSubset = False
MSS.AddCode("Test")
////////////////////////////
PERL APP.
sub Test(){
$a=1;
$b=2;
$c=$a+$b;
print("This is a test!!!\n");
return $c;
}
------------------------------------------
This program can run normally, But I want perl app. print out the data!
How do i do?
|
|
|
|
|
I have no idea since I've never used the MSScript control. But, this line: MSS.AllowUI = False , looks like it may prevent you from doing what you want.
|
|
|
|
|
OK ,i'll try it again.
Thank you proposal
|
|
|
|
|
Hi guys
I am getting the following warning .
"Found conflict between the different versions of the same assembly"
any help
thanks in advance
hello
|
|
|
|
|
Google results for ""Found conflict between the different versions of the same assembly"[^]".
Basically, you have two parts of your solution that refer to the same assembly, but where setup using different versions of that assembly. If your familiar with ILDASM, you can use that to see which assemblies you're referencing are using different versions. But, in the end, you're just going to end up recompiling the dependant assemblies and your projects that use them.
|
|
|
|
|
Hi All,
I am using Enteprise Library Data Access Application Block (v 3.0 April 2007) in my application.I want to encrypt the App.config file. I have tried the bulit-in RSA and Data encryption metods in Data Access Application block.
It seemed that the user account who creates the encryption key only has the key to decrypt it. That means it's machine dependant.
Eg. If i encrypt the config file in my machine my collegue can't decrypt it in his machine. Is there any way that we can encrypt the file using a public key which is accessible to the other developers in the team? Can anybody suggest me a way to overcome this issue?
Thanx in advance,
Dinesh
|
|
|
|
|
The way I've gotten around this is to not ship an encrypted app.config. You encrypt the app.config using a custom action in the installer project. This encrypts the app.config file when the application is installed on the target machine.
|
|
|
|
|
I end up creating my own encryption routine to encrypt the data prior to getting written to the config. The key is skewed and the code is obfuscated for better protection; our apps are used by our internal employees only.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
I just want to test first if my code is running so i rewrite everything and created a simple insert command, but it wasn't working right. When i update my adapter i had an error"syntax error in insert into" i don't know what code to edit or did i miss something?
please help. thanks.
Try
Dim myConnection As New OleDb.OleDbConnection
Dim myAdapter As New OleDb.OleDbDataAdapter
myConnection.ConnectionString = "Provider= Microsoft.Jet.OLEDB.4.0; Data
Source=C:\Desktop\vbnet\biblio.mdb"
myAdapter = New OleDb.OleDbDataAdapter("Select * from Titles", myConnection)
Dim ds As DataSet = New DataSet
Dim dr As DataRow
Dim drCommandBuilder As OleDb.OleDbCommandBuilder = New OleDb.OleDbCommandBuilder(myAdapter)
myAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey
myAdapter.Fill(ds, "Titles")
MessageBox.Show("Loaded data from Titles Table into dataset.")
myConnection.Close()
dr = ds.Tables("Titles").NewRow()
dr("ISBN") = "026"
dr("Title") = "Together Again"
dr("Year Published") = "2001"
ds.Tables("Titles").Rows.Add(dr)
MessageBox.Show("Inserted new row into Titles")
myConnection.Open()
myAdapter.Update(ds, "Titles")
MessageBox.Show("Sent update to db")
Catch Ex As Exception
Console.WriteLine("Error: " & Ex.Message)
MsgBox("Error: " & Ex.Message)
End Try
|
|
|
|