QuestionNew to C++, Need Professional Help.

Posts 110 of 10 · Page 1 of 1
New to C++, Need Professional Help.
Hello MPGH Community.


I was just introduced to C++ and I would really appreciate help. I understand some of you people don't like choobs coming here asking for help because they think c++ is so easy. Well I know its a very difficult thing to understand and it takes time. Its like playing guitar, it wont make you a rock star in a few weeks. If anyone who has good experience with coding I would like to have some help and if it takes months I'm willing to wait. If you want I could pay you for assistance for nexon cash for Combat arms. I know I seem like those noobs who keep asking for a guy who knows coding to help, but I think this would be a good activity for me to try over the winter.
What do you hope to accomplish with C++? Hacks or developing practical applications?
Go check some C++ tutorials. Read through the entire tutorial and do not skip parts. If you do that, come to me and I'll see if I feel like training you.

LOL XFAITH I LOVE YOU SIG =P
Wow, i wish ppl would look around before posting shit like this.
Start VC++ IDE , select New from File menu. Then select Win32 Dynamic - link library from Projects tab(picture-1). enter project name as example1 , then click OK button. Now you can see a dialog box with caption Win32 Dynamic - Link library - step 1 of 1 (picture-2).


Picture 1


Picture 2

Select a simple DLL project and click Finish. Now open exaple1.cpp from fileview (picture-3)


Picture 3

add these lines in to example1.cpp

int _stdcall sum(int x , int y)
{
return x+y;
}

It is a simple function which returns the sum of numbers passed to it.

Now our function is ready. The next step is to create a ‘.def’ file which informs the linker to export our function.Select New from File menu and then select text File from Files tab. Give it a name example1.def. Now you can see an empty file . Add these lines in to example1.def

LIBRARY EXAMPLE1

EXPORTS
sum @1

Select Build example1.dll from build menu. The build process should complete without any errors. If any error occurs , correct it and rebuild again. Once the build process is completed successfully , you can see example1.dll in debug directory.

Now we have successfully built the Dll and it is the time to test it. For testing the DLL we have to write a small program in VB. Open a new project in Visual Basic. Place three text box and a command button like in picture 4.


Picture 4

Copy the code given bellow , to the code window

Private Declare Function sum Lib "example1.dll" (ByVal x As Long, ByVal y As Long) As Long Private Sub Command1_Click()
Text3.Text = Str(sum(CInt(Text1.Text), CInt(Text2.Text)))
End Sub

copy example 1.dll to windows or system directory . Then run VB ,enter some values to text1 and text2 and click Calculate button. If you can see the sum in text3, you have completed example1 successfully ! congratulations !.

Download the source code and project files for example1

Example 2

Objective
Create a DLL that contains a function to convert lowercase chars to uppercase and return the result.

Tools required

visual C++ 6 , Visual basic 6

Writing The DLL

Create a new win32 DLL project in VC++ just like in the previous example. insert the statement given below before main

#include string.h

Insert the following code after main

char* _stdcall to_upper(char *lowerstring)
{
_strupr(lowerstring);
return lowerstring;
}

Create a def file and insert the following code

LIBRARY example2

EXPORTS
to_upper @1

Now save the project, build it and copy example2.dll to windows or system directory.

Create a new project in VB, place a text box and command button the form paste the following code to code window.

Private Declare Function to_upper Lib "example2.dll" (ByVal text As String) As String

Private Sub Command1_Click()

If (Text1.text) = "" Then
Exit Sub
End If

MsgBox to_upper(Text1.text)
End Sub

Run the program and enter some lower case characters in textbox.It should display a messagebox with same characters with case changed.

Download the source code and project files for example2



Example 3

Objective

Create a DLL which can read/write data to parallel port

This DLL is a very useful for interfacing parallel/serial ports. Since Visual Basic does not have any facility to communicate with parallel port directly , programmers will have to write code for accessing parallel port in a DLL and should be called from VB. In this DLL , in this dll , accessing the device registers is done using functions _Inp() and _Outp(), which is declared in ‘conio.h’ . More details about these functions can be found at MSDN online .

We will export two functions from the DLL.One is for reading from a device register and the other is for writing to the device register. Let these functions be InPort() and OutPort(). InPort() will take one parameter ie; the address of the register to be read. and Outport will take two ie; the address of the register to which the data to be written and the data itself.

Note: to do this project , You need to have some knowledge in Parallel port interfacing.

Tools required

visual C++ 6 , Visual basic 6

Writing The DLL

Create a new win32 DLL project in VC++ like in the previous examples. insert the statement given below before main

#include conio.h

Insert the following code after main

short _stdcall InPort(short portaddress)
{
return _inp(portaddress);
}

void _stdcall OutPort(short portaddress,short data)
{
_outp(portaddress,data);
}

create a .def file with name example3.def and insert the following code

LIBRARY example3

EXPORTS

InPort @1
OutPort @2

now save the project and build example3.dll.
for testing the dll , create a new project in visual basic.Create a form like in picture5.



Picture 5

Add the following code to code window

Private Declare Function InPort Lib "example3.dll" (ByVal portaddress As Integer) As Integer Private Declare Function OutPort Lib "example3.dll" (ByVal portaddress As Integer, ByVal data As Integer) As Integer

Private Sub Command1_Click()
OutPort 888, 10 'Val("&h" + Text2.Text), Val(Text1.Text)
End Sub

Private Sub Command2_Click()
Text3.Text = Str(InPort(Val("&h" + Text2.Text))
End Sub

Run the program and enter some value in text1. the n click Write it button. Again click the Read it button , now if text2 displays the number which you entered in text1 , your dll is working successfully.

DONT FORGET TO THANK ME!!!!!
Quote Originally Posted by miksdubom View Post
Start VC++ IDE , select New from File menu. Then select Win32 Dynamic - link library from Projects tab(picture-1). enter project name as example1 , then click OK button. Now you can see a dialog box with caption Win32 Dynamic - Link library - step 1 of 1 (picture-2).


Picture 1


Picture 2

Select a simple DLL project and click Finish. Now open exaple1.cpp from fileview (picture-3)


Picture 3

add these lines in to example1.cpp

int _stdcall sum(int x , int y)
{
return x+y;
}

It is a simple function which returns the sum of numbers passed to it.

Now our function is ready. The next step is to create a ‘.def’ file which informs the linker to export our function.Select New from File menu and then select text File from Files tab. Give it a name example1.def. Now you can see an empty file . Add these lines in to example1.def

LIBRARY EXAMPLE1

EXPORTS
sum @1

Select Build example1.dll from build menu. The build process should complete without any errors. If any error occurs , correct it and rebuild again. Once the build process is completed successfully , you can see example1.dll in debug directory.

Now we have successfully built the Dll and it is the time to test it. For testing the DLL we have to write a small program in VB. Open a new project in Visual Basic. Place three text box and a command button like in picture 4.


Picture 4

Copy the code given bellow , to the code window

Private Declare Function sum Lib "example1.dll" (ByVal x As Long, ByVal y As Long) As Long Private Sub Command1_Click()
Text3.Text = Str(sum(CInt(Text1.Text), CInt(Text2.Text)))
End Sub

copy example 1.dll to windows or system directory . Then run VB ,enter some values to text1 and text2 and click Calculate button. If you can see the sum in text3, you have completed example1 successfully ! congratulations !.

Download the source code and project files for example1

Example 2

Objective
Create a DLL that contains a function to convert lowercase chars to uppercase and return the result.

Tools required

visual C++ 6 , Visual basic 6

Writing The DLL

Create a new win32 DLL project in VC++ just like in the previous example. insert the statement given below before main

#include string.h

Insert the following code after main

char* _stdcall to_upper(char *lowerstring)
{
_strupr(lowerstring);
return lowerstring;
}

Create a def file and insert the following code

LIBRARY example2

EXPORTS
to_upper @1

Now save the project, build it and copy example2.dll to windows or system directory.

Create a new project in VB, place a text box and command button the form paste the following code to code window.

Private Declare Function to_upper Lib "example2.dll" (ByVal text As String) As String

Private Sub Command1_Click()

If (Text1.text) = "" Then
Exit Sub
End If

MsgBox to_upper(Text1.text)
End Sub

Run the program and enter some lower case characters in textbox.It should display a messagebox with same characters with case changed.

Download the source code and project files for example2



Example 3

Objective

Create a DLL which can read/write data to parallel port

This DLL is a very useful for interfacing parallel/serial ports. Since Visual Basic does not have any facility to communicate with parallel port directly , programmers will have to write code for accessing parallel port in a DLL and should be called from VB. In this DLL , in this dll , accessing the device registers is done using functions _Inp() and _Outp(), which is declared in ‘conio.h’ . More details about these functions can be found at MSDN online .

We will export two functions from the DLL.One is for reading from a device register and the other is for writing to the device register. Let these functions be InPort() and OutPort(). InPort() will take one parameter ie; the address of the register to be read. and Outport will take two ie; the address of the register to which the data to be written and the data itself.

Note: to do this project , You need to have some knowledge in Parallel port interfacing.

Tools required

visual C++ 6 , Visual basic 6

Writing The DLL

Create a new win32 DLL project in VC++ like in the previous examples. insert the statement given below before main

#include conio.h

Insert the following code after main

short _stdcall InPort(short portaddress)
{
return _inp(portaddress);
}

void _stdcall OutPort(short portaddress,short data)
{
_outp(portaddress,data);
}

create a .def file with name example3.def and insert the following code

LIBRARY example3

EXPORTS

InPort @1
OutPort @2

now save the project and build example3.dll.
for testing the dll , create a new project in visual basic.Create a form like in picture5.



Picture 5

Add the following code to code window

Private Declare Function InPort Lib "example3.dll" (ByVal portaddress As Integer) As Integer Private Declare Function OutPort Lib "example3.dll" (ByVal portaddress As Integer, ByVal data As Integer) As Integer

Private Sub Command1_Click()
OutPort 888, 10 'Val("&h" + Text2.Text), Val(Text1.Text)
End Sub

Private Sub Command2_Click()
Text3.Text = Str(InPort(Val("&h" + Text2.Text))
End Sub

Run the program and enter some value in text1. the n click Write it button. Again click the Read it button , now if text2 displays the number which you entered in text1 , your dll is working successfully.

DONT FORGET TO THANK ME!!!!!
Nice copy and paste.
Yeh umm wdf is that? Is this supposed to be simple cuz i don't get it....

@qdude11: I honestly recommend you go down to your local library and check out a book for beginners in C++ or C++ basics. No one can teach you everything. Learn what you can from the book. You can always post a question on the forums if there is something you don't understand.

Learning to code is not hard you need three things:
1. A good book
2. A computer
3. A compiler (Search Google for Bloodshed Dev-C++, I think it is very easy to use)
thank you but ive had a few weeks of making simple programs. no i do not think i will be totally successful and make working hacks but i would like to learn to program. i find it to be fun.
I'm going to start learning C++ and will try to makes hacks will anyone help me start off on making hacks after i start making simple programs and help me advance in my hacking skillz
Quote Originally Posted by qdude11 View Post
Hello MPGH Community.


I was just introduced to C++ and I would really appreciate help. I understand some of you people don't like choobs coming here asking for help because they think c++ is so easy. Well I know its a very difficult thing to understand and it takes time. Its like playing guitar, it wont make you a rock star in a few weeks. If anyone who has good experience with coding I would like to have some help and if it takes months I'm willing to wait. If you want I could pay you for assistance for nexon cash for Combat arms. I know I seem like those noobs who keep asking for a guy who knows coding to help, but I think this would be a good activity for me to try over the winter.
Don't assume all members of the community will not help you because you are choob. My advice would to get a c++ book from your local library ( I like sams teach yourself, just an opinion) and read online tuts such as this one: C++ Language Tutorial . THis is not the easiest language to learn and if this is your first language try something simpler first to get the hang of coding. Good luck.
Posts 110 of 10 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

Need help?