473,320 Members | 2,162 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

CreateProcess problems in vb.NET

Would be grateful of advice please. I have code in VB6 working as follows:

lngReply = CreateProcess(sNull, txtStart, ByVal 0&, ByVal 0&, 1&, _
NORMAL_PRIORITY_CLASS, ByVal 0&, sNull, sInfo, pInfo)

but alas, the 'equivelant' vb.Net code translated as:
lngReply = CreateProcess(sNull, txtStart.Text, sa, sa, 1, _
NORMAL_PRIORITY_CLASS, 0, sNull, sInfo, pInfo)
does not execute cleanly. That is, although the CreateProcess returns 'successfully', and populates the sInfo structure with valid data, the application (e.g. c:\windows\notepad.exe) 'fails during initialisation' and terminates.

The only 'meaningful' difference between the working vb6 and non-working vb.net code, is the substitution of vb6's 'As Any' Win32API declaration parameterss with 'AS Securities_Attributes' structures, which I have defined thus:

Structure SECURITY_ATTRIBUTES
Dim nLength As Integer
Dim lpSecurityDescriptor As Integer
Dim bInheritHandle As Integer
End Structure

and are passed-in called 'sa', as noted above.

Please, can someone offer either a correction for my error, or a good code example / reference for calling CreateProcess from vb.net.

NB: I need to use CreateProcess rather than the Process component that is available in the managed code, as I need to set some 'lower level' start info parameters (i.e. the lpDesktop setting), which I can only get at using the API directly :(

Many Thanks in advance,
Paul.

Jul 21 '05 #1
0 2006

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Achim Domma | last post by:
Hi, I try to start a process on windows using win32process.CreateProcess and want to to redirect the output. I set the STARTF_USESTDHANDLES flag in the STARTUPINFO structure. But I can not...
6
by: david.humpherys | last post by:
os:winnt python2.3.2 I have a exe that dumps info to the command line. I want to run this process and capture the stdout into a file. I think i'm close... any help appreciated. dh...
0
by: ByteSize | last post by:
Would be grateful of advice please. I have code in VB6 working as follows: lngReply = CreateProcess(sNull, txtStart, ByVal 0&, ByVal 0&, 1&, _ NORMAL_PRIORITY_CLASS, ByVal 0&, sNull, sInfo,...
1
by: DOT NET JIM | last post by:
in VB6 the api declares the createprocess lbEnv var as any. When converted to ..NET is change the type any to Object. The problem is, what kind of object. I can not get the env variables set when...
3
by: kal | last post by:
Hi, I am trying to write an application that will launch a second application using CreateProcess... SECURITY_ATTRIBUTES sa; STARTUPINFO si; PROCESS_INFORMATION pi; ::ZeroMemory( &sa,...
5
by: Stefano Camaiani | last post by:
Hello, please someone have the working code on how to call the CreateProcess API in Vb.Net? I need to call the CreateProcess API directly and i should not use the Vb.Net Process functions like dim...
2
by: Paul Schenk | last post by:
Hi All :) Would be grateful of advice please. I have code in VB6 working as follows: lngReply = CreateProcess(sNull, txtStart, ByVal 0&, ByVal 0&, 1&, _ NORMAL_PRIORITY_CLASS, ByVal 0&,...
1
by: Jai | last post by:
Please provide sample code for using Createprocess in VB.NET. The code I am using is given below. But I get "Error 91: Object referrence not set to an instance of the object" at CreateProcess...
6
by: ss.teo | last post by:
I want to fork a new process and my executable binary is stored inside somewhere. Is there any possible way to fork a process using CreateProcess API without writing to the disk first? Like let's...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.