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.

DLL Talk / [STICKY] Making a DLL with VC++ Express

Author
Message
Pharoseer
17
Years of Service
User Offline
Joined: 21st Feb 2007
Location: Right behind you
Posted: 29th Jan 2010 12:10 Edited at: 29th Jan 2010 12:14
I don't know if this will help anyone, but I found the string tables to be the hardest part of learning this process. VC++ seems very picky and didn't like some of the additions that ResEdit (a free resource file editing tool) was making.

I've created a very simple example that is almost identical to the TESTCOMMANDS project, but stripped down to the bare essentials. This is more an example than a tutorial, but I will share a few things I encountered along the way.

All the files were edited in VC++. To edit a resource (.rc) file simply add a new file. You can select .h or .cpp as the file type it doesn't matter, just make sure to add the .rc extension when you name it. Once you've created your first .rc file, drag it into the code editing window and a pop-up should appear. You can select the default code editor as your resource file editor if you like and then you'll be able to edit them from within VC++ with minimal fuss.

Once that is done you're ready to go. Most of what you'll find in my example is already found in the DBPro help (look under Technical Documents->Third Party Commands they'll explain things better than I can). My reason for posting was simply to provide a complete working example that used VC++ Express and was as short and sweet as possible.

Here's what I came up with.

resource.h


MyFirstDLL.rc


MyFirstDLL.cpp


One thing I didn't notice in the DBPro help files was an example of function overloading. There's nothing difficult about doing it, but I figured it couldn't hurt to show just how easy it really is. I also had an interesting idea for the optional data in the string table (which I've never actually paid attention to before). Namely the parts that read:



If you call the function with an incorrect parameter list, you can use that method to have the compiler report valid command lists to the user. (For anyone not familiar with C/C++ the "\n" informs the system to step to the next line.)

So if we supplied an invalid parameter list to our get value() function the compiler error would actually look something like the following:



Anyway, I hope this helps somebody. Also, if I'm overlooking something or spreading any misinformation, please let me know.

Cheers,
-Frank
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 29th Jan 2010 14:14
Thanks for the easy instructions on adding resource strings manually.

Also, great idea for the parameter list - the only downside that I can think of is that it bloats the resources a little, but that's nothing to the amount of clarity it provides for the error messages.

Mnemonix
21
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: Skaro
Posted: 9th Mar 2010 11:05
Great work, this answers a lot of questions and I think this information is invaluable because it allows people to expand DBP easily with software that is both great and free.

Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 9th Apr 2010 07:12 Edited at: 9th Apr 2010 07:13
I was trying to follow along here because I've been wanting to make a DBP plugin, and all I've got is VC++ Express to make it in.

I made the DLL code, but I'm having problems with the resource file.

I did as you said and selected to add a new file to the project. I selected ".cpp" for the file type and gave it the name "MyDLL.rc". It then brought the workspace navy to the resources tab and this is what I see. (See attached pic)

If I try to drag it into the code editing pane, all it does it drag in the error text or the name of the file.


I've no idea what to do here. Any suggestions?


The one and only,


Attachments

Login to view attachments
Diggsey
17
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 9th Apr 2010 21:03
Right click and choose view code.

Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 9th Apr 2010 23:08
Right clicking doesn't bring up a menu on the resource files.

EDGECOM
17
Years of Service
User Offline
Joined: 7th Sep 2006
Location: US
Posted: 30th Apr 2010 14:25
you might find this usefull


http://www.resedit.net/
cloudy
13
Years of Service
User Offline
Joined: 30th Jun 2010
Location:
Posted: 5th Jul 2010 10:25
thank you! it's useful.

Your signature has been erased by a mod
Clonkex
Forum Vice President
13
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 18th Aug 2010 04:07 Edited at: 18th Aug 2010 04:08
Hey guys,

After I made all three files that Pharoseer said to make, I pressed F7 to build the thing and got this error:



I am not experienced with VC++ but I have VC++ 2008 Express.....just got it this morning. I have been fiddling with it and trying to work it out, it's so much more complex than DBPro! I reckon Microsoft has no idea how to make a good IDE, and I find the help files especially annoying. They are to much text and not enough graphics.

Anyway could someone tell me the problem please?

Clonkex

PS I put resource.h in Header Files, myfirstdll.rc in Resource Files, and myfirstdll.cpp in Source Files.

Making games is easy.....finishing them is a different matter.

Intel Core 2 Duo 2.8Ghz, Nvidia GeForce 9400 GT 512mb, 1gb ram.
Hassan
14
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 5th Sep 2010 14:32
in resource.h add 2-4 empty lines at the end, i dont really know why this occurs (probably a bug), but i always solve it adding the empty lines

Clonkex
Forum Vice President
13
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 7th Oct 2010 12:01
Ok I will try that. Thanks in advance.

Clonkex

Making games is easy.....finishing them is a different matter.

Intel Core 2 Duo 2.8Ghz, Nvidia GeForce 9400 GT 512mb, 1gb ram.
Clonkex
Forum Vice President
13
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 13th Oct 2010 04:58 Edited at: 13th Oct 2010 05:02
YES!!! IT WORKS!!!

Sorry, I'm just a bit over-excited, cause now I can make my GUI plugin an actual plugin! YAY!!!

[doing a little dance]

Thankyou very much, Hassan. You fixed Pharoseer's error!

EDIT: So excited I misspelled my name!

Clonkex

Making games is easy.....finishing them is a different matter.

Intel Core 2 Duo 2.8Ghz, Nvidia GeForce 9400 GT 512mb, 1gb ram.
the SCRIPT
13
Years of Service
User Offline
Joined: 7th Dec 2010
Location:
Posted: 7th Dec 2010 19:37
can you help my I'm from Holland so my english isn't well but I want to know more about DLL files.

so, start at the beginning, like some codes with there explanation

already thanks
the SCRIPT

making games is easy, learning the scripts isn't
Clonkex
Forum Vice President
13
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 7th Dec 2010 21:13
I am currently writing a tutorial for making DLLs with Visual Studio 2008 Express Edition and it will be finished soon so just hang on.

Clonkex

Making games is easy.....finishing them is a different matter.

Intel Core 2 Duo 2.8Ghz, Nvidia GeForce 9400 GT 512mb, 1gb ram.
the SCRIPT
13
Years of Service
User Offline
Joined: 7th Dec 2010
Location:
Posted: 8th Dec 2010 10:47
I wil
thanks

making games is easy, learning the scripts isn't
the SCRIPT
13
Years of Service
User Offline
Joined: 7th Dec 2010
Location:
Posted: 13th Dec 2010 10:00
where can I get Microsoft VC + + Express Free

making games is easy, learning the scripts isn't
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 15th Jan 2011 19:24
From Microsoft - Google is your friend.

Login to post a reply

Server time is: 2024-03-29 08:12:18
Your offset time is: 2024-03-29 08:12:18