Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 6th, 2004, 01:22 AM
Registered User
 
Join Date: Feb 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default HOW TO - Calling an ActiveX DLL in a UserCont

Hi all,

we have been looking out for a solution for the problem mentioned below.... PLEASE HELP

We have a problem with us here. We have created a dll which will externalize the font for an internationalization project. Based on the LocaleID it will change the language for the form.. This works perfectly in the form once the DLL is registered and referenced.

We would like to implement the same in a Usercontrol which we have by the dozen in each VBP. We are trying to do this in the UserControl_Initialize which gives an error

The code in the externalization in the class module is as follows:
ChangeFont.dll > Class Module
Public Sub SetFont(ByRef objClient As Object)
  If TypeOf objClient Is Form Then
    Call mdlChangeFont.SetFormFonts(objClient) 'For Forms
  Else
    Call mdlChangeFont.SetControlFonts(objClient) 'For UserControl
  End If
End Sub

For the Form we implement it in the Form_Load() as:
Private Sub Form_Load()
   Dim ext As New ChangeFont.clsChangeFont
   ext.SetFont Me
End Sub

Please let me know in which event of the UserControl should this be put whether UserControl_Initialize or UserControl_InitProperties or UserControl_ReadProperties or should we go ahead with the tedious process of changing the Font and the script in the UserControl to MS UI Gothic and Japanese.

This is an urgent requirement... HELP.............................

Regards
Arvind Krishnan
 
Old August 3rd, 2005, 04:33 AM
Registered User
 
Join Date: Aug 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
i came across your problem quite late. I guess its already solved? Here is a link i found concerning that problem:
(PRB: TypeOf Operator Does Not Recognize Form Object)
http://support.microsoft.com/kb/194570/en-us
I have a similar problem at the moment. I would be very thankful if you could tell me how you solved the problem.

regards

 
Old August 3rd, 2005, 01:14 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

as msdn states, Form and UserControl are objects that are recognized only inside the current project. Outside of it, they do not have any meaning. Just to explain this a little further, the dll can be written in C, where the concept of a Form does not exist. But even in VB, the "form" is just a pointer to a local object, that cannot be passed around project boundaries.
In this particolar case (internationalization) I put the code in a standard bas module (instead of a dll) that is included in all our projects, with a SetFont method used like:

Private Sub Form_Load()
   SetFont Me
End Sub

BTW SetFont is called also when the current locale is changed, so that our apps can update on the fly.

Marco





Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling a dll inside from a dll tiredcat Visual Basic 2005 Basics 2 August 30th, 2007 11:02 PM
Advantages /Disadvantages of ActiveX DLL & ActiveX priyank Beginning VB 6 6 February 19th, 2007 11:34 AM
Calling activeX from c# jinohere Beginning VB 6 1 August 29th, 2006 10:39 AM
Calling an ActiveX.EXE in C++ xgbnow Visual C++ 4 March 31st, 2004 08:12 AM
Calling an ActiveX DLL in a UserControl arvindkrishnan VB Components 4 February 9th, 2004 03:38 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.