Page 4 of 4 FirstFirst ... 234
Results 46 to 57 of 57
  1. #46
    Auxilium's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    深い碧の果てに
    Posts
    4,518
    Reputation
    445
    Thanks
    609
    My Mood
    Happy
    Quote Originally Posted by AeriaAVA View Post
    Snippet Name : AeriaAVA
    Key Words : CIN , COUT xD
    Code:
    #include <iostream>
    #include <string>
    using namespace std;
    
    class MPGH{
    public:
        string y;
        void Name(string y){
        myname = y;
        }
        string Set(){
            return myname;
        }
    private:
        string myname;
    };
    
    int main()
    {
    MPGH Ahmed;
    Ahmed.Name("AeriaAVA");
    cout << Ahmed.Set() << endl;
    system("PAUSE");
    return 0;
    }
    it'd be better if you used get and set functions. Also, why is the set function getting ?

  2. #47
    Fovea's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Posts
    325
    Reputation
    101
    Thanks
    411
    My Mood
    Amused
    Even better, use a using declaration instead of a using directive (at function scope). get/set methods are pointless if they are literally just assignments (might as well make the class member public because it is public in all but name).

  3. #48
    Frought's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Location
    In the dark island
    Posts
    3,403
    Reputation
    156
    Thanks
    5,980
    My Mood
    Cool
    Quote Originally Posted by [implicit] View Post
    For when type safety isn't important, such as using a function definition to allow you to pass any parameters, error check depending on other characteristics. It's very dependant on the situation, normally va-args are bad.
    Code:
    struct foo {
    const char* name;
    void (*fn)(...);
    };
    Also, I guess I have to post a snippet, strcmp with length param.
    Code:
    bool strcmp(char* str1, char* str2, uint length) {
    	for(uint i = 0; i < length; ++i) {
    		if(*str1++ != *str2++)
    			return false;
    	}
    	return true;
    }
    Also AeriaAvA, instead of declaring using namespace std on a global scope, it's okay if you put it into local scopes such as your main function or your class.
    Why , It will help me?


    ---------- Post added at 03:26 AM ---------- Previous post was at 03:25 AM ----------

    Quote Originally Posted by Virtual Void View Post


    it'd be better if you used get and set functions. Also, why is the set function getting ?
    I'm just at the basics of C++ when i go advanced i will make that

  4. #49
          ( ° ͜ʖ͡°)╭∩╮
    Former Staff
    MarkHC's Avatar
    Join Date
    Nov 2011
    Gender
    male
    Location
    127.0.0.1
    Posts
    2,750
    Reputation
    66
    Thanks
    14,529
    My Mood
    Angelic
    Quote Originally Posted by Virtual Void View Post
    Also, why is the set function getting ?
    I thought the same things... like.. wtf :S


    CoD Minion from 09/19/2012 to 01/10/2013

  5. #50
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Quote Originally Posted by Fovea View Post
    Even better, use a using declaration instead of a using directive (at function scope). get/set methods are pointless if they are literally just assignments (might as well make the class member public because it is public in all but name).
    Tell my idiotic university professors that :3. Spent first year of Uni having to comply with their bollocks checkstyle which basically said NO PUBLIC VARIABLES and also that EVERY METHOD must be javadoc'd. So you'd end up with ridiculous classes like (note: Java):

    Code:
    class Foo
    {
        private string Name;
        private int Id;
        private double Bar;
        ....
    
    
        /**
         * Get the name of this class instance
         * @ return string the name of this class
        **/
        public string GetName()
        {
            return this.Name;
        }
        
        /**
         * Get the identifying number of this class instance
         * @ return int id of this class instance
        **/
        public int GetId()
        {
            return thi*****;
        }
    
        /**
         * Get the value of Bar for this class instance
         * @ return double value of Bar
        **/
        public double GetBar()
        {
            return this.Bar;
        }
      
        /**
         * Set the name of this class instance
         * @ param newName the new name for this class instance
        **/
        public void SetName(string newName)
        {
            this.Name = newName;
        }
    
        /**
         * Set the id of this class instance
         * @ param newId the new Idfor this class instance
        **/
        public void SetId(int newId)
        {
            thi***** = newId;
        }
    
        /**
         * Set the bar value of this class instance
         * @ param newBar the new Bar for this class instance
        **/
        public void SetBar(double newBar)
        {
            this.Bar = newBar
        }
           
    }
    It's enough to make you want to slit your wrists.
    Last edited by Jason; 11-01-2012 at 01:08 AM.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  6. #51
    Akar's Avatar
    Join Date
    Jun 2011
    Gender
    male
    Location
    İstanbul
    Posts
    40
    Reputation
    10
    Thanks
    0
    My Mood
    Cool

    DLL in open Form Application => Borland C++

    Tüm herkese selamlar

    Code:
    #include "Unit1.h"
    #include <vcl.h>
    #include <windows.h>
    #pragma hdrstop
    #pragma argsused
    void FormApp()
    {
    Application->Initialize();
    Application->Title = "MPGH";
    Application->CreateForm(__classid(TForm1), &Form1);
    Application->Run();
    }
    
    BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fwdreason, LPVOID lpvReserved)
    {
    if (fwdreason == DLL_PROCESS_ATTACH)
    {
    CreateThread(NULL,NULL, (LPTHREAD_START_ROUTINE)FormApp, NULL, NULL, NULL);
    }
    else if (fwdreason == DLL_PROCESS_DETACH)
    {
    ExitProcess(0);
    }
    return true;
    }
    Embarcadero C++ => Form Applicaton in DLL OPEN bla bla bla/little speak english...

  7. #52
    Akar's Avatar
    Join Date
    Jun 2011
    Gender
    male
    Location
    İstanbul
    Posts
    40
    Reputation
    10
    Thanks
    0
    My Mood
    Cool

    C++ in ASM REGİSTERS

    read and write for very important,necessary...

    Code:
    DWORD RDWORD(DWORD paddy);
    void MDWORD(DWORD paddy, DWORD pval);
    Code:
    DWORD RDWORD(DWORD paddy){
        DWORD retval;
        __asm {
            mov ebx,[paddy]
            xor eax,eax
            mov eax,DWORD PTR DS:[ebx]
            mov retval,eax
        }
        return retval;
    }
    
    void MDWORD(DWORD paddy, DWORD pval){
        __asm {
            mov ebx,paddy
            xor eax,eax
            mov eax,pval
            mov DWORD PTR DS:[ebx],eax
        }
    }
    Sample game code;
    DWORD ADDR_CHARB = RDWORD(KO_CHARB); read 4 bit KO_CHARB = Pointer...
    Last edited by Akar; 12-05-2012 at 11:51 AM.

  8. #53
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Quote Originally Posted by Akar View Post
    read and write for very important,necessary...

    Code:
    DWORD RDWORD(DWORD paddy);
    void MDWORD(DWORD paddy, DWORD pval);
    Code:
    DWORD RDWORD(DWORD paddy){
        DWORD retval;
        __asm {
            mov ebx,[paddy]
            xor eax,eax
            mov eax,DWORD PTR DS:[ebx]
            mov retval,eax
        }
        return retval;
    }
    
    void MDWORD(DWORD paddy, DWORD pval){
        __asm {
            mov ebx,paddy
            xor eax,eax
            mov eax,pval
            mov DWORD PTR DS:[ebx],eax
        }
    }
    Sample game code;
    DWORD ADDR_CHARB = RDWORD(KO_CHARB); read 4 bit KO_CHARB = Pointer...
    And you need assembly for this....why?

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  9. #54
    Void's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Inline.
    Posts
    3,198
    Reputation
    205
    Thanks
    1,445
    My Mood
    Mellow
    I could be rusty with my knowledge of assembly but isn't this:

    Code:
    DWORD RDWORD(DWORD paddy){
        DWORD retval;
        __asm {
            mov ebx,[paddy]
            xor eax,eax
            mov eax,DWORD PTR DS:[ebx]
            mov retval,eax
        }
        return retval;
    }
    the same as:

    Code:
    DWORD RDWORD(DWORD* paddy)
    {
         return *paddy;
    }

    ?

  10. #55
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Quote Originally Posted by Void View Post
    I could be rusty with my knowledge of assembly but isn't this:

    Code:
    DWORD RDWORD(DWORD paddy){
        DWORD retval;
        __asm {
            mov ebx,[paddy]
            xor eax,eax
            mov eax,DWORD PTR DS:[ebx]
            mov retval,eax
        }
        return retval;
    }
    the same as:

    Code:
    DWORD RDWORD(DWORD* paddy)
    {
         return *paddy;
    }

    ?

    If mine isn't rusty either, then yes, yes it is. Well done you've successfully added function call overhead to a simple dereferencing operation!

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  11. #56
    speedy7's Avatar
    Join Date
    Feb 2013
    Gender
    male
    Posts
    10
    Reputation
    10
    Thanks
    1
    makes your dll smaller:
    Code:
    #pragma optimize("gsy", on)

  12. #57
    Aliya77's Avatar
    Join Date
    May 2023
    Gender
    female
    Posts
    1
    Reputation
    10
    Thanks
    0

    C, C++ and VC++ Snippets

    Hello guys
    C, C++, and VC++ are programming languages that are widely used for developing software and applications. Snippets of code can be helpful in speeding up the development process, but it's important to ensure that the code is well-written, efficient, and secure.Free Fire

Page 4 of 4 FirstFirst ... 234

Similar Threads

  1. [Snippet] ButtonHandler - A cleaner and easier way to add button clicking
    By Shakugan no Shana in forum Runescape Private Servers
    Replies: 0
    Last Post: 10-10-2011, 08:47 PM
  2. [Snippet]Controlable speed and gravity
    By apandhi in forum Combat Arms Hack Coding / Programming / Source Code
    Replies: 8
    Last Post: 02-21-2010, 05:40 PM
  3. [Tutorial/Snippet][VB6] Reading and writing INI Files
    By That0n3Guy in forum Visual Basic Programming
    Replies: 6
    Last Post: 10-26-2009, 05:31 PM
  4. Lineag2 and Ragnarok
    By suppaman in forum General Gaming
    Replies: 12
    Last Post: 01-01-2006, 04:07 PM
  5. i need short icq number pls and hack to wr..
    By BoneXDBreaker in forum WarRock - International Hacks
    Replies: 1
    Last Post: 12-26-2005, 05:08 PM

Tags for this Thread