Jump to content


Photo

DLL Creations Forum Rules


  • Please log in to reply
11 replies to this topic

#1 Shaltif

Shaltif

    The Audio Master

  • Retired Staff
  • 1185 posts

Posted 01 March 2007 - 04:35 PM

DLL Creations Forum Rules


Please read over the following rules before posting a topic. Any topic posted in this section that fails to comply with these rules will be deleted.


Posting Guidelines

  • Only topics which showcase a DLL (Dynamic Link Library) may be posted here. All other topics of discussion will be removed.
  • All topics require a download link to the creation they are showcasing. Any creation which requires a user to contact the creator via e-mail, Personal Messager or other similar means are not allowed.
  • Do NOT create topics showcasing Examples, Tutorials or Engines using other people's DLLs/creations.  If you have made an example, tutorial or engine using someone else's DLL, you may place it in the DLL's existing showcase topic.
  • Porting or converting discussions are NOT allowed. This includes, but is not limited to, porting GM Games, converting GML, or using GameMaker on platforms it does not natively support.
  • Creations that alter the behavior of GameMaker directly are NOT allowed. This includes tool bars, embedded windows, memory alteration, etc.


STRICTLY Forbidden Areas of Discusion

  • Prank programs (harmless or not)
  • Disabling the Start Menu, TaskManager, CTRL+ALT+DELETE, CMD+OPT+ESC, etc.
  • Shells (Sub-OS programs)
  • File management programs
  • Applications that use or access email, chat networks (eg. AIM, MSN, IRC), telephone networks (eg. SMS), or forums
  • Removal tools for spyware / viruses / cookies, or pop-up blockers
  • Preventing or forcing Log Off, Shut Down, or Restart
  • Applications that alter the operating system, system files, or registry settings
  • Programs that install software to automatically start for any reason
  • Programs that hide themselves when they run
  • Key loggers, screen loggers, activity monitors, or any other form of surveillance
  • Applications that automatically refresh web pages
...and any other project or topic the staff considers harmful.

See this linked topic for a full list of projects which are not allowed.


FAQ

Q: What if a download link isn't working?
A: Make sure to try the "Right Click > Save As" option, or dragging the link into the browser bar. If that doesn't work, it is a dead link.

Do NOT bump the topic saying "broken link". Instead, try contacting the author privately to inform him. If the link is down for several days, you can use the report button.


Q: What is a DLL?
A: Smarty made a very informative topic about this which can be found here. That should give you plenty of information on the subject.


Q: Can Game Maker make DLLs?
A: No, Game Maker cannot make DLLs, or machine compile anything for that matter. You will need to learn/use an outside programming language. Possible langauges include C/C++, Pascal, ASM, PureBasic, etc.


Q: How do I make a DLL?
A: You will need to learn an outside programming language and use the tools developed for that language.


Q: Can Visual Basic be used to create DLLs?
A: You can try, but in has been found that in most cases, dll's made using VB do not work in Game Maker.


Q: What variable or data types are required to make a compatable GM DLL?[/color]
A: For REAL (number) values, use double. For STRING values, use PCHAR (char* or LPSTR). If you try to return a value which isn't one of these types, GM will usually flag you down with the "Unexpected error occurred".


Q: How come certian WinAPI (or other outside) functions [ ex: ShowWindow() ] do not work properly even though I'm passing GM's window handle?[/color]
A: It has been found that Game Maker applications use two window handles. The window_handle() function returns the handle to the child window (or the one you see). In some cases, however, you need to get the parent window's handle. One way to get this other handle is by using the WinAPI function GetWindow(). Example of it's use in C/C++.

// C/C++
#define export extern "C" __declspec (dllexport)
#include <windows.h>

export double windowGet(double handle) {
    return (int) GetWindow((HWND)(int)handle,GW_OWNER);
}
And here is an already made GML script for using the above DLL.

// GML - Argument already filled in for getting parent handle
var dll, def, ret; dll = "NameOfMyDLL.dll";
def = external_define(dll,"windowGet",dll_cdecl,ty_real,1,ty_real);
ret = external_call(def,window_handle());
external_free(dll);
return ret;



This topic has been left open so that other users can post their "FAQ" about extending GameMaker. When a FAQ is posted, staff will determine if it should be appended to the existing list and the post will be removed.

DO NOT POST QUESTIONS in this topic, as they will NOT be answered. However, any question about the rules/FAQ itself are welcome.
  • 0

#2 windowswildcard

windowswildcard

    The Ace of Windows

  • New Member
  • 86 posts

Posted 29 April 2008 - 11:34 AM

Q: Can I use .NET Languges to create DLLs?
A: Short Answer: No. Long Answer: After alot of modification, some functions may work, but be aware, like VB, .NET code does not always work. If you want to konw how to *try* and make .NET Dlls Gamemaker Visible, the tutorial at http://www.c-sharpco...sUnmanaged.aspx which may help you (just ignore the Blitz3D Parts like Userlibs).
  • 0

#3 hanson

hanson

    GMC Member

  • GMC Member
  • 444 posts
  • Version:GM8

Posted 08 April 2009 - 10:03 PM

Q: Can I use pointers with GM?
A: GM does not support direct usage of pointers. However, pointers can be returned from a function in the dll and then passed to a different function for the dll to process. In order to do this the pointer must be cast into a double to return it to GM. GM passes the value as a double to another function which must cast it back into a pointer before using it. Here is the code I use for casting in C++:
//pointer to double
myClass* mpointer;
double returnval;

mpointer = new myClass();
returnval = (double)reinterpret_cast<int>(mpointer);

//double to pointer
mpointer = reinterpret_cast<myClass*>((int)returnval);

  • 0

#4 Maarten Baert

Maarten Baert

    GMC Member

  • GMC Member
  • 744 posts
  • Version:GM8.1

Posted 11 May 2009 - 02:11 PM

@hanson:

In C you can use this:
union pointerdouble {
void *p;
double d;
};

export double myfunction1() {
pointerdouble pd;
mytype *mypointer;
// (...)
pd.p = (void*) mypointer;
return pd.d;
}

export double myfunction2(double pointer) {
pointerdouble pd;
mytype *mypointer;
pd.d = pointer;
mypointer = (mytype*) pd.p;
// (...)
return 1;
}

  • 0

#5 gireeHup73

gireeHup73

    GMC Member

  • New Member
  • 5 posts

Posted 16 November 2009 - 04:16 PM

I've been working on creating a simple dll. As I add more sub to it I recompile it and test it out. I've recompiled it about 10 times or so. Now the program I'm using to call the dll says it can't fine it The file is in the proper directory, but the program gives an error that it can't find the file. Does anyone know why this happens? I was going fine, but now I stopped by this problem.
  • 0

#6 gireeHup73

gireeHup73

    GMC Member

  • New Member
  • 5 posts

Posted 21 November 2009 - 10:17 PM

I figured out the problem, it's seems the extended 2D pak does not let my dll compile correctly. I used some of the calls in my dll and when I compile it it creates the dll, but somethings not correct. When I removed the 2D call I used from the ext pak. It compiled and worked fine. Do I need to add something specila in order for the ext 2D function to export correctly?
  • 0

#7 alex21

alex21

    Destroy EvilCow BURP

  • New Member
  • 336 posts

Posted 28 March 2010 - 09:19 PM

Brandon is retired. The new moderators change the rules.

3. Discussion of these areas is STRICTLY forbidden:

  • Modifying Game Maker
  • Disabling the Start Menu or TaskManager
  • Closing other program windows
  • Disabling CTRL+ALT+DELETE
  • Preventing or Forcing LogOff, ShutDown, or Restart
  • Keylogging
  • Deletion of System files / folders, or modifying the OS
  • Sending E-mail
~Brandon

I dont agree with all. Moderator pls change.
  • 0

#8 IceMetalPunk

IceMetalPunk

    InfiniteIMPerfection

  • Retired Staff
  • 9322 posts
  • Version:Unknown

Posted 28 March 2010 - 10:23 PM

Brandon is retired. The new moderators change the rules.

3. Discussion of these areas is STRICTLY forbidden:

  • Modifying Game Maker
  • Disabling the Start Menu or TaskManager
  • Closing other program windows
  • Disabling CTRL+ALT+DELETE
  • Preventing or Forcing LogOff, ShutDown, or Restart
  • Keylogging
  • Deletion of System files / folders, or modifying the OS
  • Sending E-mail
~Brandon

I dont agree with all. Moderator pls change.

Why on Earth would they change that? The rule is there for a reason: all of these topics can be used maliciously. The real question, then, is why don't you agree with them? Why do you think any of those topics need to be discussed on the GMC?

-IMP :D :)
  • 0

#9 solano

solano

    GMC Member

  • GMC Member
  • 462 posts
  • Version:GM:Studio

Posted 18 May 2010 - 01:56 PM

Disabling CTRL+ALT+DELETE


Well to stop players from accidentally pressing it in the heat of the battle(so does the Microsoft button)

Quote from StarCraft2

Edited by solano, 06 July 2010 - 05:13 PM.

  • 0

#10 FmMan3

FmMan3

    GMC Member

  • GMC Member
  • 187 posts
  • Version:GM:Studio

Posted 18 May 2010 - 03:11 PM

Disabling CTRL+ALT+DELETE


Well to stop players from accidentally pressing it in the heat of the battle(so does the Microsoft button)


Get real... accidentally pressing Ctrl+Alt+Delete? is that some sort of sour joke?

Disallowing discussion on how to disable that is a damn good idea because as soon as someone creates a program that runs on startup and constantly repositions the mouse and makes it impossible to use the computer and having that program disable C+A+D that then places that software in nothing other than malware.

In no does or should a game have a valid reason for disabling C+A+D. And on my previous computer it was so slow and poorly performing that I often had to C+A+D to close many high CPU using programs, thus allowing that rig to function. Having a program that disabled that would have been allowing someone to write software to make my computing an absolute nightmare. The rule should stay, and I can garuntee it will. So this discussion is fairly pointless.
  • 0

#11 Master Xilo

Master Xilo

    GMC Member

  • GMC Member
  • 393 posts
  • Version:GM8

Posted 20 July 2011 - 11:34 PM

@hanson:

In C you can use this:

union pointerdouble
{
    void *p;
    double d;
};

export double myfunction1() {
pointerdouble pd;
mytype *mypointer;
// (...)
pd.p = (void*) mypointer;
return pd.d;
}

export double myfunction2(double pointer) {
pointerdouble pd;
mytype *mypointer;
pd.d = pointer;
mypointer = (mytype*) pd.p;
// (...)
return 1;
}


I'm 100% sure that this won't work: First of all a double is 8 bytes in size, a pointer 4 (in 32 bits, and gm doesn't support 64 bit). Floating point variables store numbers completely different from how integers are stored.

The same memory interpreted as double and integer (pointer) will never give you the same value:

union pointerdouble {
void *p;
double d;
};

bool doesAUnionOfDoubleAndVoidPtrMakeSense(double pointer)
{
    // Direct way
    int *p = (int*)(int)pointer;

    // Wrong way
    pointerdouble pd;
    pd.d = pointer;

    int *p2 = (int*)pd.p;

    // Compare
    return p == p2;
}

will always return false (except for pointer == 0.0)...

Edited by Master Xilo, 20 July 2011 - 11:38 PM.

  • 0

#12 Lonewolff

Lonewolff

    GMC Member

  • GMC:Member
  • 1782 posts
  • Version:GM:Studio

Posted 08 August 2013 - 12:08 AM

Seems like the free version of GM:S doesn't allow dll imports. Would that be correct?

What is the minimum level of GM:S required?

[edit]
Just upgraded to pro, so this wont work on Free. Not sure about standard though.

Edited by Lonewolff, 08 August 2013 - 01:13 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users