Pass form from a standard exe to an activex dll

Quite Strange. I am tryting to pass the form from a standard exe to an activex dll.

The reason I am doing this to take the handle of the form being passed to apply a skin to the form and all the controls on it in one go. I have many other vb 6.0  projects so i am trying to create a generic dll so as not to repeat the same code everywhere.

the dll code is written inside a class called 'CommonAPIs'

In the form I create a reference of the above dll and in form load, I call the loadskin method as below:

Private Sub Form_Load()

Dim objAvataar As AvataarCommonAPI.CommonAPIs

Set objAvataar = New AvataarCommonAPI.CommonAPIs
objAvataar.Loadskin Me

end sub

If I add both the standard exe and the dll project within the same group, it works but if I create a dll and reference it separately, nothing happens (the skin is not applied which it should).

What is the mistake I am doing ??

Shall appreciate a quick reply !!
Public Function Loadskin(frm As Object)

    On Error GoTo Err_LoadSkin

    Dim frmskin As VB.Form

    If TypeOf frm Is VB.Form Then
        Set frmskin = frm
        frmmain.SkinFramework.Loadskin SKINPATH + "\" + SKINNAME, ""
        frmmain.SkinFramework.ApplyWindow frmskin.hwnd
    End If
    Exit Function
     Err.Raise Err.Number, "LoadSkin", Err.Description
End Function

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I don't see a problem with passing a form object to an activex component (from a DLL reference) .
frmmain.SkinFramework.Loadskin SKINPATH & "\" & SKINNAME, ""
Can you see the hWnd and the Caption of the form you pass into the method?

Public sub LoadskinFromObject(frm As Object)
    Dim frmskin As VB.Form
    If TypeOf frm Is VB.Form Then
        Set frmskin = frm
        MsgBox frmskin.hWnd
        MsgBox frmskin.Caption
    End If
End Function

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
acptAuthor Commented:

Both the form handle and form caption is retained in the LoadSkin subroutine.
That is not the problem...

If i compare frmskin.hwnd=frm.hwnd I get true..
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.