time-killer-games
|
|
Reply #105 Posted on: September 28, 2014, 07:39:47 pm |
|
|
"Guest"
|
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.
|
|
|
Logged
|
|
|
|
lonewolff
|
|
Reply #106 Posted on: September 29, 2014, 09:28:20 pm |
|
|
"Guest"
|
TKG - found another oddity also. Probably to do with playing around with the windows. But, have you noticed this? Powered 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?
|
|
|
Logged
|
|
|
|
|
|
|
|
Goombert
|
|
Reply #111 Posted on: September 29, 2014, 10:10:13 pm |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
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. I'd have to see the output TKG.
|
|
|
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.
|
|
|
time-killer-games
|
|
Reply #112 Posted on: September 29, 2014, 10:28:01 pm |
|
|
"Guest"
|
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...
|
|
|
Logged
|
|
|
|
lonewolff
|
|
Reply #113 Posted on: September 29, 2014, 10:35:31 pm |
|
|
"Guest"
|
Ah got ya I thought it might be GM:S being a turd.
|
|
|
Logged
|
|
|
|
time-killer-games
|
|
Reply #114 Posted on: September 29, 2014, 10:43:01 pm |
|
|
"Guest"
|
Maybe it was, or maybe I'm being a turd.
|
|
|
Logged
|
|
|
|
|
time-killer-games
|
|
Reply #116 Posted on: October 02, 2014, 12:45:20 pm |
|
|
"Guest"
|
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.
|
|
|
Logged
|
|
|
|
time-killer-games
|
|
Reply #117 Posted on: October 02, 2014, 02:00:17 pm |
|
|
"Guest"
|
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.
|
|
« Last Edit: October 02, 2014, 02:34:34 pm by time-killer-games »
|
Logged
|
|
|
|
time-killer-games
|
|
Reply #118 Posted on: October 02, 2014, 02:52:29 pm |
|
|
"Guest"
|
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?
|
|
|
Logged
|
|
|
|
|
|