Pages: 1
  Print  
Author Topic: GMS vs GM8.1 and below [window_handle()]  (Read 10590 times)
Offline (Unknown gender) time-killer-games
Posted on: September 27, 2014, 03:24:35 pm
"Guest"


Email
Apparently GMS's window_handle() implementation is completely different from Legacy GM versions. I don't know how exactly it's different because I just use FindWindow("YYGameMakerYY,NULL) to get the new GMS handle, which isn't the natural way, as the window class name is subject to change as time goes on, for all we know.

Anyway this is my request, if possible if we could modify the current window_handle() function in ENIGMA to support both GM Legacy AND GMS's window handle. If both aren't possible to support in the same project simultaneously, we could just add two new ENIGMA settings radio boxes. GMS window_handle() compatibility as the default but with the option of switching to backwards compatibility for older GM versions.

Sound good?
« Last Edit: September 27, 2014, 03:29:38 pm by time-killer-games » Logged
Offline (Male) Goombert
Reply #1 Posted on: September 27, 2014, 03:35:15 pm

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 2991

View Profile
Ok TKG, but how do you propose we do that? Especially when you don't even know how Studio's works, ours just casts hWnd to unsigned long long.
https://github.com/enigma-dev/enigma-dev/blob/master/ENIGMAsystem/SHELL/Platforms/Win32/WINDOWSwindow.cpp#L812
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) time-killer-games
Reply #2 Posted on: September 27, 2014, 03:38:52 pm
"Guest"


Email
Ask Lonewollf he knows. He tried to tell me but he wasn't descriptive at all he was so vague I didn't know what to make of it. Or maybe I just don't know enough about C++ to know what he was talking about. I have no idea.
Logged
Offline (Unknown gender) lonewolff
Reply #3 Posted on: September 27, 2014, 06:09:13 pm
"Guest"


Email
Ok TKG, but how do you propose we do that? Especially when you don't even know how Studio's works, ours just casts hWnd to unsigned long long.
https://github.com/enigma-dev/enigma-dev/blob/master/ENIGMAsystem/SHELL/Platforms/Win32/WINDOWSwindow.cpp#L812

Ask Lonewollf he knows. He tried to tell me but he wasn't descriptive at all he was so vague I didn't know what to make of it. Or maybe I just don't know enough about C++ to know what he was talking about. I have no idea.

I was descriptive, you just didn't get the answer, so it seems.

There is no magic with window_handle() in GM:S (or even window_device() ). :)

They are sent as pointers, pure and simple. No casting involved.

If you send window_handle() in GM:S to a DLL, you simply recieve it as a HWND in the DLL. Simple! :)

The thing that YYG don't tell you 'on the box' :) is that when you use external_define() that ty_string is not referring to a string at all. It is a pointer. (I found this out directly from Russell Kay, because I submitted a bug report about subsequent parameters being recieved as zero if the window handle was the first parameter.

ty_string is a differrent size to ty_real so it throws the rest of the arguments out of whack if you assume that the window_handle() is a ty_real (is isn't).

So don't make that mistake.

Solution

Don't cast it at all, recieve it as a HWND.

"Insta-fix" for the OP request. Will work for GMS & GM8.1. And you get to take out some nasty casting and a few lines out of ENIGMA at the same time :)
Logged
Offline (Unknown gender) time-killer-games
Reply #4 Posted on: September 27, 2014, 06:28:24 pm
"Guest"


Email
Cool I try that out in a few days as I want a break from my extensions to work on a couple games again but that sounds pretty straight forward.

I didn't know that would work in 8.1 too, that's great news!

Yeehar!
Logged
Offline (Unknown gender) lonewolff
Reply #5 Posted on: September 27, 2014, 06:34:11 pm
"Guest"


Email
Yeehar!

If you ever have tech questions on how GM:S does things drop me a line. If I don't know the answer I'll find out. I still got guys on the inside on the dev team - LOL :)
Logged
Pages: 1
  Print