C# - Fixing CA2122 With Process.Start

Mar 15, 2012

In an application we can output a report as a csv file and load it up similar to the following code:

Process.Start("C:MyReport.csv") ' Not real path

When running code analysis it produces the following error:

CA2122 Do not indirectly expose methods with link demands 'Form.Function(Definition)' calls into 'Process.Start(String)' which has a LinkDemand. By making this call, 'Process.Start(String)' is indirectly exposed to user code

I have seen somewhere to mark the assembly with the SecurityTransparentAttribute, does this just suppress the message? If so this is not what I would like. Is there another way of opening the file that would circumvent this message without suppressing it? I would ideally like to avoid Excel automation if I can as Excel is not used anywhere else at the moment.

View 1 Replies


ADVERTISEMENT

Process.Start To Start An External Command Line Application

Aug 4, 2009

I'm using Process.Start to start an external command line application and using the StartInfo.Arguments method to send parameters to the application. I imagine I'll need to use a loop... but I can't figure out exactly how yet.I need to send anywhere from 1 - an infinite number of files names to this application. Each file has to be sent one after the other. So once the first one is done, I need to loop back around and past the second one.I can probably use the Directory.GetFiles method to get all of the files, but I don't know how to assign them.

View 7 Replies

Use Process.Start To Start An Application Without Administrator Privileges On Windows 7

Feb 24, 2012

Visual Basic 2010 - Net Framework 4.0 Client

I have an application (application #1) running with Administrator privileges on Windows 7.

I want application # 1 to start another application (application #2) without Administrator privileges so application #2 is running as a standard user.

Is there a way to do this? I have been using Process.Start.

View 5 Replies

VS 2010 Unable To Start Specific Command With Process.start

Jun 18, 2011

Here's what I currently have:

[Code]...

I've commented out various things to limit it to specifically this command (example, I can swap mklink out with notepad and it works fine). The command runs fine from a DOS window, but can't be found when I use it this way. I also tried using the SHELL command just to test and I get the same results. No idea why it can't be found, as like I said it executes from the command prompt just fine.

View 2 Replies

OSK Process Start/stop - PID.Kill() Fails Because It Says The Process Already Exited

Sep 28, 2010

My app starts an On-Screen Keyboard process like this:

Dim PID as System.Diagnostics.Process
:
PID = Process.Start("C:WindowsSystem32osk.exe")
:

[CODE]...

It seems to work 90% of the time. However, sometimes the PID.Kill() fails because it says the process already exited. At this point the OSK is always still there on screen. Yes, I know my code should be testing to see if the process is still running before trying to kill it, but given that the OSK is still on screen..

View 10 Replies

Process.start() Freezes Main Program Until Process Finishes?

Feb 21, 2011

I have a program that starts another program after setting the regkeys basically the program continually syncs the calandar of outlook and another application.I set the regkeys than launch the c:sync.exe app. I have tried a simple process.start and launching the process as a thread and they both do the same thing: The other process starts and works as it should but my main program goes "White screen" or "not responding" until the process.start has exited.

I want the process.start to run in the background so if users click in my main app it responds and truly that they can access the context menu of my main app from the taskbar while the process.start is running.

View 5 Replies

VS 2008 If Process Is Running Give Focus, If Not Start Process?

May 27, 2010

Trying to create a button that when clicked will check to see if a certain process image is running and if that process is running give the process focus. If the process is not running then start the application.

View 9 Replies

VS 2008 Process.Start Error Starting Process?

Aug 8, 2010

Whats happening is I run the code below and get the following error "The system cannot find the file specified". I've read that with UseShellExecute set to false that you can't use WorkingDirectory.

Dim Password As String = "password"
Dim SecureStringPassword As New System.Security.SecureString
For Each c As Char In Password

[Code].....

View 8 Replies

C# - Start New Process, Without Being A Child Of The Spawning Process

Dec 8, 2011

How would I go about starting a new process without it being the child of the calling process.

Example:

Main Program (Caller.exe)
process.start("file.exe")

View 3 Replies

Use System.Diagnostics.Process.Start To Run A Process?

Jun 24, 2009

i use System.Diagnostics.Process.Start to run a process

example :

Dim p As New System.Diagnostics.Process
p = System.Diagnostics.Process.Start("D:ProjectApplication.exe")

it works perfectly during run time. but after i deploy to server.... this code did nothing, it did not call out this process

View 1 Replies

Process.Start - Set Start In Directory?

Feb 8, 2012

I am writing an application that in the end needs to execute another executable at some point, the problem is that the executable has dependencies in the directory it runs in that are required to operate. When I use the Process.Start to run the executable it errors out because it's looking for the dependencies in my applications directory.

I tried the startInfo.WorkingDirectory option but that didn't seem to do it either (not sure if I did it right) - here is how I used that:

Process.Start("my.exe").StartInfo.WorkingDirectory = "C:Test"For the life of me I cannot find how to set the "Start In" directory. I looked everywhere, so unless it's under a different name, I'm at a loss.

View 3 Replies

C# - Kill Process Started With System.Diagnostic.Process.Start("FileName")

Oct 2, 2010

I am trying to create an app that will perform actions on specific times (much like the Windows Task Scheduler). I am currently using Process.Start() to lunch the file (or exe) required by the task. I am initiating a process by calling a file (an .mp3) and the process starts WMP (since it is the default application), so far so good. Now I wan't to kill that process. I know that it is normal behavior for the Process.Start(string, string) to return nothing (null in C#) in this case. So I am asking how can i close WMP when I called it through Process.Start(string, string)??

[Code]...

View 6 Replies

Use System.diagnostics.process.start("Process.exe")?

Jan 12, 2010

Is it possible to use system.diagnostics.process.start("Process.exe")But the process would not be seen by the user? For example, I want to play an audio in the background using windows media player, the audio will play but wmp won't be visible. Is it possible?

View 1 Replies

How To Start Process From URL

Jan 10, 2009

How To Start Process From URL

View 9 Replies

.net - Process.Start Not Starting?

May 24, 2011

I'm trying to execute a 3rd party application, called from a .cmd batch file, called from a self-hosted WCF service. Like this:

WCF --> .cmd --> 3rd party app

For whatever reason, using the Shell command doesn't work fully. It will call the .cmd file, but the 3rd party app won't kick off (I know the .cmd is firing because I have before/after ECHO statements populating a log file). If I double-click the .cmd file from explorer, the 3rd party app will start just fine. So, I figured, maybe try something besides the Shell command from my WCF service.

So I tried the following code, but it won't kick off the .cmd file at all (echo statements not firing). What am I missing here?

Dim psi As New ProcessStartInfo("cmd.exe", "/C " & System.Configuration.ConfigurationManager.AppSettings("ExStream_CMD_File_Path"))
Dim proc As New Process()
proc.StartInfo = psi
proc.Start()
proc.WaitForExit()

The path in the app.config file is valid (just double-checked). Is there anything wrong with the above code?

View 1 Replies

Hook For Process Start?

Feb 10, 2010

Is there any way I can install a global hook or something else on the start of external process. WH_CBT hook, as it appears can only intercept events for processes that have windows, but what if I want to intercept the start/stop of a windowless application or a windows service? Is there any way to do it using .NET?Generally, I want my application to receive a notification of some process being launched knowing only an executable name.Presently I simply use a timer to iterate through running processes, but I wonder if there a better way to do it?

View 4 Replies

How To Start A Process And Wait

Mar 10, 2009

I know how to launch a file or executable in VB .NET 2005. The file will launch and execution in the code continues immediately.

Process.Start("MyProg.exe")

But what if I need to start the program, wait until it finishes executing, read the exit code that it sends back, and take some action based upon the action code? How do I do that?

View 2 Replies

How To Start A Process Via A Stream

Apr 4, 2010

Is it possible to start a process by passing a stream instead of passing a FilePath?

View 9 Replies

How To Start A Separate Process

Jan 20, 2009

ok i figured out how to call a different program but i have like 7 things here and i dont know what one to use.....i want to click a button and another program shows up.

first off is this right.
system.diagnostics.process.start()
then my folder path thing is

[code].....

View 2 Replies

Process.Start And Windows 7

Feb 14, 2011

I am trying to run a process started with the following VB statement.

The process will start fine with the proper admin ID that I specify. I have verified this by starting a CMD shell and batch files. They all show the user is my local admin account. However, if I try to run defrag or chkdsk, both commands tell me that I do not have authority to run them. Even though the processes are running under the admin account (shown by Task Manager).

The program is compiled on a Win XP SP3 machine (32-bit) using VB Express 2010. The executable seems to work fine on XP. But when I copy the .EXE file that it generates to my Windows 7 64-bit system, I get the above problem about it not having authority to run these two utilities.

View 4 Replies

Process.Start Does Not Work

Jun 3, 2011

I cannot get process.start work now. I have tried wrapping it as a call outside of my class, but it doesn't matter...it does absolutely nothing.No error msgbox either...

Heres my code
Private Sub mnuWizard_Click(ByVal Ctrl As Microsoft.Expression.Web.Interop.Legacy.CommandBarButton, ByRef CancelDefault As Boolean) Handles mnuWizard.Click
''''''''''''''''''''''''''''''''''''
'Handles Wizard Click Event

[code]....

View 1 Replies

Process.Start Files In DGV?

Mar 16, 2012

I am importing filenames into a DGV:

If FolderBrowserDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
Dim myFileDir = New System.IO.DirectoryInfo(FolderBrowserDialog1.SelectedPath)
For Each myFiles As System.IO.FileInf

[code]....

View 5 Replies

Run Process.Start On A Server?

Aug 18, 2010

I attempt to start MSAccess on the server with a command line using system.diagnostics.process.start. MSAccess should start, runs a report and then shuts down.

View 1 Replies

Start A Process When Application Run?

Jun 4, 2011

I want to add a process to my application, the process should be started to listen some events when the application run. I searched in Internet, and I didn't find answers... Some people said that could use "Application.Run", but I didn't find this function in VB.NET project.

View 1 Replies

Start Dll As Separate Process?

Oct 13, 2009

I build a class library (dll) with a form in it. Now i start the dll : Dim myDLL As New ClassLibrary1.MyFirstDLL(). The problem is that this dll starts but not as a separate proces i also dont see it in the taskmanager. what i see is that when i start the dll from my program, my program start using more cpu/memory. The whole idea behind a dll is that it dont consume memory of the process that calls it. So how can i start the dll as a new separate proces but still be able to send variables to this dll. (i also created a whole new proces but then i can not send variables to it)

View 12 Replies

Vb.net - Why Doesn't This Process Start

Nov 21, 2010

I'm trying to start the process Store.Client.UI.exe which is located at: "C:Program FilesIntelIntelAppStoreinStore.Client.UI.exe", or "C:Program Files (x86)IntelIntelAppStoreinStore.Client.UI.exe" for 64bit like me, so I use the code:

If My.Settings.instpathtype = 86 Then
Process.Start("C:Program FilesIntelIntelAppStoreinStore.Client.UI.exe")
Else
Process.Start("C:Program Files (x86)IntelIntelAppStoreinStore.Client.UI.exe")
End If

Where my.settings.instpathtype is whether the computer is 64 or 32 bit. But when I run it, it doesn't run Store.Client.UI.exe for some reason. When I go into Explorer and type "C:Program Files(x86)IntelIntelAppStoreinStore.Client.UI.exe" it runs Store.Client.UI.exe.

View 3 Replies

Wait For Process To Start?

Apr 9, 2010

I'd like to have a function in my program that waits for a process to start, and once it does, it executes the code. Id like to have a form of 'buttonless messages box' or 'splash screen' waiting saying "waiting for process to start..." and once the process starts, a message box will pop up saying "Process has started!".

I was thinking of having a timer with a low delay constantly looping to see if the process exists, but that would be a little rough on the processor, no? Also, how would I accomplish the 'buttonless messagebox' that automatically closes once the process is found?

View 5 Replies

Waiting For Process To Start?

May 5, 2009

I have a problem with an App I am writing that lists information about various media on your computer and lets you launch it right from the app. My problem is, when launching an intensive process, like a game for instance, it is desirable to shut down the app to not hog precious resources. Here is the code i have so far...

[Code]...

This code works fine, but for one small detail. The app exits before the desired process starts, thus cancelling out the process all together. My question is, how do I get the app to wait for the process to start before exiting?

View 3 Replies

Watch If New Process Start?

May 27, 2010

Is there a way to get info like process name of started program, so if i start internet exp. it will detected it and get like iexplorer.

View 9 Replies

Specify What Folder To Start "process.start" In?

Jun 11, 2011

I have the following code:

process.start(apppath)

Apppath is always a valid application path. (Eg, C:\hi.exe)My issue is, that it starts the specified exe in the location of my vbnet program. Not the program folder specified.I want �hi.exe� to be ran in �c:\�. Not in �C:\vbnetapplicationfolder\bin\�\ So how do I do that?

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved