By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,953 Members | 1,668 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,953 IT Pros & Developers. It's quick & easy.

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

P: n/a
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&, 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.
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
* "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

P: n/a
"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 discussion thread is closed

Replies have been disabled for this discussion.