activeX

Has anyone ever made SDL work in an ActiveX control? I saw a posting by
a “Gabriell Greco” dated July 11, 2002 claiming he was successful doing
so, but gave no details as to how.

I want to use SDL’s OpenGL method of rendering in the ActiveX control.
I will be using it in a VB app instead of doing this in a web page.

Anyone have any details or at least pointers in how to achieve this?

apocalypznow schrieb:

Has anyone ever made SDL work in an ActiveX control? I saw a posting
by a “Gabriell Greco” dated July 11, 2002 claiming he was successful
doing so, but gave no details as to how.

I want to use SDL’s OpenGL method of rendering in the ActiveX control.
I will be using it in a VB app instead of doing this in a web page.

Anyone have any details or at least pointers in how to achieve this?

Hi!

I am currently using a dialog inside an ActiveX control where the
initialization of SDL in OnInitDialog() looks like:

[…]
char aWindowId[100];

// SDL initializing stuff

_putenv("SDL_WINDOWID=0x00000000");
sprintf(aWindowId, "SDL_WINDOWID=0x%08x", m_hWnd);
_putenv(aWindowId);

_putenv("SDL_VIDEODRIVER=windib");

GetParent()->GetClientRect(m_tVideoDisplayRect);

SDL_Init(SDL_INIT_VIDEO);
m_pScreenSurface = SDL_SetVideoMode(m_tVideoDisplayRect.Width(), 

m_tVideoDisplayRect.Height(), 24, SDL_HWSURFACE);

[…]

Strangely the first _putenv() is necessary to avoid the SDL frame
"jumping" out of the dialog when the ActiveX is being instantiated again! :wink:

Sascha

Thank you for the code sample!

I have a few questions:

  1. is SDL_VIDEODRIVER=windib the only video driver that works? Can
    SDL_OPENGL work?
  2. does windib use GDI? If so, how can SDL_HWSURFACE then work?
  3. does your technique work without using a dialog, and instead just the
    window the wizard creates?> apocalypznow schrieb:

Has anyone ever made SDL work in an ActiveX control? I saw a posting
by a “Gabriell Greco” dated July 11, 2002 claiming he was successful
doing so, but gave no details as to how.

I want to use SDL’s OpenGL method of rendering in the ActiveX control.
I will be using it in a VB app instead of doing this in a web page.

Anyone have any details or at least pointers in how to achieve this?

Hi!

I am currently using a dialog inside an ActiveX control where the
initialization of SDL in OnInitDialog() looks like:

[…]
char aWindowId[100];

// SDL initializing stuff

_putenv(“SDL_WINDOWID=0x00000000”);
sprintf(aWindowId, “SDL_WINDOWID=0x%08x”, m_hWnd);
_putenv(aWindowId);

_putenv(“SDL_VIDEODRIVER=windib”);

GetParent()->GetClientRect(m_tVideoDisplayRect);

SDL_Init(SDL_INIT_VIDEO);
m_pScreenSurface = SDL_SetVideoMode(m_tVideoDisplayRect.Width(),
m_tVideoDisplayRect.Height(), 24, SDL_HWSURFACE);

[…]

Strangely the first _putenv() is necessary to avoid the SDL frame
"jumping" out of the dialog when the ActiveX is being instantiated
again! :wink:

Sascha

apocalypznow schrieb:

Thank you for the code sample!

I have a few questions:

  1. is SDL_VIDEODRIVER=windib the only video driver that works? Can
    SDL_OPENGL work?
  2. does windib use GDI? If so, how can SDL_HWSURFACE then work?
  3. does your technique work without using a dialog, and instead just
    the window the wizard creates?

Hi!

Hmmm… just try some variations of all the settings I’ve provided.

AFAIK “windib” is a fallback option if you have trouble with DirectX
acceleration.

As long as you have a HWND handle of your window this method shall work!

A probably better way is to study the original sources of the SDL
library to get some more clues about the functionality, but alas, I
haven’t found the time to do so… :wink:

Regards
Sascha

I’m trying to duplicate what you’ve done, but I am stuck.

  1. How do you create a dialog in an ActiveX control?
  2. In your OnDraw() method you have a device context, but is this the
    device context you draw upon or do you draw upon your dialog’s device
    context?
  3. The HWND handle to which you refer, are you using it from the base
    class of the ActiveX control, or the one for the dialog?

Sascha Springer wrote:> apocalypznow schrieb:

Thank you for the code sample!

I have a few questions:

  1. is SDL_VIDEODRIVER=windib the only video driver that works? Can
    SDL_OPENGL work?
  2. does windib use GDI? If so, how can SDL_HWSURFACE then work?
  3. does your technique work without using a dialog, and instead just
    the window the wizard creates?

Hi!

Hmmm… just try some variations of all the settings I’ve provided.

AFAIK “windib” is a fallback option if you have trouble with DirectX
acceleration.

As long as you have a HWND handle of your window this method shall work!

A probably better way is to study the original sources of the SDL
library to get some more clues about the functionality, but alas, I
haven’t found the time to do so… :wink:

Regards
Sascha

apocalypznow schrieb:

I’m trying to duplicate what you’ve done, but I am stuck.

  1. How do you create a dialog in an ActiveX control?
  2. In your OnDraw() method you have a device context, but is this the
    device context you draw upon or do you draw upon your dialog’s device
    context?
  3. The HWND handle to which you refer, are you using it from the base
    class of the ActiveX control, or the one for the dialog?

Look at the following link for getting a dialog working inside an
ActiveX control:
http://www.codeguru.com/Cpp/COM-Tech/activex/controls/article.php/c2615/

The code snippet I’ve provided comes from the OnInitDialog() function.

Regards
Sascha