Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / OpenFileDialog snippet? dbLoadDLL gone in GDK now?

Author
Message
VRMan3D
19
Years of Service
User Offline
Joined: 3rd Apr 2005
Location: New England
Posted: 10th Feb 2008 02:43
Hi folks,

I'm wondering if someone has a code snippet they wouldn't mind sharing that would pull up a common dialog-OpenFileDialog. I can't seem to get it to work and would appreciate any help.

I used to successfully use a .dll that I wrote (in Purebasic) that worked great with the older version of DarkGDK, but now (*as mentioned elsewhere in this forum) dbLoadDLL and related functions wont compile at all (meaning they were removed as far as I can tell...) And I have yet to find a working example here in the forum of " HANDLE MyDLL = LoadLibrary((LPCWSTR)"vrRequester.dll");" type code that actually seems to work.

Thanks very much,
-=VRMan=-

World Famous 3D Screensavers
-- http://www.vrman3d.com --
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 10th Feb 2008 03:01
I don't have one - but I would use the STOCK LoadLibrary call.

I admit I never finished this but I used this with the new DarkGDK.... and it compiled and loaded my dll ok:

header file


cpp file


I hope this inspires an idea or two at least for you.

VRMan3D
19
Years of Service
User Offline
Joined: 3rd Apr 2005
Location: New England
Posted: 10th Feb 2008 22:03
Hey thanks Jason, I tried adapting your code which is very similar to what I had tried 5 different ways, and it is now just returning a zero when I call LoadLibrary. Even put the full path to the .dll, I don't know what I'm doing wrong.



I did notice that instead of HINSTANCE the LoadLibrary is actually expecting to return an HMODULE.

I think I'm just going to create my own file selector for now so I can move on with the project (my own world editor that I wrote with DarkGDK a while back. Retrofitting it with DarkPhysics capabilities now. And my dll was for selecting a texture to apply to the object, I can just create my own selector in 3D mode I guess...)

World Famous 3D Screensavers
-- http://www.vrman3d.com --
monotonic
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Nottinghamshire, England
Posted: 11th Feb 2008 13:40 Edited at: 11th Feb 2008 13:45
This is a function I've made that creates a standard open file dialog.



Example usage:



The filter/display string must be seperated by '\0' and the last string chunk must be terminated by a double '\0'

Example multi-filter string:



Obviously when using 'string' you must include <string>, also include <globstruct.h> this is needed for the function to get the handles to the instance and window.

Projects Started: 20
Projects Completed: 0
VRMan3D
19
Years of Service
User Offline
Joined: 3rd Apr 2005
Location: New England
Posted: 11th Feb 2008 23:13 Edited at: 11th Feb 2008 23:59
Hiya Monotonic,

This was exactly the type of thing I was looking for to replace the functionality of my DLL (which did the exact same thing but in PureBasic = real easy.)
Unfortunately, your snippets won't compile for me. I'm editing this post after doing some help lookups on what you wrote. Aha, DotNet. I'm guessing you're using gdk.net (??) which I've never touched and know nothing about hehheh.

So for people like myself who are using the (now completely free) DarkGDK bundled with Microsoft Visual C++ 2008 Express Edition, do you or anyone happen to have a version of this that'd work with that? =) It seems like it should be very simple, I've done it so many times in the distant past but this new fangled 2008 stuff doesn't like me I guess... (WindowsForms?? Where did the simple COpenFileDialog Class go? Lol time to buy some new books to read I guess...)

I'm pretty confident that I'm not the only one who would benefit from this. Much appreciated.

Just for completeness I guess, here are the compile errors I got when trying to include it in my project:


I am adding it to a project that I started two years ago using the older DarkGDK, but am now running the latest with DarkPhysics (hooray!).

Let it be known that I'm using:
.......Microsoft Visual C++ 2008 Express Edition
.......DarkGDK version (well honestly not sure of the version but it's the latest and greatest Free 2008 Version as of today: 02/11/08)

Thanks very much for your time and effort!

Best regards,
-=VRMan=-

World Famous 3D Screensavers
-- http://www.vrman3d.com --
monotonic
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Nottinghamshire, England
Posted: 11th Feb 2008 23:40
Sorry about that I forgot to add a couple of extra dependencies in my previous post

I have attached a copy of a project which shows a working example. You also need to set the Project Properties -> C++ -> Code Generation -> Runtime Library value to Multi-threaded (/MT) for debug build, otherwise you will get some incompatibility errors. This has been done in the example project

Projects Started: 20
Projects Completed: 0

Attachments

Login to view attachments
VRMan3D
19
Years of Service
User Offline
Joined: 3rd Apr 2005
Location: New England
Posted: 12th Feb 2008 00:02
Wow you're fast. I just edited my post above rather than posting again (but you beat me to it lol). In a nutshell: .net ? Does it matter? Yep I've never touched 'managed code' so far, so pretty much clueless

I'll download your project right now and give it a go, thanks again for the help.
Best regards,
-=VRMan=-

World Famous 3D Screensavers
-- http://www.vrman3d.com --
monotonic
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Nottinghamshire, England
Posted: 12th Feb 2008 00:18
I don't think you can use MFC stuff directly in your main project, but you can create an MFC DLL and use all the functionality in that and call the DLL from within your GDK project.

The same goes for .NET, you can call managed code from unmanaged code but I haven't got a clue how to do this. I think you need to use COM and register the library on the target system. But that is beyond me, Apex Now is the guy with the know-how on this front.

Projects Started: 20
Projects Completed: 0
VRMan3D
19
Years of Service
User Offline
Joined: 3rd Apr 2005
Location: New England
Posted: 12th Feb 2008 00:18
Aha well that worked flawlessly. Thanks very much once again.

Soo, if you don't know offhand I'll go through comparing your project and mine and try to find all the settings that need to be different to make this work to post here. I tried changing what you mentioned above, same errors. And I tried compiling it in Release mode with the same results.

World Famous 3D Screensavers
-- http://www.vrman3d.com --
monotonic
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Nottinghamshire, England
Posted: 12th Feb 2008 00:38
The points I missed in the original post:

the line:

is required because string is located within this namespace i.e. std::string

Also, this line is needed:


And when you include <string> the Multi-threaded Debug (/MTD) configuration doesn't seem to work for debug mode. I don't know what implications this has, but you can still step through your code in debug mode.

Projects Started: 20
Projects Completed: 0
VRMan3D
19
Years of Service
User Offline
Joined: 3rd Apr 2005
Location: New England
Posted: 12th Feb 2008 01:13 Edited at: 17th Feb 2008 08:43
Well a step closer but I think I'm still missing something major (like the entire .net subsystem perhaps?). With a few changes I got it all to compile with my project, but then was greeted with 55 linker errors doh!

They appear to be in the DGDK stuff and confused by the 'Using namespace std;". I tried several different ways of doing it but failed. Here's a small sampling:


Thanks again for your effort. And Apex or anyone more familiar with compiler settings than I care to comment on what might help? Thanks in advance once again =).

Best regards,
-=VRMan=-
EDIT: Well sadly one of the fans in my xps gen2 laptop failed and toasted my 7800gtx go card =( Setting up dev enviro on another machine now lol. Well, it served me well for several years.

World Famous 3D Screensavers
-- http://www.vrman3d.com --

Login to post a reply

Server time is: 2024-09-29 11:25:03
Your offset time is: 2024-09-29 11:25:03