How can use custom ocx control

icobaniicobani Member Posts: 70
Hi all,

I m writing a ocx in vb6. This is very simple, only one label and one textbox control. I am compiling and register this control. I can't use this control in navision. I am examine thoroughly sample but i cant. I m creating a sub fom and main form in navision, declare global variable data type is ocx and select ocx object. but i cant see what is the problem.
i can't find simple sample.

thanks.
Ibrahim COBANI | Dynamics-NAV Developer Team Manager
I m a Consult

E-Mail: ibrahim@imaconsult.com
My BLOG

Comments

  • andreofandreof Member Posts: 133
    In general you can't use visual controls with navision. There are some workarounds, like for example draw the control in the active window and stuff like that but you need to know a bit about that.
    Andre Fidalgo
    My world: Dynamics NAV,SQL and .NET

    CEO at Solving Dynamics
    http://www.solvingdynamics.com
  • icobaniicobani Member Posts: 70
    if i can't use visual control with navision why i use ocx maybe use automation (.dll). I can see ocx sample but only ocx file (for example treeviews, chart) without source. What is the diferent my ocx project than other ? :-k
    Ibrahim COBANI | Dynamics-NAV Developer Team Manager
    I m a Consult

    E-Mail: ibrahim@imaconsult.com
    My BLOG
  • andreofandreof Member Posts: 133
    sorry, dont know how to do it using VB
    Andre Fidalgo
    My world: Dynamics NAV,SQL and .NET

    CEO at Solving Dynamics
    http://www.solvingdynamics.com
  • David_CoxDavid_Cox Member Posts: 509
    Use the dll option, you can run your VB User Control from within the dll, to collect the information then pass it back, through your vb function.

    The confusion about Navision and VB visual controls is this, you cannot place a VB control on the navision form Directly as such, but you can have VB forms with these controls on appearing as though they are on the form, you can of course load a VB form from within your dll, or ocx, into a new window.
    Analyst Developer with over 17 years Navision, Contract Status - Busy
    Mobile: +44(0)7854 842801
    Email: david.cox@adeptris.com
    Twitter: https://twitter.com/Adeptris
    Website: http://www.adeptris.com
  • andreofandreof Member Posts: 133
    I think he wants to see is user control inside the navision form (not in a different window), but i can be wrong
    Andre Fidalgo
    My world: Dynamics NAV,SQL and .NET

    CEO at Solving Dynamics
    http://www.solvingdynamics.com
  • lubostlubost Member Posts: 632
    I tried using my own controls inside Navision and it is possible. What do you need:

    1. Create function in your ocx, which finds hWnd of topmost child window inside Navision. This can be done for example by setting an unique caption in Navision form window and find this findow
    2. When you obtain a hWnd, you can use Windows API functions to manipulate with this Navision window (for example you can find a hDC and paint onto window ...)
    3. This method can be used for normal windows and subforms (I am able for example run video in Navision subform)
Sign In or Register to comment.