|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to create the project referencing library, which user may not have on his computer?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 Use correct error checking... If you are not going to use the dll, why make
a call to it? -- Show quoteHide quoteRandem 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 > 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 >> > > 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 -- Show quoteHide quoteRandem 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: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 >>> >> >> > >
Show quote
Hide quote
"fred" <fred@nospamme.com> wrote in message The common way to manage to this is to use Late-binding (creating anews:%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 > reference to "object") instead of Early-Binding (setting a project reference and using that reference). -ralph 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. -- Show quoteHide quoteRandem 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 "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 > > "Randem" <newsgro***@randem.com> wrote in message Yes that is true, but I assumed the OP would be wise enough that ifnews: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. > CreateObject failed he would conditionally block off any subsequent attempts to use the object. Unfortunately we know what happens when one assumes. lol -ralph
Show quote
Hide quote
"fred" <fred@nospamme.com> wrote in message Set your Startup object to Sub Main, and use CreateObject() to check if the 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, 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 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 > > "fred" <fred@nospamme.com> wrote in message Search MSDN for "Late binding". Basically you need to remove the reference, 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 and use CreateObject, and declare variables "As Object". CreateObject generates an error when the DLL/OCX/Other is not installed. 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. -- Show quoteHide quoteRandem 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: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 >> >> > >
VB6 on Vista Home Premium problem
Excel Execution from VB Fails on 2nd Attempt Use an Addin to automatically add date/time stamp to each edited line of VB6 code? Sub .... or Private Sub.... When and where do I do Set m_FormVar = Nothing? VB6 - Just In Time Error Message Help Moving .exe somtimes works MS Access Query in VB6 fso.Drives replacement The GPF in VB6 Environment is caused by: Call HtmlHelp(Me.hwnd, App.HelpFile, HH_CLOSE_ALL, 0&) |
|||||||||||||||||||||||