Home All Groups Group Topic Archive Search About

How to create the project referencing library, which user may not have on his computer?

Author
6 Jun 2009 10:22 PM
fred
Hello,
          I have this problem.
My project is using Microsoft Voice Text component (referencing vtext.dll)
which may not be installed on targed computer.
And that is just a minor option, which my app offers. (I do not want to
force user to install that library prior to the installation of my app).
How to code that reference conditionally?
I have tested on virgin Windows XP, that if I run my executable and the
vtext.dll is missing there is vbasic run-time error as soon as program
loads.
Is there any way to to include that component in the project but not let
Windows crash the program when the library is missing?
Your thoughts appreciated,
Fred

Author
6 Jun 2009 10:57 PM
Randem
Use correct error checking... If you are not going to use the dll, why make
a call to it?

--
Randem Systems
Your Installation Specialist
The Top Inno Setup Script Generator
http://www.randem.com/innoscript.html
Disk Read Error Press Ctl+Alt+Del to Restart
http://www.randem.com/discus/messages/9402/9406.html?1236319938



Show quoteHide quote
"fred" <fred@nospamme.com> wrote in message
news:%23nh1PVv5JHA.480@TK2MSFTNGP06.phx.gbl...
> Hello,
>          I have this problem.
> My project is using Microsoft Voice Text component (referencing vtext.dll)
> which may not be installed on targed computer.
> And that is just a minor option, which my app offers. (I do not want to
> force user to install that library prior to the installation of my app).
> How to code that reference conditionally?
> I have tested on virgin Windows XP, that if I run my executable and the
> vtext.dll is missing there is vbasic run-time error as soon as program
> loads.
> Is there any way to to include that component in the project but not let
> Windows crash the program when the library is missing?
> Your thoughts appreciated,
> Fred
>
Author
7 Jun 2009 1:44 AM
fred
What error checking?
The error is just at the program's start. No code executed yet.
You do not understand the other part as well.. It is a minor option, which
user may or may not to select.
But, the code must be in place just in the case if the option is selected.
I hope it is clear.
Fred

Show quoteHide quote
"Randem" <newsgro***@randem.com> wrote in message
news:Otd3iov5JHA.3856@TK2MSFTNGP05.phx.gbl...
> Use correct error checking... If you are not going to use the dll, why
> make a call to it?
>
> --
> Randem Systems
> Your Installation Specialist
> The Top Inno Setup Script Generator
> http://www.randem.com/innoscript.html
> Disk Read Error Press Ctl+Alt+Del to Restart
> http://www.randem.com/discus/messages/9402/9406.html?1236319938
>
>
>
> "fred" <fred@nospamme.com> wrote in message
> news:%23nh1PVv5JHA.480@TK2MSFTNGP06.phx.gbl...
>> Hello,
>>          I have this problem.
>> My project is using Microsoft Voice Text component (referencing
>> vtext.dll) which may not be installed on targed computer.
>> And that is just a minor option, which my app offers. (I do not want to
>> force user to install that library prior to the installation of my app).
>> How to code that reference conditionally?
>> I have tested on virgin Windows XP, that if I run my executable and the
>> vtext.dll is missing there is vbasic run-time error as soon as program
>> loads.
>> Is there any way to to include that component in the project but not let
>> Windows crash the program when the library is missing?
>> Your thoughts appreciated,
>> Fred
>>
>
>
Author
7 Jun 2009 2:51 AM
Randem
No, I do understand... A runtime error is an unhandled exception. Why do you
think no code is executed? VB doesn't use it. Code is not always executed in
the order you may want it because VB is event driven.

As for the other part if you have the user select an option not to use the
dll then it is totally the responsibility of the coder to NOT make the calls
to the dll.

It is totally under your control

Perhaps this will help you see what is going on
http://www.randem.com/rstools.html


--
Randem Systems
Your Installation Specialist
The Top Inno Setup Script Generator
http://www.randem.com/innoscript.html
Disk Read Error Press Ctl+Alt+Del to Restart
http://www.randem.com/discus/messages/9402/9406.html?1236319938



Show quoteHide quote
"fred" <fred@nospamme.com> wrote in message
news:eykwSGx5JHA.6004@TK2MSFTNGP02.phx.gbl...
> What error checking?
> The error is just at the program's start. No code executed yet.
> You do not understand the other part as well.. It is a minor option, which
> user may or may not to select.
> But, the code must be in place just in the case if the option is selected.
> I hope it is clear.
> Fred
>
> "Randem" <newsgro***@randem.com> wrote in message
> news:Otd3iov5JHA.3856@TK2MSFTNGP05.phx.gbl...
>> Use correct error checking... If you are not going to use the dll, why
>> make a call to it?
>>
>> --
>> Randem Systems
>> Your Installation Specialist
>> The Top Inno Setup Script Generator
>> http://www.randem.com/innoscript.html
>> Disk Read Error Press Ctl+Alt+Del to Restart
>> http://www.randem.com/discus/messages/9402/9406.html?1236319938
>>
>>
>>
>> "fred" <fred@nospamme.com> wrote in message
>> news:%23nh1PVv5JHA.480@TK2MSFTNGP06.phx.gbl...
>>> Hello,
>>>          I have this problem.
>>> My project is using Microsoft Voice Text component (referencing
>>> vtext.dll) which may not be installed on targed computer.
>>> And that is just a minor option, which my app offers. (I do not want to
>>> force user to install that library prior to the installation of my app).
>>> How to code that reference conditionally?
>>> I have tested on virgin Windows XP, that if I run my executable and the
>>> vtext.dll is missing there is vbasic run-time error as soon as program
>>> loads.
>>> Is there any way to to include that component in the project but not let
>>> Windows crash the program when the library is missing?
>>> Your thoughts appreciated,
>>> Fred
>>>
>>
>>
>
>
Author
7 Jun 2009 3:00 AM
Ralph
Show quote Hide quote
"fred" <fred@nospamme.com> wrote in message
news:%23nh1PVv5JHA.480@TK2MSFTNGP06.phx.gbl...
> Hello,
>           I have this problem.
> My project is using Microsoft Voice Text component (referencing vtext.dll)
> which may not be installed on targed computer.
> And that is just a minor option, which my app offers. (I do not want to
> force user to install that library prior to the installation of my app).
> How to code that reference conditionally?
> I have tested on virgin Windows XP, that if I run my executable and the
> vtext.dll is missing there is vbasic run-time error as soon as program
> loads.
> Is there any way to to include that component in the project but not let
> Windows crash the program when the library is missing?
> Your thoughts appreciated,
> Fred
>

The common way to manage to this is to use Late-binding (creating a
reference to "object") instead of Early-Binding (setting a project reference
and using that reference).

-ralph
Author
7 Jun 2009 3:51 AM
Randem
Yes, that is true but it will not stop the errors when the app calls or
access the dll without proper coding the same way the reference would work.

--
Randem Systems
Your Installation Specialist
The Top Inno Setup Script Generator
http://www.randem.com/innoscript.html
Disk Read Error Press Ctl+Alt+Del to Restart
http://www.randem.com/discus/messages/9402/9406.html?1236319938



Show quoteHide quote
"Ralph" <nt_consultin***@yahoo.com> wrote in message
news:uojXkxx5JHA.3856@TK2MSFTNGP05.phx.gbl...
>
> "fred" <fred@nospamme.com> wrote in message
> news:%23nh1PVv5JHA.480@TK2MSFTNGP06.phx.gbl...
>> Hello,
>>           I have this problem.
>> My project is using Microsoft Voice Text component (referencing
>> vtext.dll)
>> which may not be installed on targed computer.
>> And that is just a minor option, which my app offers. (I do not want to
>> force user to install that library prior to the installation of my app).
>> How to code that reference conditionally?
>> I have tested on virgin Windows XP, that if I run my executable and the
>> vtext.dll is missing there is vbasic run-time error as soon as program
>> loads.
>> Is there any way to to include that component in the project but not let
>> Windows crash the program when the library is missing?
>> Your thoughts appreciated,
>> Fred
>>
>
> The common way to manage to this is to use Late-binding (creating a
> reference to "object") instead of Early-Binding (setting a project
> reference
> and using that reference).
>
> -ralph
>
>
Author
7 Jun 2009 8:08 AM
Ralph
"Randem" <newsgro***@randem.com> wrote in message
news:uJ139My5JHA.6136@TK2MSFTNGP03.phx.gbl...
> Yes, that is true but it will not stop the errors when the app calls or
> access the dll without proper coding the same way the reference would
work.
>

Yes that is true, but I assumed the OP would be wise enough that if
CreateObject failed he would conditionally block off any subsequent attempts
to use the object.

Unfortunately we know what happens when one assumes. lol

-ralph
Author
7 Jun 2009 12:59 PM
Nobody
Show quote Hide quote
"fred" <fred@nospamme.com> wrote in message
news:%23nh1PVv5JHA.480@TK2MSFTNGP06.phx.gbl...
> Hello,
>          I have this problem.
> My project is using Microsoft Voice Text component (referencing vtext.dll)
> which may not be installed on targed computer.
> And that is just a minor option, which my app offers. (I do not want to
> force user to install that library prior to the installation of my app).
> How to code that reference conditionally?
> I have tested on virgin Windows XP, that if I run my executable and the
> vtext.dll is missing there is vbasic run-time error as soon as program
> loads.
> Is there any way to to include that component in the project but not let
> Windows crash the program when the library is missing?
> Your thoughts appreciated,

Set your Startup object to Sub Main, and use CreateObject() to check if the
library is installed. If your form is the startup object, and has an OCX or
Reference that was not installed, you can't trap the error(not 100% sure
about references). Here is an example(air code):

Public Sub Main()

    If IsInstalled("Lib.Obj") Then
        Form1.Show
    Else
        MsgBox "Lib.Obj was not installed"
    End If
End Sub

Public Function IsInstalled(ByRef sObjName As String) AS Boolean
    Dim o As Object

    On Error Resume Next

    Set o = CreateObject(sObjName)
    If Err.Number <> 0 Then
        IsInstalled = False
    Else
        IsInstalled = True
    End If
    Set o = Nothing
End Sub
Author
7 Jun 2009 4:07 PM
fred
Thank you for your reply, but I am still confused
How error trapping will help me with that?
I want the program to run, even if the library is not there (as I said
before it is a minor, not significant option my app offers).
How to build some condition using the error trapping to disable that
reference to library when there wiil be an error?
Thanks,
Fred

Show quoteHide quote
"Nobody" <nob***@nobody.com> wrote in message
news:eJ1dX$25JHA.1196@TK2MSFTNGP03.phx.gbl...
> "fred" <fred@nospamme.com> wrote in message
> news:%23nh1PVv5JHA.480@TK2MSFTNGP06.phx.gbl...
>> Hello,
>>          I have this problem.
>> My project is using Microsoft Voice Text component (referencing
>> vtext.dll) which may not be installed on targed computer.
>> And that is just a minor option, which my app offers. (I do not want to
>> force user to install that library prior to the installation of my app).
>> How to code that reference conditionally?
>> I have tested on virgin Windows XP, that if I run my executable and the
>> vtext.dll is missing there is vbasic run-time error as soon as program
>> loads.
>> Is there any way to to include that component in the project but not let
>> Windows crash the program when the library is missing?
>> Your thoughts appreciated,
>
> Set your Startup object to Sub Main, and use CreateObject() to check if
> the library is installed. If your form is the startup object, and has an
> OCX or Reference that was not installed, you can't trap the error(not 100%
> sure about references). Here is an example(air code):
>
> Public Sub Main()
>
>    If IsInstalled("Lib.Obj") Then
>        Form1.Show
>    Else
>        MsgBox "Lib.Obj was not installed"
>    End If
> End Sub
>
> Public Function IsInstalled(ByRef sObjName As String) AS Boolean
>    Dim o As Object
>
>    On Error Resume Next
>
>    Set o = CreateObject(sObjName)
>    If Err.Number <> 0 Then
>        IsInstalled = False
>    Else
>        IsInstalled = True
>    End If
>    Set o = Nothing
> End Sub
>
>
Author
7 Jun 2009 7:10 PM
Nobody
"fred" <fred@nospamme.com> wrote in message
news:eLKlGo45JHA.1372@TK2MSFTNGP05.phx.gbl...
> Thank you for your reply, but I am still confused
> How error trapping will help me with that?
> I want the program to run, even if the library is not there (as I said
> before it is a minor, not significant option my app offers).
> How to build some condition using the error trapping to disable that
> reference to library when there wiil be an error?
> Thanks,
> Fred

Search MSDN for "Late binding". Basically you need to remove the reference,
and use CreateObject, and declare variables "As Object". CreateObject
generates an error when the DLL/OCX/Other is not installed.
Author
7 Jun 2009 7:45 PM
Randem
As in the "Air Code" Nobody posted you have a boolean set to true if
IsInstalled detected that the component was available on the system and
false if it was not. All you need to do is to check that boolean anywhere in
your code where you are about to use that component and skip the routine or
area of code if the boolean is false.

You will need to add some (If...Else...End IF or Select Case) Statements
where you use the component.

--
Randem Systems
Your Installation Specialist
The Top Inno Setup Script Generator
http://www.randem.com/innoscript.html
Disk Read Error Press Ctl+Alt+Del to Restart
http://www.randem.com/discus/messages/9402/9406.html?1236319938



Show quoteHide quote
"fred" <fred@nospamme.com> wrote in message
news:eLKlGo45JHA.1372@TK2MSFTNGP05.phx.gbl...
> Thank you for your reply, but I am still confused
> How error trapping will help me with that?
> I want the program to run, even if the library is not there (as I said
> before it is a minor, not significant option my app offers).
> How to build some condition using the error trapping to disable that
> reference to library when there wiil be an error?
> Thanks,
> Fred
>
> "Nobody" <nob***@nobody.com> wrote in message
> news:eJ1dX$25JHA.1196@TK2MSFTNGP03.phx.gbl...
>> "fred" <fred@nospamme.com> wrote in message
>> news:%23nh1PVv5JHA.480@TK2MSFTNGP06.phx.gbl...
>>> Hello,
>>>          I have this problem.
>>> My project is using Microsoft Voice Text component (referencing
>>> vtext.dll) which may not be installed on targed computer.
>>> And that is just a minor option, which my app offers. (I do not want to
>>> force user to install that library prior to the installation of my app).
>>> How to code that reference conditionally?
>>> I have tested on virgin Windows XP, that if I run my executable and the
>>> vtext.dll is missing there is vbasic run-time error as soon as program
>>> loads.
>>> Is there any way to to include that component in the project but not let
>>> Windows crash the program when the library is missing?
>>> Your thoughts appreciated,
>>
>> Set your Startup object to Sub Main, and use CreateObject() to check if
>> the library is installed. If your form is the startup object, and has an
>> OCX or Reference that was not installed, you can't trap the error(not
>> 100% sure about references). Here is an example(air code):
>>
>> Public Sub Main()
>>
>>    If IsInstalled("Lib.Obj") Then
>>        Form1.Show
>>    Else
>>        MsgBox "Lib.Obj was not installed"
>>    End If
>> End Sub
>>
>> Public Function IsInstalled(ByRef sObjName As String) AS Boolean
>>    Dim o As Object
>>
>>    On Error Resume Next
>>
>>    Set o = CreateObject(sObjName)
>>    If Err.Number <> 0 Then
>>        IsInstalled = False
>>    Else
>>        IsInstalled = True
>>    End If
>>    Set o = Nothing
>> End Sub
>>
>>
>
>