Jump to content


Photo

Close Button Dll


  • Please log in to reply
25 replies to this topic

#1 tangibleLime

tangibleLime

    Lunatic

  • GMC Elder
  • 2520 posts
  • Version:GM:HTML5

Posted 25 April 2006 - 08:09 PM

CloseButton DLL

Information
This DLL can enable, disable, and get the state of the close button on the window. This does NOT prevent the window from being closed, however, so it is legal to be used and distributed on the GMC.

Functions
Enable close button
Disable close button
Get state of close button

Special Notes
None

Download
Click Here to Download
(http://technosoftnet...seButtonDLL.zip)

Sourcecode
Here is the sourcecode. It's written in C++.
#include <windows.h>
#define export extern "C" __declspec (dllexport)

export double disable(double thewindow) {
       HWND handle = (HWND)(DWORD)thewindow;
       HMENU systemmenu;
       systemmenu = GetSystemMenu(handle,0);
       EnableMenuItem(systemmenu,SC_CLOSE,MF_GRAYED);
       DrawMenuBar(handle);
       return 1;
}

export double enable(double thewindow) {
       HWND handle = (HWND)(DWORD)thewindow;
       HMENU systemmenu;
       systemmenu = GetSystemMenu(handle,0);
       EnableMenuItem(systemmenu,SC_CLOSE,MF_ENABLED);
       DrawMenuBar(handle);
       return 1;
}

export double getstate(double thewindow) {
       HWND handle = (HWND)(DWORD)thewindow;
       HMENU systemmenu;
       systemmenu = GetSystemMenu(handle,0);
       int ret;
       int rett;
       rett = 0;
       ret = GetMenuState(systemmenu,6,MF_BYPOSITION);
       if ((int) ret == 536870913) { rett = 1; }
       if ((int) ret == 536870912) { rett = 0; }
       return (int) rett;
}

Edited by Roach, 25 April 2006 - 11:58 PM.

  • 0
Posted ImagePosted Image

#2 Cloud Tower

Cloud Tower

    Transition Master!

  • New Member
  • 286 posts

Posted 25 April 2006 - 08:18 PM

Thanks a lot Roach you are the real deal! I love you. :D
  • 0

#3 abacus

abacus

    GMC Member

  • New Member
  • 1330 posts

Posted 25 April 2006 - 10:25 PM

I think a new rule should be enforced in this forum:

WHY YOU WOULD WANT TO USE THIS?!!?!?!?!?

Please answer this question.


AND WHAT DOES IT DO?!?!?!?!

Answer that one too, roachers.

AND HOW DOES IT WORK?!?!?!

Another one^^
  • -1

#4 tsa05

tsa05

    GMC Member

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

Posted 25 April 2006 - 10:52 PM

Since I just answered this in the other topic, I'll put it here to... I hate cluuterring everything with tons of little dll's that to tiny little things. Particularly when I can just do it in GameMaker...
http://forums.gamema...dpost&p=1369724
  • 0

#5 tangibleLime

tangibleLime

    Lunatic

  • GMC Elder
  • 2520 posts
  • Version:GM:HTML5

Posted 25 April 2006 - 11:44 PM

WHY YOU WOULD WANT TO USE THIS?!!?!?!?!?

If it has no use, why is there an API function for it?


AND WHAT DOES IT DO?!?!?!?!

As stated in the first post, "This DLL can enable, disable, and get the state of the close button on the window. "

AND HOW DOES IT WORK?!?!?!

Uses a few simple API commands to modify the SC_CLOSE button on a menubar of a window. I'll post the source in the first topic.


Since I just answered this in the other topic, I'll put it here to...  I hate cluuterring everything with tons of little dll's that to tiny little things.  Particularly when I can just do it in GameMaker...
http://forums.gamema...dpost&p=1369724

<{POST_SNAPBACK}>

I tried to use your code, but you lost me when you told me to go to "Disable control in the options". Anyways, this DLL does it for real, so if you want ot make something commercial, this would be the way to go. Anything done in GameMaker would be fake.

Edited by Roach, 25 April 2006 - 11:56 PM.

  • 0
Posted ImagePosted Image

#6 Ravotus

Ravotus

    GMC Member

  • GMC Member
  • 327 posts

Posted 26 April 2006 - 12:16 AM

One, suggestion, in case people want to learn from your code, or decipher it at all:
if ((int) ret == 536870913) { rett = 1; }
if ((int) ret == 536870912) { rett = 0; }
Don't use magic numbers :D
  • 0

#7 tangibleLime

tangibleLime

    Lunatic

  • GMC Elder
  • 2520 posts
  • Version:GM:HTML5

Posted 26 April 2006 - 12:37 AM

Well I didn't really know which constants stood for those numbers, so I just had it originally return "ret", which gave me those numbers I entered :D
  • 0
Posted ImagePosted Image

#8 Matt13

Matt13

    GMC Member

  • New Member
  • 580 posts
  • Version:Unknown

Posted 26 April 2006 - 01:31 AM

Roach, I have a question, I tried this earlier for my "lock move" dll but the disabling didn't work for 'Move' in the menu... why's this?
  • 0

#9 tsa05

tsa05

    GMC Member

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

Posted 26 April 2006 - 04:32 AM

I tried to use your code, but you lost me when you told me to go to "Disable control in the options". Anyways, this DLL does it for real, so if you want ot make something commercial, this would be the way to go. Anything done in GameMaker would be fake.

Yeah, ok, a typo--I'll edit that. It should read "Disable Esc in the game options." Seriously, though, I think a person with your experience knows that... Anywho, it's just as 'legitimate' a way of doing it (I mean, seriously--calling it 'fake' is just ridiculous). Not to knock your dll--I just want people to be aware that if they don't want one, they don't need one (*cough*UnRegisteredPeople*cough*).

Edited by tsa05, 26 April 2006 - 04:34 AM.

  • 0

#10 Degman

Degman

    There is no spoon

  • New Member
  • 263 posts

Posted 26 April 2006 - 04:49 AM

This is useless; as it was mentioned previously, keyboard_check_direct(vk_escape) and keyboard_check(vk_escape) provide all the information you need once you disable the game closure from within your Game Options.
  • 0

#11 Ravotus

Ravotus

    GMC Member

  • GMC Member
  • 327 posts

Posted 26 April 2006 - 12:47 PM

Well, do a bit of research on msdn. It appears it should go something like this:
if (!(int) ret & (MF_DISABLED | MF_GRAYED)) { rett = 1; }
if ((int) ret & MF_DISABLED) { rett = 0; }
Just a thought :D
  • 0

#12 Cloud Tower

Cloud Tower

    Transition Master!

  • New Member
  • 286 posts

Posted 26 April 2006 - 07:09 PM

Okay, I want everybody to read this carefully. The function that returns the state of the window’s close button, it would not return if the close button is disabled, another thing, the function to enable the close button would still not work when the programmer checked off the check box that allows the player to press the Escape Key that can enable the window to be closed. In addition, the function that disables the close button is still active when the player presses and holds the ‘Alt’ Key followed by the ‘F4’ Key. Therefore, all three functions have an error, however, they can probably be fixed since the source code of this Dynamic Link Library is distributed.

- Cloud Tower - :unsure:

Edited by Cloud Tower, 26 April 2006 - 07:11 PM.

  • 0

#13 tangibleLime

tangibleLime

    Lunatic

  • GMC Elder
  • 2520 posts
  • Version:GM:HTML5

Posted 26 April 2006 - 07:14 PM

I tried to use your code, but you lost me when you told me to go to "Disable control in the options". Anyways, this DLL does it for real, so if you want ot make something commercial, this would be the way to go. Anything done in GameMaker would be fake.

Yeah, ok, a typo--I'll edit that. It should read "Disable Esc in the game options." Seriously, though, I think a person with your experience knows that... Anywho, it's just as 'legitimate' a way of doing it (I mean, seriously--calling it 'fake' is just ridiculous). Not to knock your dll--I just want people to be aware that if they don't want one, they don't need one (*cough*UnRegisteredPeople*cough*).

<{POST_SNAPBACK}>

Well I still can't get it to work. By the way, how was I supposed to get "Disable Esc" from "Disable control"? I have an object, with your code in the "Esc Released" event, and i've tried it in the step event, with Esc disabled. What am I supposed to see? All that happens is I can't close the game.


This is useless; as it was mentioned previously, keyboard_check_direct(vk_escape) and keyboard_check(vk_escape) provide all the information you need once you disable the game closure from within your Game Options.

<{POST_SNAPBACK}>

My DLL doesn't prevent game closure, it disables the button that can close it. You can still use Esc to close it even if the button is disabled.

Okay, I want everybody to read this carefully. The function that returns the state of the window’s close button, it would not return if it’s disabled, another thing, the function to enable the close it would still not work when the programmer check off the check box that allows the player to press the escape key that can enable the window to be close. In addition, the function that disables the close button is still active when the player presses and holds the ‘Alt’ Key followed by the ‘F4’ Key. Therefore, all three function have an error, however, they can probably be fixed since the source code of the Dynamic Link Library is distributed.

<{POST_SNAPBACK}>

Well, I'm not sure if that's for me or against me. Are you stating bugs in my DLL? If so, tell me and i'll try to fix them.

Edited by Roach, 26 April 2006 - 07:15 PM.

  • 0
Posted ImagePosted Image

#14 Cloud Tower

Cloud Tower

    Transition Master!

  • New Member
  • 286 posts

Posted 26 April 2006 - 07:19 PM

Okay, I want everybody to read this carefully. The function that returns the state of the window’s close button, it would not return if it’s disabled, another thing, the function to enable the close it would still not work when the programmer check off the check box that allows the player to press the escape key that can enable the window to be close. In addition, the function that disables the close button is still active when the player presses and holds the ‘Alt’ Key followed by the ‘F4’ Key. Therefore, all three function have an error, however, they can probably be fixed since the source code of the Dynamic Link Library is distributed.

- Cloud Tower -  :unsure:

Well, I'm not sure if that's for me or against me. Are you stating bugs in my DLL? If so, tell me and i'll try to fix them.

Yes, it is three errors please fix them. :blink:

Edited by Cloud Tower, 26 April 2006 - 07:21 PM.

  • 0

#15 zat

zat

    GMC Member

  • New Member
  • 33 posts

Posted 09 June 2006 - 02:10 AM

nice dll Roach, you should also add functions for the other buttons.
  • 0

#16 LoopStan

LoopStan

    North-See Developer

  • GMC Member
  • 1398 posts

Posted 29 July 2008 - 08:52 PM

Hey, i know this hasent been replied to forever, but i would like to use it, and the link is broken. If you have a copy of the dll, please upload it somwhere and post?
  • 0

Posted Image


#17 jalb

jalb

    Joshua Brookover

  • GMC Member
  • 629 posts
  • Version:GM8

Posted 26 August 2009 - 01:08 PM

Hey, i know this hasent been replied to forever, but i would like to use it, and the link is broken. If you have a copy of the dll, please upload it somwhere and post?

I don't have this DLL, but since Roach posted the source I was able to recompile it for you. I also remade the scripts, see the gmk in the zip. Although, if any credit is to be made when using this, you should still credit Roach for it.

I'll PM Roach to make him aware that the link is dead. For now, use this.
  • 0

#18 Hugo_Peters

Hugo_Peters

    herp derp

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

Posted 19 July 2013 - 04:00 PM

Heheh, 4 years later! :D

Anyone still has it? I kinda need it.. :/

 

Thanks!


  • 0

Posted Image


#19 Venomous

Venomous

    GMC Member

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

Posted 19 July 2013 - 08:10 PM

Heheh, 4 years later! :D

Anyone still has it? I kinda need it.. :/

 

Thanks!

The source code is provided, so it is a simple matter to compile it again. Here, I did it for you: https://dl.dropboxus...ebutton_dll.zip


  • 0

#20 DonPotenzo

DonPotenzo

    GMC Member

  • GMC Member
  • 49 posts
  • Version:None

Posted 20 July 2013 - 01:01 AM

The original DLL (compiled by tangibleLime a.k.a Roach):

http://gamemaker.cc/...seButtonDLL.php


Edited by DonPotenzo, 20 July 2013 - 01:02 AM.

  • 0

#21 GearBunny

GearBunny

    GMC Member

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

Posted 28 December 2013 - 03:42 AM

Will that only work in game maker six? That's what the example seems to indicate...


  • 0

#22 CrazyGuyGames

CrazyGuyGames

    YYGF Member

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

Posted 28 December 2013 - 05:10 PM

This is quite pointless now, you can do that in global game settings :/


  • 0

AZGIWjf.png

aSzDlXB.png


#23 grimdayz

grimdayz

    a.t.t.i.c.

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

Posted 28 December 2013 - 05:53 PM

This is quite pointless now, you can do that in global game settings :/

Not in Studio

 

 

Will that only work in game maker six? That's what the example seems to indicate...

It works in Studio. I made you an example. The dll is in the included files. Check the comments in the code of the two objects.


  • 0

#24 GearBunny

GearBunny

    GMC Member

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

Posted 28 December 2013 - 07:18 PM

Thanks Grimdayz :thanks:


  • 0

#25 CoisadePro

CoisadePro

    GMC Member

  • New Member
  • 17 posts
  • Version:GM:Studio

Posted 26 June 2014 - 12:30 AM

I think that your download link is broken, GrimDayz. Could you reupload the exemple? Will be very useful here (:


  • 0

aUhZzvj.png

Patrick Pissurno : CEO @ IMGames Corp.


#26 Razon

Razon

    GMC Member

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

Posted 01 July 2014 - 06:53 AM

Here's a mirror link for the original files uploaded by the author.
http://www.mediafire...zv9qfwedkjtmer2

 

I don't have a copy of the studio example that grimdayz posted.


  • 0