dcsimg
Results 1 to 5 of 5

Thread: [RESOLVED] Question - dynamic userform + control creation.

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2016
    Posts
    20

    Resolved [RESOLVED] Question - dynamic userform + control creation.

    Hello all,

    obviously i have to much time and started to create a solution which creates a userform from scratch (only via API's).
    No - the background is actually that VBA userforms are quite limited in terms of mouse move tracking.
    The form element of VB6 is here much more flexible - but i dont want to create a vb6 activeX dll (now)

    The question is still pure VB6 related - so please don't instant move this question.

    I'm able to create a VB6 userform via CreateWindowEx + RegisterClass.
    After reading some ~ 20 year old 'C' - documentations .. i was able to create a proper (dynamic) window which could be controlled by my own subclassing.
    Now the ugly part: create controls within this userform.

    With CreateWindowEx i can create only a fixed set of standard controls (like label, text, image, static, .. )
    Actually i planned to add some custom controls (like 'Shell.Explorer.2' -> IE Frame)
    Since i cant refer on "Form.Controls.Add" (i have only the form hwnd) - i hoped 'createObject' + SetParent would help.
    But once i create a 'Shell.Explorer.2' object - the .Hwnd is always blank.

    Did someone tried this before?

    If yes - what is the correct way to add a custom control (independent of any subclassing code) to a form if you have only the dialog Hwnd?

    * Could you feed a "object" variable with the form object? (maybe via calling a API which return the form by the HWND)?
    i stuck a bit at the moment

    Thanks

  2. #2
    Addicted Member Davor Geci's Avatar
    Join Date
    Sep 2009
    Posts
    167

    Re: Question - dynamic userform + control creation.

    Hello Gusto,
    maybe you should take a look at my project called Virtual Forms.
    It dynamically creates the forms and controls at runtime and it can be also used in VB6 and VBA (32-bit and 64-bit).
    The project homepage is https://virtual-forms.com
    Davor
    My projects:
    Virtual Forms
    VBA Telemetry

  3. #3
    Addicted Member
    Join Date
    Aug 2017
    Posts
    141

    Re: Question - dynamic userform + control creation.

    As you have found out, siting ActiveX controls (like the WebBrowser control) on windows that you have created manually via APIs isn't as easy as creating common controls like the Button, Edit, ListBox, ComboBox, etc. If you would like to know how it's done the hard way, check out Embed an HTML control in your own window using plain C.

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Dec 2016
    Posts
    20

    Re: Question - dynamic userform + control creation.

    Thank you Victor for the link.
    The solution from Jeff is quite good - but he use a different way in order to access the IWebBrowser2 interface which cant be converted into a equivalent vba class code.
    Due to performance reasons i focused on IFrame - and not on InternetExplorer.Application.

    It was nice to experimenting with this legacy ways - and i know now what is possible / sensible.
    However .. i merged now everything into a small activeX dll.
    Since i have only one public interface - the dll could be registered on a userlevel via registry during runtime.
    This works smooth as hell and is way less error prone.
    I guess several desktop security solutions are not happy the way i dealed with all the pointers and api's *haha*

    I will flag this thread as closed

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Dec 2016
    Posts
    20

    Re: Question - dynamic userform + control creation.

    Hello Davor,

    Quote Originally Posted by Davor Geci View Post
    Hello Gusto,
    maybe you should take a look at my project called Virtual Forms.
    Thank you for the link - but i guess this solution is nothing for me. i just needed a flexible wrapper which owns a Shell.Explorer.2 object and handle the events of the dom document. The rest is done in pure HTML.
    Your solution requires to register at least one ActiveX control per machine level - so it cant be used within enterprise environments.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width