473,659 Members | 2,646 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CreateProcess problems in vb.NET (only experts need apply ;-)

Hi All :)

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

lngReply = CreateProcess(s Null, 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(s Null, 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\note pad.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_Attr ibutes' structures, which I have defined
thus:

Structure SECURITY_ATTRIB UTES
Dim nLength As Integer
Dim lpSecurityDescr iptor 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.
Nov 20 '05 #1
2 2010
* "Paul Schenk" <pa*@rttracking .com> scripsit:
[...]

See reply in the upgrade group. Please don't multipost.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2
"Herfried K. Wagner

See reply in the upgrade group. Please don't multipost.


That is the only answer the only "Expert" in this newsgroup can give.

:-)

Cor
Nov 20 '05 #3

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

Similar topics

2
4997
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 figure out, how to get the pipes working. My app either deadlocks or displays the error messag: .... print win32file.ReadFile(readStdOut,10) pywintypes.error: (109, 'ReadFile', 'The pipe has been ended.')
0
2044
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, 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)
1
1975
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 excuting a process with createprocess. I dont know if its the fact that VB.NET doesnt support null terminated strings, or if its createprocess that is creating the problem. I need example code, executing an console/dos exe, in its own environment...
14
2316
by: Jim Hubbard | last post by:
Are you up to speed on the difficulties in using the 1.1 .Net framework? Not if you are unaware of the 1,596 issues listed at KBAlertz (http://www.kbalertz.com/technology_3.aspx). If you are going to use .Net......I highly recommend signing up for the free KBAlertz newsletter at http://www.kbalertz.com/default.aspx. Looking at all of the errors and quirks sometimes makes me wonder if this thing is really ready for prime time.
7
2095
by: Grant | last post by:
Ok I have XP Pro and recently upgraded to SP2 but after doing so one of my favorite webpages to check daily does not respond the same as before. It used to be (pre SP2) that I could when visiting this page http://facs.scripps.edu/surf/buoylist.html When I ran my mouse over the green CDIP buoys that it would not only show the current data in the upper part of the summary, but if I clicked on the Dana Point green bar for instance it would...
3
3462
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, sizeof(sa) );
5
7936
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 MyProcess as new Process - MyProcess.Start This is my code wich i transalated from Vb6 to Vb.Net: <StructLayout(LayoutKind.Explicit, _ charset:=charset.auto)> _ Public Structure STARTUPINFO Public cb As Short
1
10837
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 calling line. Please provide some input. CODE ==== Structure STARTUPINFO Public cb As Long
6
4108
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 say I want to create a process from an array of bytes or memory stream containing the executable data cause I want to prevent my program executable module from being stolen..
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8339
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8751
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8629
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4338
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1982
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1739
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.