Solved

Opening Url Using Shellexecute Doesn't Work On All Xp Pc's

Posted on 2004-04-08
11
754 Views
Last Modified: 2012-06-27
HELP!

I have an app that uses the following code to launch URLs:

Dim a As Long
a = ShellExecute(0, "open", "http://www.arbortech.com.au/projectplans/coffeetable/coffee.html", 0, 0, 1)

The code works fine EXCEPT ON CERTAIN XP MACHINES.  No errors, just nothing when the label is clicked.  I do not have direct access to the XP PC's as they are customer PC's.

PLEASE tell me someone has experienced this before and knows what to do!
0
Comment
Question by:computurwizard
  • 2
  • 2
  • 2
  • +3
11 Comments
 
LVL 28

Expert Comment

by:AzraSound
ID: 10784659
For some reason *.html files are not associated with their default browser??  That's the only thing I can think of.  Maybe send them a simple *.html page and see if they double-click it, if it opens up their default browser.
0
 
LVL 4

Expert Comment

by:learning_t0_pr0gram
ID: 10784843
why don't you try opening the url like this:

'Add the Microsoft Internet Transfer Controls 6.0 Component to your form

Dim IE

Private Sub Form_Load()
Set IE = CreateObject("InternetExplorer.Application")
End Sub

Private Sub Command1_Click()
IE.Navigate("http://www.arbortech.com.au/projectplans/coffeetable/coffee.html"), 1
End Sub
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 10784888
The nice thing about ShellExecute is that it uses the user's default browser, so if someone really prefers Netscape, it would use Netscape, or Opera, etc.  Using IE Automation forces the user to use IE, though, it is fairly gauranteed to work as I am not aware of Windows machines that do not have IE loaded.


>>'Add the Microsoft Internet Transfer Controls 6.0 Component to your form

Actually, the way your code is written, no reference is required since you use late-binding
0
 
LVL 5

Expert Comment

by:jayeshshah
ID: 10785223
try changing the parameters as below

ShellExecute hwnd, "OPEN", "www.google.com", vbNullString, vbNullString, 1


k'Regards

JBS
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 4

Expert Comment

by:learning_t0_pr0gram
ID: 10789218
yes, you're right Azra, i wasn't thinking.. :(
0
 

Author Comment

by:computurwizard
ID: 10794119
Oddly enough, this isn't working either.  I put the shellexecute declaration in a public module like this:

Public Declare Function ShellExecute _
Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, ByVal lpOperation _
As String, ByVal lpFile As String, ByVal _
lpParameters As String, ByVal lpDirectory _
As String, ByVal nShowCmd As Long) As Long

Do I need to put it on every form with a shellexecute hyperlink instead?
Could it be a problem where the user is missing shell32.dll?
Seems to be on only a few random PC's running XP.
0
 
LVL 6

Expert Comment

by:___XXX_X_XXX___
ID: 10796660
>>Do I need to put it on every form with a shellexecute hyperlink instead?
No, just place declaration in BAS module and declare it as public.

>>Could it be a problem where the user is missing shell32.dll?
No, shell32.dll exists on all Windows OS (except 3.x ;-])



If you can, look at the LastDllError, it can help.
Look at this:


Return Values (ShellExecute API)

If the function succeeds, the return value is the instance handle of the application that was run, or the handle of a dynamic data exchange (DDE) server application.
If the function fails, the return value is an error value that is less than or equal to 32. The following table lists these error values:

Value      Meaning
0      The operating system is out of memory or resources.
ERROR_FILE_NOT_FOUND      The specified file was not found.
ERROR_PATH_NOT_FOUND      The specified path was not found.
ERROR_BAD_FORMAT                      The .EXE file is invalid (non-Win32 .EXE or error in .EXE image).
SE_ERR_ACCESSDENIED      The operating system denied access to the specified file.
SE_ERR_ASSOCINCOMPLETE      The filename association is incomplete or invalid.
SE_ERR_DDEBUSY      The DDE transaction could not be completed because other DDE transactions were being processed.
SE_ERR_DDEFAIL      The DDE transaction failed.
SE_ERR_DDETIMEOUT      The DDE transaction could not be completed because the request timed out.
SE_ERR_DLLNOTFOUND      The specified dynamic-link library was not found.
SE_ERR_FNF      The specified file was not found.
SE_ERR_NOASSOC      There is no application associated with the given filename extension.
SE_ERR_OOM      There was not enough memory to complete the operation.
SE_ERR_PNF      The specified path was not found.
SE_ERR_SHARE      A sharing violation occurred.
 

Remarks

The file specified by the lpFile parameter can be a document file or an executable file. If the file is a document file, the ShellExecute function opens or prints it, depending on the value of the lpOperation parameter. If the file is an executable file, the ShellExecute function opens it, even if lpOperation specifies printing.



0
 

Author Comment

by:computurwizard
ID: 10798496
Turns out it could be a problem if the user has AOL 9.0 Optimized installed.  Haven't confirmed it, but at least on one machine that is the case.  Workaround?
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 11441379
PAQed, with points refunded (500)

modulo
Community Support Moderator
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now