0

I have to make use of the component dynamically which normally have the visual part. That visual part can be turned off, but when I create the component it needs parent.

I have to use the component in a dll library. Is it possible and how to workaround the problem? How can I pass parent?

Thanks!

John
  • 1,834
  • 5
  • 32
  • 60
  • 1
    Did you try creating a hidden window and making that the parent? For example `AllocateHwnd` will get you a window. – David Heffernan Sep 17 '12 at 08:58
  • what do you mean by "parent" ? what is the real relationship? show the code. Also why cannot you use normal BPL instead of DLL ? – Arioch 'The Sep 17 '12 at 09:35
  • @DavidHeffernan Could you post some code ..? I need a parent of TWincontrol class. How Could I make use of the created handle? – John Sep 17 '12 at 09:55
  • 1
    Do you really need a `Parent`? Isn't it enough to have a parent window handle. Can't you use `CreateParented` to create your control? If you absolutely need a `Parent`, then create one. Just create a control that's not visible and use that. Very hard to offer code when we don't really understand exactly what this component needs. – David Heffernan Sep 17 '12 at 10:05
  • @DavidHeffernan Ok, createparented did the trick. Thanks! – John Sep 17 '12 at 10:17
  • I don't know what component this is, but it seems to me a bad idea to use a visual component for invisible operations. Isn't there a better alternative? – GolezTrol Sep 17 '12 at 10:24
  • @GolezTrol Unfortunately no. This is a commercial pdf viewer. it has the function to render the content of the page onto canvas as well it can also display the pdf in his area. I just need to render the choosen content. – John Sep 17 '12 at 10:28

1 Answers1

2

Create a hidden window handle, for example with AllocateHWnd(nil). And then create your control by calling CreateParented passing that hidden window handle.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490