Hey guys,
I have been experimenting with making DLLs in C++. I have been trying to make a message box pop up. Well, it pops up, but it's full of random and strange characters (like trying to open a non-text file in notepad). I tried using casting (I don't really know how but I found a tutorial on how and it got no errors so I was happy), but no matter what I do it just doesn't work. The reason I want it to work is because I'm assuming that if the message box gets messed-up text then anything that uses strings will be messed up. Here is the .cpp code so far:
#include <windows.h>
#include <string>
#define makedll __declspec (dllexport)
makedll int GetValue(void) {
return 42;
}
makedll int GetValue(int a,int b) {
return a + b;
}
makedll void messagebox(LPSTR message, LPSTR title) {
MessageBox(0,(LPCWSTR)message,(LPCWSTR)title,0);
}
And that compiles, and the getvalue things work in DBPro, but the messagebox still gets messed up. I will post my .h and .rc files as well. resource.h:
#define IDS_STRING1 1
#define IDS_STRING2 2
#define IDS_STRING3 3
test9.rc:
#include <windows.h>
#include "resource.h"
STRINGTABLE
{
IDS_STRING1 "GET VALUE[%L%?GetValue@@YAHXZ%Valid calling formats:\ninteger get value()\ninteger get value(integer, integer)"
IDS_STRING2 "GET VALUE[%LLL%?GetValue@@YAHHH@Z%Valid calling formats:\ninteger get value()\ninteger get value(integer, integer)"
IDS_STRING3 "MESSAGE BOX%SS%?messagebox@@YAXPAD0@Z%Message$, Title$"
}
Could someone please help???
EDIT: I'm using Visual Studio C++ 2008 Express, so I have no resource editor.
Clonkex
Making games is easy.....finishing them is a different matter.
Intel Core 2 Duo 2.8Ghz, Nvidia GeForce 9400 GT 512mb, 1gb ram.