|
-
May 5th, 2011, 04:53 AM
#1
Thread Starter
Fanatic Member
C++ File
Hello,
Can someone tell me how to do this:
I'm begginer with c++ i had just started learning the book and i want some help to learn something
Can someone learn me how to make this:
I use : Visual Studio 2010
The job is this:
Code :
Code:
/*Бърз и прост начин за заместване на краш команда
//AntiCrash Prevent
*/
for(int X=0; X < (int)strlen(Message);X++){
if(Message[X] == '%'){
Message[X] = '"';
}
}
How to make this source to be a .dll file with name (for example: MFS.dll) and this file to read information from an .ini file (for example: MFS.ini, the .ini file must to be in the same folder where it is the .dll file if its not to show error that cant find the file MFS.ini (or you can show me how to put a path to read the file from other folder that will be good too to learn))
MFS.ini:
[code]
// Разрешаване на проблема с краш командата
// Fix The Crash Problem
FixCrash = 1; // (0-Disable,1-Enable)
If in the MFS.ini on the line
FixCrash = 1;
To use the source code as enabled , if its 0 to be disabled (not to use the source code)
I will be in grat if someone learn me how to make this,
Thanks in advance
-
May 5th, 2011, 05:31 AM
#2
Re: C++ File
To build your project as a DLL, go into your project properties and take a look under Configuration properties > General. Make sure the setting "Configuration type" is set to Dynamic Library (.dll).
To read data from files, take a look at the ifstream class.
-
May 5th, 2011, 06:40 AM
#3
Thread Starter
Fanatic Member
Re: C++ File
so for check if file exist is with : GetFileAttributes()
but how should i add it right, can you give me example
to read info from .ini file should be : GetPrivateProfileString()
can you also add a example how should do it so to add it in the source code to work
-
May 5th, 2011, 06:48 AM
#4
Re: C++ File
I have never used GetPrivateProfileString, and I dont think I would seeing as its not very portable for something so trivial as reading a file. But ok, use GetPrivateProfileString.
The documentation for the function is on MSDN, give it a try first.
-
May 5th, 2011, 08:30 AM
#5
Thread Starter
Fanatic Member
Re: C++ File
i want to ask something i got underline for the word "for"
here is the normal view of the code for the .dll (only simply .dll file)
Code:
// MFS.cpp : Defines the exported functions for the DLL application.
//
#include "stdafx.h"
#include <iostream>
/*Бърз и прост начин за заместване на краш команда
//AntiCrash Prevent
*/
for(int X=0; X < (int)strlen(Message);X++){
if(Message[X] == '%'){
Message[X] = '"';
}
}
In the red i make the word that is underline for me and i got error:
IntelliSense: expected a declaration
how to fix it?
-
May 5th, 2011, 08:40 AM
#6
Re: C++ File
This is really an unrelated question, but the reason is that your code is not contained within a function. Think about it, when would this code run if it is not contained in a function?
-
May 5th, 2011, 08:45 AM
#7
Thread Starter
Fanatic Member
Re: C++ File
can you tell me something to make it work, to make some function with this source code so that to work normal, please help
-
May 5th, 2011, 09:21 AM
#8
Re: C++ File
That depends completely on what you're wanting to do. Are you saying you don't know how to write a function?
-
May 5th, 2011, 09:35 AM
#9
Thread Starter
Fanatic Member
Re: C++ File
i had just started learning c++, but 1 friend ask me to make an .dll file with this source code for fixing a problem in one gameserver, thats why i want help to make it
i tryed something like this but not work (in Red is underline) , please help me to build 1 project then i will try make it by myself i just need expiriance and support
Code:
// MFS.cpp : Defines the exported functions for the DLL application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
/*Бърз и прост начин за заместване на краш команда
//AntiCrash Prevent
*/
int main ()
{
for(int X=0; X < (int)strlen(Message);X++){
if(Message[X] == '%'){
Message[X] = '"';
}
}
return 0;
}
-
May 5th, 2011, 09:38 AM
#10
Re: C++ File
How should this DLL be used? Seeing as you have identified a need for a DLL, you must also have an idea what functions the DLL should provide.
-
May 5th, 2011, 09:50 AM
#11
Thread Starter
Fanatic Member
Re: C++ File
this .dll should be used by hooking it inside a gameserver.exe (program)
-
May 7th, 2011, 02:53 AM
#12
Re: C++ File
ok, what functions does your dll need to provide?
are you able to provide more information as to what this gameserver.exe is and what your dlls purpose is?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|