|
-
Feb 27th, 2003, 08:08 AM
#1
Thread Starter
Frenzied Member
Objects available
How can we determine which objects are available on users machine ?
I'm adding functionality to email of fax the reports generated by the app.
When outlook isn't installed on the machine i would set the button disabled.
The same for the fax server.
How can i check if these classes are installed on the machine ?
Now I am creating the objects when the button is clicked.
This will throw an error when the component isn't available.
Someone.
Code:
If Question = Incomplete Then
AnswerNextOne
Else
ReplyIfKnown
End If
cu Swatty
-
Feb 27th, 2003, 08:11 AM
#2
Let me in ..
Well - You can create a test function in which you can check what all classes are available. For instance, you could do something like this ...
VB Code:
on error resume next
dim lobjOutlook as new Outlook.Application ' or whatever
if err.number <> 0 then
' class not installed or not found ....
end if
Run this test procedure in the beginning and if it return false disable your buttons ...
Its not the most elegant of ways of doing something but its sure as hell is easy.
-
Feb 27th, 2003, 08:26 AM
#3
For Outlook you can check the following registry key
HKEY_CLASSES_ROOT\Outlook.Application\CurVer
if it has a value then Outlook is installed
-
Feb 27th, 2003, 08:36 AM
#4
Thread Starter
Frenzied Member
I'll try for techy's aproach not a proper one but effective.
The registry key would not exist (i think ) if not installed.
Code:
If Question = Incomplete Then
AnswerNextOne
Else
ReplyIfKnown
End If
cu Swatty
-
Feb 27th, 2003, 08:42 AM
#5
Originally posted by swatty
I'll try for techy's aproach not a proper one but effective.
The registry key would not exist (i think ) if not installed.
True, but if the key didn't exist you'd get a trappable error.
Also, you wouldn't have to wait for the Outlook object to load, and the complications that come with creating it (on some machines you get a second visible instance, and some will close the main Outlook window if you terminate your object).
-
Feb 27th, 2003, 08:44 AM
#6
Thread Starter
Frenzied Member
What do you think about
VB Code:
On Error Resume Next
Dim obj As Object
Set obj = CreateObject("Outlook.Application")
If Err.Number <> 0 Then
Err.Clear
On Error Resume Next
NO_MAIL = True
End If
Set obj = Nothing
Set obj = CreateObject("FaxServer.FaxServer")
If Err.Number <> 0 Then
Err.Clear
NO_FAX = True
End If
Set obj = Nothing
Code:
If Question = Incomplete Then
AnswerNextOne
Else
ReplyIfKnown
End If
cu Swatty
-
Feb 27th, 2003, 08:44 AM
#7
Let me in ..
Originally posted by si_the_geek
True, but if the key didn't exist you'd get a trappable error.
Also, you wouldn't have to wait for the Outlook object to load, and the complications that come with creating it (on some machines you get a second visible instance, and some will close the main Outlook window if you terminate your object).
What ????? You are kidding me alright. I have done this before and it does not do anything like that.
-
Feb 27th, 2003, 08:46 AM
#8
Thread Starter
Frenzied Member
Originally posted by si_the_geek
True, but if the key didn't exist you'd get a trappable error.
Also, you wouldn't have to wait for the Outlook object to load, and the complications that come with creating it (on some machines you get a second visible instance, and some will close the main Outlook window if you terminate your object).
Do you have an example of retrieving regKey values.
Or can I get it with Getsetting.
Code:
If Question = Incomplete Then
AnswerNextOne
Else
ReplyIfKnown
End If
cu Swatty
-
Feb 27th, 2003, 08:47 AM
#9
Originally posted by techyspecy
What ????? You are kidding me alright. I have done this before and it does not do anything like that.
I said on SOME machines, it doesn't happen on many - I have only seen it on a small percentage of machines.. and not all the time, but it does happen occasionally.
-
Feb 27th, 2003, 08:49 AM
#10
Originally posted by swatty
Do you have an example of retrieving regKey values.
Or can I get it with Getsetting.
You can't use Getsetting, there are lots of example .bas modules around the web that have all the required registry functions in - there's some good ones at www.freevbcode.com
-
Feb 27th, 2003, 09:06 AM
#11
Let me in ..
Originally posted by si_the_geek
I said on SOME machines, it doesn't happen on many - I have only seen it on a small percentage of machines.. and not all the time, but it does happen occasionally.
What do you mean on some machines and not on others ...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|