Sign in to follow this  
Followers 0
NestyIvan

DxViewer as child window

4 posts in this topic

Hello everyone!

I've met some trouble with DxViewer programm that is contained at the DX SDK(I'm using 2007). What do I want is to run DxViewer as a child inside my own WinAPI window. I've googled so much but yet I didn't found anything helpful.

1. I compiled DxViewer from SDK as DLL.
2. Created my own project and included that DLL to it. I've declared main function of DxViewer as extern with additional parameter - HWND hwnd (handle to my own window)
3. FIrstable, my project failed on CreateMainDialog function. So I've commented code that creating dialog handle and send to STATE_SET handle to my window:
[CODE]
bool App::CreateMainDialog( HWND hparent)
{
STATE_SET(Dialog, hparent);
return true;
}
[/CODE]
Actually, I think that here is the root of my problems, but DxViewer has runned inside my window.
4. Error occures when I try to open a model ".x". Function FindResource that is calling in SASCreateEffectFromResource return NULL and after that pfogramm is falling.
[CODE]
RESULT WINAPI
SASCreateEffectFromResource(
LPDIRECT3DDEVICE9 pDevice,
HMODULE module,
LPCWSTR resName,
LPCWSTR resType,
CONST D3DXMACRO* pDefines,
LPD3DXINCLUDE pInclude,
DWORD Flags,
LPD3DXEFFECTPOOL pPool,
LPD3DXEFFECT* ppEffect,
LPD3DXBUFFER* ppCompilationErrors)
{
HRESULT hr = S_OK;
HRSRC hSrc= FindResource(module, resName, resType);
if(hSrc == NULL)
return E_FAIL;
...
}
[/CODE]

When I debugging original DxViewer, FindResource return normal pointer so the model is loading correctly. And I just can't get it - why the same function with the same parameters is return different values.
0

Share this post


Link to post
Share on other sites
[quote name='NestyIvan' timestamp='1349803199' post='4988416']

I've met some trouble with DxViewer programm that is contained at the DX SDK(I'm using 2007). What do I want is to run DxViewer as a child inside my own WinAPI window. I've googled so much but yet I didn't found anything helpful.

[/quote]

i dont understand what you're trying todo, DxViewer is a program exe, what do you mean you want to run that as a child?
0

Share this post


Link to post
Share on other sites
[quote name='Anddos' timestamp='1349939819' post='4988998']
DxViewer is a program exe, what do you mean you want to run that as a child?
[/quote]

Yes, it is. And I need that nice "viewer" features within my program. I need to load, view, zoom and twist a model. Exactly what DxViewer can do! [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]
Actually, I've already run DxViewer inside my application. I've added extern function into DxViewer project, changed settings from '.exe' application to dynamic lybrary and then just called that extern function from the library.
As I said before it's worked, but probably I should create DxViewer's main dialog in a different way. Becouse it's the only part of the original code that I changed. Edited by NestyIvan
0

Share this post


Link to post
Share on other sites
[quote name='NestyIvan' timestamp='1349965305' post='4989108']
[quote name='Anddos' timestamp='1349939819' post='4988998']
DxViewer is a program exe, what do you mean you want to run that as a child?
[/quote]

Yes, it is. And I need that nice "viewer" features within my program. I need to load, view, zoom and twist a model. Exactly what DxViewer can do! [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]
Actually, I've already run DxViewer inside my application. I've added extern function into DxViewer project, changed settings from '.exe' application to dynamic lybrary and then just called that extern function from the library.
As I said before it's worked, but probably I should create DxViewer's main dialog in a different way. Becouse it's the only part of the original code that I changed.
[/quote]

so why dont you use the .x utilty function with some windows api that opens a file from a directory you select?
0

Share this post


Link to post
Share on other sites
Well, finally we've done it!
The general problem was that DxViewer functions that load resources are use NULL handler for environment. When we set it to DxVewer.dll it works!
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0