Refrence Error

If we use a refrence that doesnt exist in another users machine, does that user get an error at runtime(or @ all?)

The Ghost
ghost@crazygrandpa.com

Comments

  • [b][red]This message was edited by the Malcolm at 2002-2-28 17:23:28[/red][/b][hr]
    : If we use a refrence that doesnt exist in another users machine, does that user get an error at runtime(or @ all?)
    :
    : The Ghost
    : ghost@crazygrandpa.com
    :

    I'm not sure what happens if the automation file is not on the computer. It may cause the whole program to crash, or it may just cause an error on the line that is trying call a procedure of the referenced object.

    If the automation file is on the computer, but the actual program isn't on the computer, it will run Error 429 "ActiveX Component can't create object on a line that tries to call a procedure of the referenced object, or on the line with the Set statement.

    The only thing I could test is Powerpoints object library. I have its Automation file on my computer, without having powerpoint itself. Error 429 was the error I got.

    What I would do is distribute the automation file with your app, so that if the appropriate program doesn't exist on the users computer, the only thing that will happen is Error 429 on the line that calls the object.





  • I'm trying do disable a MSN messenger function, if it exists, if not then i don't have any problem. can i check 2 c if it exists?

    The Ghost
    ghost@crazygrandpa.com

  • : I'm trying do disable a MSN messenger function, if it exists, if not then i don't have any problem. can i check 2 c if it exists?
    :
    : The Ghost
    : ghost@crazygrandpa.com
    :
    :

    I take it we are talking about working out if MSN messanger exists on the users computer.

    Assuming you distribute the automation file with your app, I think the following code would work. Note that the parts in blue, you will probably need to change, as I'm only guessing

    [code]Public Function MSNMessangerExists() As Boolean
    On Error Resume Next
    Dim MSN As New [blue]MSNMessanger.Application[/blue]
    Set MSN = New [blue]MSNMessanger.Application[/blue]
    If (Err.Number = 429) Then
    MSNMessangerExists = False
    Else
    MSNMessangerExists = True
    End If
    Set MSN = Nothing
    End Function[/code]


  • : : I'm trying do disable a MSN messenger function, if it exists, if not then i don't have any problem. can i check 2 c if it exists?
    : :
    : : The Ghost
    : : ghost@crazygrandpa.com
    : :
    : :
    :
    : I take it we are talking about working out if MSN messanger exists on the users computer.
    :
    : Assuming you distribute the automation file with your app, I think the following code would work. Note that the parts in blue, you will probably need to change, as I'm only guessing
    :
    : [code]Public Function MSNMessangerExists() As Boolean
    : On Error Resume Next
    : Dim MSN As New [blue]MSNMessanger.Application[/blue]
    : Set MSN = New [blue]MSNMessanger.Application[/blue]
    : If (Err.Number = 429) Then
    : MSNMessangerExists = False
    : Else
    : MSNMessangerExists = True
    : End If
    : Set MSN = Nothing
    : End Function[/code]
    :
    :
    :

    Best way is to not use a reference at all:

    Dim x As Object
    On Error Resume Next
    Set x = CreateObject("MSNMessanger.Application")
    If x Is Nothing Then

    ElseIf Err.Number <> 0 Then

    Else

    End If

    I don't recall when you get an error and when it's just equal to nothing, but you can experiment if you like. I [italic]think[/italic] you get an error if the class doesn't exist at all and it's nothing when there's a problem loading it but I could have that backwards or completely wrong.
  • : : : I'm trying do disable a MSN messenger function, if it exists, if not then i don't have any problem. can i check 2 c if it exists?
    : : :
    : : : The Ghost
    : : : ghost@crazygrandpa.com
    : : :
    : : :
    : :
    : : I take it we are talking about working out if MSN messanger exists on the users computer.
    : :
    : : Assuming you distribute the automation file with your app, I think the following code would work. Note that the parts in blue, you will probably need to change, as I'm only guessing
    : :
    : : [code]Public Function MSNMessangerExists() As Boolean
    : : On Error Resume Next
    : : Dim MSN As New [blue]MSNMessanger.Application[/blue]
    : : Set MSN = New [blue]MSNMessanger.Application[/blue]
    : : If (Err.Number = 429) Then
    : : MSNMessangerExists = False
    : : Else
    : : MSNMessangerExists = True
    : : End If
    : : Set MSN = Nothing
    : : End Function[/code]
    : :
    : :
    : :
    :
    : Best way is to not use a reference at all:
    :
    : Dim x As Object
    : On Error Resume Next
    : Set x = CreateObject("MSNMessanger.Application")
    : If x Is Nothing Then
    :
    : ElseIf Err.Number <> 0 Then
    :
    : Else
    :
    : End If
    :
    : I don't recall when you get an error and when it's just equal to nothing, but you can experiment if you like. I [italic]think[/italic] you get an error if the class doesn't exist at all and it's nothing when there's a problem loading it but I could have that backwards or completely wrong.
    :

    Note that I am also guessing on the class for MSN. If you set a reference but the activex server doesn't exist, your app won't run at all. You'll just get "Program needs xxxxxx.xxx to run".
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories