Jump to content


Photo

Get Desktop Area Dll (with Source, And .gm6/.gmk)


  • Please log in to reply
23 replies to this topic

#1 Caniac

Caniac

    The #1 Caniac

  • New Member
  • 2622 posts

Posted 08 November 2008 - 05:28 PM

Get Desktop area Dll
By Caniac, with massive credit to Icuurd12b42.


What?
  • This Dll returns the desktop area cordinates that are not covered in toolbars (eg. start bar) Note that the windows vista gadget bar does not count as a toolbar.
  • I made this Dll on request, see this topic: Here

Contents:
  • GM6 :( (*.gm6) file
  • GM7 :mellow: (*.gmk) file
  • Executable example (for those who are on a computer without GM)
  • C++ source code
  • the dll its self (duh) :(
  • Readme.txt

Download:

Main download: Mediafire


Please let me know before you upload any mirrors.

Licence
feel free to use this Dll, and you can use it in commercial, and freeware projects.
just give credit if you use it commercially.

enjoy

- Caniac

edit:
I changed the source, as "score_under" suggested.

Edited by Caniac, 25 November 2009 - 04:57 PM.

  • 0

#2 MrJackSparrow2

MrJackSparrow2

    GMC Member

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

Posted 08 November 2008 - 07:25 PM

Very, very nice! Seems to work flawlessly! Just what I needed.
  • 0

#3 Caniac

Caniac

    The #1 Caniac

  • New Member
  • 2622 posts

Posted 08 November 2008 - 07:27 PM

Very, very nice! Seems to work flawlessly! Just what I needed.

glad you liked it :lol:
enjoy.

- Caniac
  • 0

#4 score_under

score_under

    Least kawaii

  • GMC Member
  • 1321 posts

Posted 08 November 2008 - 08:14 PM

That source code is ridiculous.
[codebox]
#define WIN32_LEAN_AND_MEAN
#define NOGDI
#include <windows.h>
#define gmexport extern "C" __declspec (dllexport)


class SampleClass
{
public:
SampleClass();
virtual ~SampleClass(void);
int Function(LPCSTR);
private:

};

SampleClass::SampleClass()
{

}


SampleClass::~SampleClass ()
{

}

int SampleClass::Function(LPCSTR string)
{
MessageBoxA(GetActiveWindow(),string ,"Class Function", MB_ICONINFORMATION|MB_OK);
return 1;
}

BOOL APIENTRY DllMain (HINSTANCE hInst /* Library instance handle. */ ,
DWORD reason /* Reason this function is being called. */ ,
LPVOID reserved /* Not used. */ )
{
switch (reason)
{
case DLL_PROCESS_ATTACH:
break;

case DLL_PROCESS_DETACH:
break;

case DLL_THREAD_ATTACH:
break;

case DLL_THREAD_DETACH:
break;
}

/* Returns TRUE on success, FALSE on failure */
return TRUE;
}

//Tell the c++ compiler to switch to standard C compiling so gmexported function names as not mangled
extern "C" {

gmexport double GetWorkLeft(void)
{
RECT r = {0,0,0,0};
SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0);
return (double) r.left;
}
gmexport double GetWorkRight(void)
{
RECT r = {0,0,0,0};
SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0);
return (double) r.right;
}
gmexport double GetWorkBottom(void)
{
RECT r = {0,0,0,0};
SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0);
return (double) r.bottom;
}
gmexport double GetWorkTop(void)
{
RECT r = {0,0,0,0};
SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0);
return (double) r.top;
}
}
[/codebox]

That could be changed to... (C, not C++, as C++ is not suited for GM DLLs, which is why extern "C" is used)
[codebox]
#include <windows.h>
#define gmexport __declspec (dllexport)
RECT r = {0,0,0,0};
gmexport double GetWorkLeft(void)
{
SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0);
return (double) r.left;
}
gmexport double GetWorkRight(void)
{
SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0);
return (double) r.right;
}
gmexport double GetWorkBottom(void)
{
SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0);
return (double) r.bottom;
}
gmexport double GetWorkTop(void)
{
SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0);
return (double) r.top;
}
[/codebox]
  • 0

Anti-Decompiler for GM6.1 to GM8.1.91! :GM8_new: [Main skin by Sindarin]
Discontinued.

decimal2.png
^ Signature image because it's been sorta empty since the old host died

If you need to contact me, I still get notification emails from PMs.


#5 Caniac

Caniac

    The #1 Caniac

  • New Member
  • 2622 posts

Posted 08 November 2008 - 08:24 PM

hmmmm. maybe next time I should not release my source code?

edit:
ok, I will update the dll.

Edited by Caniac, 08 November 2008 - 08:29 PM.

  • 0

#6 Hockeyflyers

Hockeyflyers

    Hockeyplayer Games

  • New Member
  • 1108 posts
  • Version:Unknown

Posted 09 November 2008 - 01:30 PM

No, because then you will learn more than if you hadn't.
  • 0

#7 Caniac

Caniac

    The #1 Caniac

  • New Member
  • 2622 posts

Posted 09 November 2008 - 01:51 PM

No, because then you will learn more than if you hadn't.

learn more from what? leaving my code open source?
  • 0

#8 Hockeyflyers

Hockeyflyers

    Hockeyplayer Games

  • New Member
  • 1108 posts
  • Version:Unknown

Posted 09 November 2008 - 04:38 PM

Learn better C++. score_under showed you an easier and more efficient way to code that in C++. You learned something new :rolleyes:
  • 0

#9 Caniac

Caniac

    The #1 Caniac

  • New Member
  • 2622 posts

Posted 09 November 2008 - 05:26 PM

yup.

thanks score_under.
  • 0

#10 Caniac

Caniac

    The #1 Caniac

  • New Member
  • 2622 posts

Posted 23 November 2008 - 03:40 PM

bump...
  • 0

#11 prog

prog

    GMC Member

  • New Member
  • 1121 posts

Posted 09 April 2009 - 07:19 PM

I've been looking for something like this for a while. Good job.
  • 0
Progames

NEW WEBSITE!
I have a large collection of music on my website. If you need some, take a look.
If you need a script, PM me. I'll make you one for free.

#12 Caniac

Caniac

    The #1 Caniac

  • New Member
  • 2622 posts

Posted 09 April 2009 - 07:26 PM

I've been looking for something like this for a while. Good job.

thanks, glad somone noticed this almost dead topic :)
  • 0

#13 prog

prog

    GMC Member

  • New Member
  • 1121 posts

Posted 09 April 2009 - 08:50 PM

I've been looking for something like this for a while. Good job.

thanks, glad somone noticed this almost dead topic :)


Sure. Also, here's the WIP program I am using this for: http://gmc.yoyogames...p;#entry3120619
  • 0
Progames

NEW WEBSITE!
I have a large collection of music on my website. If you need some, take a look.
If you need a script, PM me. I'll make you one for free.

#14 Caniac

Caniac

    The #1 Caniac

  • New Member
  • 2622 posts

Posted 09 April 2009 - 09:11 PM

I've been looking for something like this for a while. Good job.

thanks, glad somone noticed this almost dead topic :)


Sure. Also, here's the WIP program I am using this for: http://gmc.yoyogames...p;#entry3120619

neat.
looks nice. how much works? ( didn't want to restart my PC or anything)
  • 0

#15 Yambam

Yambam

    GMC Member

  • GMC Member
  • 647 posts
  • Version:GM8

Posted 26 April 2009 - 08:00 AM

it was not realy needed to make because game maker can do that without it
window_set_position(display_get_width()-window_get_width(),display_get_height()-window_get_height()-32)
the code above sets the window on the down right side
window_set_position(0,display_get_height()-window_get_height()-32)
the code above sets the window on the down left side
window_set_position(0,0)
the code above sets the window on the top left side
window_set_position(display_get_width()-window_get_width(),0)
the code above sets the window on the top right side
i edited your example and it workd without it heres the link: http://www.yoyogames...ames/show/79584 it not workd very good but it is a good try huh?

Edited by Yambam, 26 April 2009 - 08:29 AM.

  • 0

#16 Hockeyflyers

Hockeyflyers

    Hockeyplayer Games

  • New Member
  • 1108 posts
  • Version:Unknown

Posted 26 April 2009 - 01:43 PM

Yambam, that's assuming that their taskbar is 32 pixels high. Not everyone's taskbars are 32. Or, someone might have their taskbar all the way on the right.
  • 0

#17 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts
  • Version:Unknown

Posted 26 April 2009 - 04:04 PM

Just for your information guys, GMRA could do this easily with:
Screen.Width

Screen.Height

Edited by uuf6429, 26 April 2009 - 04:04 PM.

  • 0

#18 Caniac

Caniac

    The #1 Caniac

  • New Member
  • 2622 posts

Posted 27 April 2009 - 09:35 AM

it was not realy needed to make because game maker can do that without it

window_set_position(display_get_width()-window_get_width(),display_get_height()-window_get_height()-32)
the code above sets the window on the down right side
window_set_position(0,display_get_height()-window_get_height()-32)
the code above sets the window on the down left side
window_set_position(0,0)
the code above sets the window on the top left side
window_set_position(display_get_width()-window_get_width(),0)
the code above sets the window on the top right side
i edited your example and it workd without it heres the link: http://www.yoyogames...ames/show/79584 it not workd very good but it is a good try huh?

I know that most taskbars are 32 high, but if you "unlock the taskbar" you can drag it to make it bigger. and in some OSes, you can move it to the top, or "link bars" on the side.

Yambam, that's assuming that their taskbar is 32 pixels high. Not everyone's taskbars are 32. Or, someone might have their taskbar all the way on the right.

Yes, very true.
this dll was made for those people that refuse to risk making a bad program by ruining it with a guess.

@Uuf6429:
Neat, never knew that.
I guess if somone was making a big program then it would be worth while including a large dll like that. I made this dll for people that just want a simple and easy way to get it, without the big filesize :P

edit:
it is totally wrong :D
first of all, the vista task bar is not 32 high apparently, it is around 27.

Edited by Caniac, 27 April 2009 - 09:48 AM.

  • 0

#19 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts
  • Version:Unknown

Posted 27 April 2009 - 05:23 PM

@Uuf6429:
Neat, never knew that.
I guess if somone was making a big program then it would be worth while including a large dll like that. I made this dll for people that just want a simple and easy way to get it, without the big filesize wink1.gif

The same reason I don't think this dll is useless :).
  • 0

#20 Yambam

Yambam

    GMC Member

  • GMC Member
  • 647 posts
  • Version:GM8

Posted 30 April 2009 - 06:26 PM

Yambam, that's assuming that their taskbar is 32 pixels high. Not everyone's taskbars are 32. Or, someone might have their taskbar all the way on the right.

oh em yea you are actually right :whistle:
  • 0

#21 Yambam

Yambam

    GMC Member

  • GMC Member
  • 647 posts
  • Version:GM8

Posted 30 April 2009 - 06:31 PM

edit:
it is totally wrong :whistle:
first of all, the vista task bar is not 32 high apparently, it is around 27.

yea i know but maybe vista has an 30 start button xp actually has an 30 high taskbar i just vergot that when i was making it
  • 0

#22 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts
  • Version:Unknown

Posted 30 April 2009 - 07:44 PM

The bar size (width) and position may be found with separate functions, which Caniac my add in. Of course GMRA already supports both :whistle:.
Taskbar Height/Width/Size:
function GetTaskbarSize:Integer;
var r:TRect;
begin
  SystemParametersInfo(SPI_GETWORKAREA,0,@r,0);
  Result:=r.Bottom-r.Top;
end;
Taskbar position
function GetTaskbarPosition:Integer;
var
  hTaskbar: HWND;
  T: TRect;
  scrW, scrH: integer;
begin
  hTaskBar:=FindWindow('Shell_TrayWnd',nil);
  if hTaskbar<>0 then begin
	GetWindowRect(hTaskBar,T);
	ScrW:=Screen.Width;
	ScrH:=Screen.Height;
	if (T.Top>scrH div 2)and(T.Right>=scrW) then Result:=2
	  else if (T.Top<scrH div 2) and (T.Bottom<=scrW div 2) then Result:=0
		else if (T.Left<scrW div 2) and (T.Top<=0) then Result:=3
		  else if T.Left >= ScrW div 2 then Result:=1;
end;

First function returns size in pixels. Second functions returns a number for position: 0,1,2,3 for top,right,down,left (clockwise).

Kind regards,
Christian Sciberras

Edited by uuf6429, 30 April 2009 - 07:44 PM.

  • 0

#23 Caniac

Caniac

    The #1 Caniac

  • New Member
  • 2622 posts

Posted 03 May 2009 - 02:21 AM

<snip>

Cool :)

maybe I will add them, after I figure it out :P
  • 0

#24 Caniac

Caniac

    The #1 Caniac

  • New Member
  • 2622 posts

Posted 25 November 2009 - 04:58 PM

Updated broken mirror, thanks to iWizard for letting me know it broke.
  • 0