DirectX 7 and CBuilder

I have been using DX6.1, where I develloped an application in, but now I switched to DX7 because of some new functions. I copied the libraries in the lib/borland directory of the SDK and and the include files to my CBuilder directory. I changed a bit in the code so the my app is now using the IDD_IDirectDraw7 interface of the object, but the linker returns the following error: "Unresolved external 'DirectDrawCreateX' referenced from C:\DATA\PORT.OBJ."
What should I do to make the program run again?
upanishadiiiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

upanishadiiiAuthor Commented:
Adjusted points to 60
0
nils pipenbrinckCommented:
Hi upanishadiii  (cool name!)

I guess you mean the function DirectDrawCreateEx function...

Well.. I don't wonder that the linker doesn't find the function. The function DirectDrawCreateEx is not in the library file.


If you want to call it (you will) you have to use LoadLibrary to load the ddraw.dll and GetProcAddress to get the pointer to the function (take a look into the api help for those two).

The reason why Microsoft decided not to put this function into the lib is to force us to be compatible with the DirectX 6.1 dll.

If GetProcAddress fails you can display a messagebox that directx is outdated.

This is a lot better than a system-message which complains a non-existent entry-point in a dll (at least for the users side of view).


Cheers,
  Nils
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
upanishadiiiAuthor Commented:
Thanx for this. I'll test it.
F***ing Microsoft.
I've never loaded a DLL before to use DirectX.
I have seen them using it in there examples, without loading the DLL. I know how to do this, but I have to test it.

0
upanishadiiiAuthor Commented:
It worked very well. Less trouble than expected. Thanx for the answer. I'll give you the points. DO you happen to know how it's possible that the RestoreAllSurfaces function doesn't work in Exclusive mode. When I press ALT+TAB it directly gives the error: Surfaces have been lost...
Nothing draws to the surfaces when I deactivate, or hide the application.
I'll give you points for that as well, but I ask it now because Maybe it can take some time before anyone else knows the answer.
0
nils pipenbrinckCommented:
my idea about that alt-tab thing is, that you can only restore the surfaces if your program has the focus.

At least that's what I do when I do directsound streaming. I lock the primary sound buffer. It fails if the user task-switches to another program.

If he however switches back to the game the Restore function succeeds.

Maybe it's the same with the ddraw surfaces here..

btw. if you have graphics/textures loaded they will be trashed after a task-switch. you have to load them again. (at least on my card).

nils
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.