time-killer-games Guest
|
 |
Reply #105 Posted on: September 29, 2014, 12:39:47 AM |
|
|
|
Robert I tried your code and it threw errors. Are you sure what you provided is correct? The only thing I changed was I replaced the child window arg to use the handle to the child window, which I take is what I was supposed to do.
|
|
|
lonewolff Guest
|
 |
Reply #106 Posted on: September 30, 2014, 02:28:20 AM |
|
|
TKG - found another oddity also. Probably to do with playing around with the windows. But, have you noticed this? QuotePowered by GameMaker:Studio window_set_caption() won't override the free advertising either (like it does in newly created projects). Are you actually working for YYG? 
|
|
|
|
|
lonewolff Guest
|
 |
Reply #108 Posted on: September 30, 2014, 02:37:14 AM |
|
|
See, he was 'the mole' all along. Throwing slander at me to take focus off himself 
|
|
|
Darkstar2
 Joined: Jan 2014
Posts: 1,238
|
 |
Reply #109 Posted on: September 30, 2014, 02:39:22 AM |
|
|
Quote from: lonewolff on September 30, 2014, 02:37:14 AM See, he was 'the mole' all along. Throwing slander at me to take focus off himself 
LMAO! So once GMS 2 comes out next year he'll have to make it up to you, at least now we know someone on the inside 
|
|
|
lonewolff Guest
|
 |
Reply #110 Posted on: September 30, 2014, 02:46:23 AM |
|
|
|
|
|
|
Goombert
 Joined: Jan 2013
Posts: 2,991
|
 |
Reply #111 Posted on: September 30, 2014, 03:10:13 AM |
|
|
Quote from: TKGRobert I tried your code and it threw errors. Are you sure what you provided is correct? The only thing I changed was I replaced the child window arg to use the handle to the child window, which I take is what I was supposed to do. I'd have to see the output TKG.
|
|
|
time-killer-games Guest
|
 |
Reply #112 Posted on: September 30, 2014, 03:28:01 AM |
|
|
That caption is due to the first room's creation code. I assume no one will actually use that example room other than to see the extension actually works. But people can just delete that room and modify the object to suit their needs and place it in a room they created themselves without the caption. The ENIGMA version does the same thing "Powered by ENIGMA" I did that to show it works in both game engines with the screenshots.  @Christopher Robin I'll do it first thing I wake up tom it's midnight AGAIN...
|
|
|
lonewolff Guest
|
 |
Reply #113 Posted on: September 30, 2014, 03:35:31 AM |
|
|
Ah got ya  I thought it might be GM:S being a turd.
|
|
|
time-killer-games Guest
|
 |
Reply #114 Posted on: September 30, 2014, 03:43:01 AM |
|
|
|
Maybe it was, or maybe I'm being a turd.
|
|
|
time-killer-games Guest
|
 |
Reply #115 Posted on: September 30, 2014, 05:58:19 PM |
|
|
Quote from: Robert B Colton on September 30, 2014, 03:10:13 AM
Quote from: TKGRobert I tried your code and it threw errors. Are you sure what you provided is correct? The only thing I changed was I replaced the child window arg to use the handle to the child window, which I take is what I was supposed to do. I'd have to see the output TKG.
At this point I'm afriad to mess with the code because I don't want to break anything due to window focus which isn't really that big of a deal if you ask me. I will fix it, I just have more pressing things to do for now. Thanks for the help! 
|
|
|
time-killer-games Guest
|
 |
Reply #116 Posted on: October 02, 2014, 05:45:20 PM |
|
|
I discovered all this time BrowserDestroy() wasn't working and it was never working to begin with. I only tested destroying the browser at game end which is stupid because when the game ends all child windows are closed automatically.Meaning if anyone wanted to close the browser at any point before the game ends, the window (until now) would still be there! BrowserDestroy() is now fixed in the most recent Marketplace update, and from the same link in the OP. 
|
|
|
time-killer-games Guest
|
 |
Reply #117 Posted on: October 02, 2014, 07:00:17 PM |
|
|
|
Sorry for taking so long Bob, I have the code and error message at the ready.
Code:
#include "main.h" #define DLL extern "C" _declspec(dllexport) HANDLE handle=NULL; HWND apphwnd; HWND game; HWND childhwnd; RECT rect;
long LRESULT CALLBACK DllChildWndProc (HWND hWndParameter, UINT message,WPARAM wParam, LPARAM lParam) { switch (message) { case WM_CREATE: return 0; } return DefWindowProc(hWndParameter, message, wParam, lParam); }
void MergeChildWithParent(HWND childWindowhWnd) { SetWindowLong(childWindowhWnd, GWL_WNDPROC, DllChildWndProc); }
int CALLBACK EnumWindowsProc(HWND hwnd, LPARAM param) { DWORD pID; DWORD TpID = GetWindowThreadProcessId(hwnd, &pID); if (TpID == (DWORD)param) { apphwnd=hwnd; return false; } return true; }
HANDLE StartProcess(LPCTSTR program,LPCTSTR args) {
HANDLE hProcess = NULL; PROCESS_INFORMATION processInfo; STARTUPINFO startupInfo; ::ZeroMemory(&startupInfo,sizeof(startupInfo)); startupInfo.cb=sizeof(startupInfo); if(::CreateProcess(program,(LPTSTR)args, NULL, NULL, FALSE, 0, NULL, NULL, &startupInfo, &processInfo)) { WaitForInputIdle(processInfo.hProcess,INFINITE); ::EnumWindows(&EnumWindowsProc,processInfo.dwThreadId); hProcess=processInfo.hProcess; } return hProcess; }
DLL double HostingStartEmbed(double WindowHandle,char *Exe,char *Title,char *Class) { if (handle!=NULL) { TerminateProcess(handle,0); handle=NULL; }
game=FindWindow("YYGameMakerYY",NULL);
if ((HWND)(DWORD)WindowHandle!=NULL) { childhwnd=FindWindow(Class,Title); GetClientRect((HWND)(DWORD)WindowHandle,&rect); handle=StartProcess(Exe,"");
if (childhwnd==NULL) { if(apphwnd!=NULL) { ::SetParent(apphwnd,(HWND)(DWORD)WindowHandle); SetWindowLong(apphwnd, GWL_STYLE, WS_VISIBLE); ::MoveWindow(apphwnd,rect.left,rect.top,rect.right,rect.bottom, true); } } else { ::SetParent(childhwnd,(HWND)(DWORD)WindowHandle); SetWindowLong(childhwnd, GWL_STYLE, WS_VISIBLE); ::MoveWindow(childhwnd,rect.left,rect.top,rect.right,rect.bottom, true); } } else { childhwnd=FindWindow(Class,Title); GetClientRect(game,&rect); handle=StartProcess(Exe,"");
if (childhwnd==NULL) { if(apphwnd!=NULL) { ::SetParent(apphwnd,game); SetWindowLong(apphwnd, GWL_STYLE, WS_VISIBLE); SetWindowLong(apphwnd, GWL_EXSTYLE, WS_EX_APPWINDOW|WS_EX_TOOLWINDOW);
::MoveWindow(apphwnd,rect.left,rect.top,rect.right,rect.bottom, true); } } else { ::SetParent(childhwnd,game); SetWindowLong(childhwnd, GWL_STYLE, WS_VISIBLE); ::MoveWindow(childhwnd,rect.left,rect.top,rect.right,rect.bottom, true); } }
return 0; }
DLL double HostingEndEmbed() { if (handle!=NULL) { TerminateProcess(handle,0); handle=NULL; } return 0; }
DLL double HostingSetRectangle(double Left,double Top,double Right,double Bottom) { if (childhwnd==NULL) { if (apphwnd!=NULL) { ::MoveWindow(apphwnd,Left,Top,Right,Bottom,true); } } else { ::MoveWindow(childhwnd,Left,Top,Right,Bottom,true); } return 0; }
Error:
s\HostExe\main.cpp|9|error: expected initializer before 'DllChildWndProc'| ||=== Build finished: 1 errors, 0 warnings (0 minutes, 0 seconds) ===|
Note: apart from fixing that error I'm aware I'll still have more to do but one thing at a time I guess.
|
|
|
time-killer-games Guest
|
 |
Reply #118 Posted on: October 02, 2014, 07:52:29 PM |
|
|
|
Okay scratch what I said in the above post, it will compile fine now..
#include "main.h" #define DLL extern "C" _declspec(dllexport) HANDLE handle=NULL; HWND apphwnd; HWND game; HWND childhwnd; RECT rect;
LRESULT CALLBACK DllChildWndProc (HWND hWndParameter, UINT message,WPARAM wParam, LPARAM lParam) { switch (message) { case WM_CREATE: return 0; break; } return DefWindowProc(hWndParameter, message, wParam, lParam); }
void MergeChildWithParent(HWND childWindowhWnd, UINT message,WPARAM wParam, LPARAM lParam){ SetWindowLong(childWindowhWnd, GWL_WNDPROC, DllChildWndProc(childWindowhWnd,message,wParam,lParam)); }
int CALLBACK EnumWindowsProc(HWND hwnd, LPARAM param) { DWORD pID; DWORD TpID = GetWindowThreadProcessId(hwnd, &pID); if (TpID == (DWORD)param) { apphwnd=hwnd; return false; } return true; }
HANDLE StartProcess(LPCTSTR program,LPCTSTR args) {
HANDLE hProcess = NULL; PROCESS_INFORMATION processInfo; STARTUPINFO startupInfo; ::ZeroMemory(&startupInfo,sizeof(startupInfo)); startupInfo.cb=sizeof(startupInfo); if(::CreateProcess(program,(LPTSTR)args, NULL, NULL, FALSE, 0, NULL, NULL, &startupInfo, &processInfo)) { WaitForInputIdle(processInfo.hProcess,INFINITE); ::EnumWindows(&EnumWindowsProc,processInfo.dwThreadId); hProcess=processInfo.hProcess; } return hProcess; }
DLL double HostingStartEmbed(double WindowHandle,char *Exe,char *Title,char *Class) { if (handle!=NULL) { TerminateProcess(handle,0); handle=NULL; }
game=FindWindow("YYGameMakerYY",NULL);
if ((HWND)(DWORD)WindowHandle!=NULL) { childhwnd=FindWindow(Class,Title); GetClientRect((HWND)(DWORD)WindowHandle,&rect); handle=StartProcess(Exe,"");
if (childhwnd==NULL) { if(apphwnd!=NULL) { ::SetParent(apphwnd,(HWND)(DWORD)WindowHandle); SetWindowLong(apphwnd, GWL_STYLE, WS_VISIBLE); ::MoveWindow(apphwnd,rect.left,rect.top,rect.right,rect.bottom, true); } } else { ::SetParent(childhwnd,(HWND)(DWORD)WindowHandle); SetWindowLong(childhwnd, GWL_STYLE, WS_VISIBLE); ::MoveWindow(childhwnd,rect.left,rect.top,rect.right,rect.bottom, true); } } else { childhwnd=FindWindow(Class,Title); GetClientRect(game,&rect); handle=StartProcess(Exe,"");
if (childhwnd==NULL) { if(apphwnd!=NULL) { ::SetParent(apphwnd,game); SetWindowLong(apphwnd, GWL_STYLE, WS_VISIBLE); SetWindowLong(apphwnd, GWL_EXSTYLE, WS_EX_APPWINDOW|WS_EX_TOOLWINDOW);
::MoveWindow(apphwnd,rect.left,rect.top,rect.right,rect.bottom, true); } } else { ::SetParent(childhwnd,game); SetWindowLong(childhwnd, GWL_STYLE, WS_VISIBLE); ::MoveWindow(childhwnd,rect.left,rect.top,rect.right,rect.bottom, true); } }
return 0; }
DLL double HostingEndEmbed() { if (handle!=NULL) { TerminateProcess(handle,0); handle=NULL; } return 0; }
DLL double HostingSetRectangle(double Left,double Top,double Right,double Bottom) { if (childhwnd==NULL) { if (apphwnd!=NULL) { ::MoveWindow(apphwnd,Left,Top,Right,Bottom,true); } } else { ::MoveWindow(childhwnd,Left,Top,Right,Bottom,true); } return 0; }
But I have no idea what to do next. Or.. Is there still something wrong with what I have right now?
|
|
|
|
|
|