Thread: dll help...

  1. #1
    Registered User
    Join Date
    Aug 2004

    dll help...

    I am making dlls for Game Maker. There is a certain way to make them. Here is the code to make a function...

    extern "C" __declspec(dllexport) __stdcall double rh_deletefile(LPCTSTR arg1);
    extern "C" __declspec(dllexport) __stdcall double rh_deletefile(LPCTSTR arg1)
        //functions stuff here
        return 0;  //it has to return somthing or it won't work
    The rest of the code doesnt' matter, that all works. Now notice the LPCTSTR arg1. I belive most people know what that is. But if you don't that is how I transfer stuff between game maker and the dll basicly. (gives more flexability). So heres the probelem.

    I want a function that gives the computers name (for example). Now I can not return it because it is a word nto a number. I need to know how I can return it or somthing so I can send it to Game Maker.

    Here is the code so far...

    extern "C" __declspec(dllexport) __stdcall double rh_getcomputername();
    extern "C" __declspec(dllexport) __stdcall double rh_getcomputername()
        LPTSTR computername;
        DWORD* size;
        return 0;
    I only need computername, not the size.

    I'm not sure at all how I would do this. Please help me.

    Oh and sending it to a variable throw the code here and then trying to call the cariable throw Game Maker doesn't work, I just tired that.

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
        #include <windows.h>
        TCHAR computername[MAX_COMPUTERNAME_LENGTH + 1];
        DWORD sz = sizeof(computername) / sizeof(*computername);
        BOOL ret = GetComputerName(computername, &sz);

  3. #3
    Registered User
    Join Date
    Aug 2004
    alright that really doens't help much, it doesn't solve my probeblem.

  4. #4
    Registered User
    Join Date
    Aug 2004
    but you did solve an error I had with Game Maker....

  5. #5
    Registered User
    Join Date
    Sep 2004
    extern "C" __declspec(dllexport) __stdcall BOOL GetComputerName(LPTSTR lpBuff, UINT bufflen)
        DWORD size = bufflen
        return GetComputerName(lpBuff, &size);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. non-MFC DLL with MFC app question.
    By Kempelen in forum Windows Programming
    Replies: 10
    Last Post: 08-20-2008, 07:11 AM
  2. dll communicating between each other
    By cloudy in forum C++ Programming
    Replies: 5
    Last Post: 06-17-2005, 02:20 AM
  3. DLL and std::string woes!
    By Magos in forum C++ Programming
    Replies: 7
    Last Post: 09-08-2004, 12:34 PM
  4. Using class with DLL
    By greg2 in forum C++ Programming
    Replies: 2
    Last Post: 09-12-2003, 05:24 AM
  5. .lib vs .h vs .dll
    By Shadow12345 in forum C++ Programming
    Replies: 13
    Last Post: 01-01-2003, 04:29 AM
Website Security Test