Etantonio Electronic
Welcome to the forum.
Username:
Password:
Save Password


Register
Select Language

Forgot your Password?
 
Active Topics | Active Polls | Members | Online Users | Avatar Legend | Search
Select Skin: 
 All Forums
 Informatics
 Others
 hProcess coming back from ShellExecuteEx always 0
   All users can post NEW topics in this forum
   All users can reply to topics in this forum
Rating is not allowed for this topic.
 Printer Friendly
Author  Topic   

etantonio

Status: offline

 Posted - 11/26/2005 :  14:26:15  Show Profile  Visit etantonio's Homepage  Add etantonio to Buddylist
Buongiorno,
my problem is that hProcess coming back from ShellExecuteEx is always
0
while I need the process id, where's the error???


Thanks


//////////////////////////////////////////////////////////////////


Dim ret As Integer
ret = Naviga(txtFileName.Text, Me.Handle.ToInt32)
AppActivate(ret)


//////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////


Option Strict Off
Option Explicit On
Module modPropertiesDlg


' API type declaration.
Private Structure SHELLEXECUTEINFO
Dim cbSize As Integer
Dim fMask As Integer
Dim hWnd As Integer
Dim lpVerb As String
Dim lpFile As String
Dim lpParameters As String
Dim lpDirectory As String
Dim nShow As Integer
Dim hInstApp As Integer
Dim lpIDList As Integer
Dim lpClass As String
Dim hkeyClass As Integer
Dim dwHotKey As Integer
Dim hIcon As Integer
Dim hProcess As Integer
End Structure


' API constants declaration.
Private Const SEE_MASK_INVOKEIDLIST As Short = &HCs
Private Const SEE_MASK_NOCLOSEPROCESS As Short = &H40s
Private Const SEE_MASK_FLAG_NO_UI As Short = &H400s


' API function declaration.


Private Declare Function ShellExecuteEx Lib "shell32.dll" (ByRef SEI
As SHELLEXECUTEINFO) As Integer


Public Function Naviga(ByVal FileName As String, ByVal OwnerhWnd
As Integer) As Integer
Dim SEI As SHELLEXECUTEINFO
' Fill in the SHELLEXECUTEINFO structure.
With SEI
.cbSize = Len(SEI)
.fMask = SEE_MASK_NOCLOSEPROCESS
.hWnd = OwnerhWnd
.lpVerb = "open"
.lpFile =
"http://care.ised.it/CARE_WebAdmin/FrontEnd?r=/_index.jsp"
.lpParameters = vbNullChar
.lpDirectory = vbNullChar
.nShow = 2 'SW_SHOWMINIMIZED
.hInstApp = 0
.lpIDList = 0
.hProcess = -1
End With
' Call the API function.
If (ShellExecuteEx(SEI) = 0) Then
' Error, return 0 as instance handle.
Naviga = 0
Else
' Return the instance handle as result.
Naviga = SEI.hProcess
End If
End Function
End Module
/////////////////////////////////////////////////////////////////

Why not ?!?

 Country: Italy  ~  Posts: 26  ~  Member Since: 10/21/2005  ~  Last Visit: 11/17/2008 Alert Moderator 

Scorpio

Status: offline

 Posted - 11/26/2005 :  14:39:35  Show Profile  Add Scorpio to Buddylist
First of all, your taking the wrong approch for an obviously VB.NET program.
You should simply dump the call to ShellExecuteEx and use the
System.Diagnostics.Process class to launch your document.

Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)
Handles Button1.Click


Process.Start("http://care.ised.it/CARE_WebAdmin/FrontEnd?r=/_index.jsp")
End Sub


If you need the process id and all that, you can create an instance of the
Process class and use that to launch your application. You can get all
kinds of other info as well as wait on the process etc. Check the
documentation for further details...


As for your original problem, well I suspect the problem is with your
declaration of the SHELLEXECUTEINFO structure, but it is pretty hard to tell
without seeing it...


Scorpio

 Country: Norway  ~  Posts: 3  ~  Member Since: 11/26/2005  ~  Last Visit: 02/12/2007 Alert Moderator  Go To Top Of Page

Trenton23023

Status: offline

 Posted - 01/03/2006 :  03:58:44  Show Profile  Visit Trenton23023's Homepage  Add Trenton23023 to Buddylist
Originally posted by etantonio

nShow = 2 'SW_SHOWMINIMIZED .


Can "showminimized" be real?

[url="http://www.local-hostels.info/ile-de-france-paris-hostels.html"]Paris Hostels
[/url] - [url="http://holdem-online-casino-abc.p-r-w.com"]casino reviews[/url]

 Country: Austria  ~  Posts: 5  ~  Member Since: 01/03/2006  ~  Last Visit: 01/03/2006 Alert Moderator  Go To Top Of Page
   Topic   
 Printer Friendly
Jump To:
 Image Forums 2001 This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000