Jump to content
  • Advertisement
Sign in to follow this  

Substituting a VB form by a window created by a DLL

This topic is 4410 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I wrote a dll in VC++ that creates a window. This dll is called from a VB application. I'm trying to do this window be the main VB form, by passing its handle to the dll, as shown below: Relevant dll code:
int _stdcall InitMainWindow(HWND hWnd)
    WNDCLASSEX wc = { ... };
    RegisterClassEx( &wc );

    hWnd = CreateWindow( ... );
   ShowWindow( hWnd, SW_SHOWDEFAULT );
   UpdateWindow( hWnd );


Relevant VB code:
Public Declare Function InitMainWindow Lib "DLL_Test_Window.dll" (ByVal hWnd As Long) As Long

Private Sub Form_Initialize()
   Call InitMainWindow(Me.hWnd)
End Sub

But this doesn't work. The created window doesn't "substitute" the form window. Actually, I would like to render a scene in the VB form background and add some controls on it (textboxes, labels and grids). I already made this using Direct3D directly with VB. But now I would like to use the window created by the dll as the form. Is this possible? Thanks in advance

Share this post

Link to post
Share on other sites
Oh... where was my mind?! The VB form is already a real window. I don't need to create a new window in the dll. Just passing Me.hWnd to the dll for starting the render device is enough.

Thanks and sorry for the confusion.

Share this post

Link to post
Share on other sites
Yup. In any case, the other way around isn't possible afaik - a vb form (actually a system.windows.forms form) is a bit more complex than a windows window, and I don't know of any way to make one use a pre-created windows window.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!