Pages: « 1 2 3 4 5 6 7 8 9 10 11 »
  Print  
Author Topic: Window Styler, Web Browser, and Embed Program  (Read 23524 times)
Offline (Male) time-killer-games
Reply #105 Posted on: September 28, 2014, 07:39:47 PM

Contributor
Location: Virginia Beach
Joined: Jan 2013
Posts: 1157

View Profile Email
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
Offline (Unknown gender) lonewolff
Reply #106 Posted on: September 29, 2014, 09:28:20 PM
"Guest"


Email
TKG - found another oddity also. Probably to do with playing around with the windows. But, have you noticed this?

Quote
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?  :D

Logged
Offline (Unknown gender) Darkstar2
Reply #107 Posted on: September 29, 2014, 09:32:38 PM
Member
Joined: Jan 2014
Posts: 1244

View Profile Email
TKG - found another oddity also. Probably to do with playing around with the windows. But, have you noticed this?

Quote
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?  :D

I would actually not be surprised LOL!
Logged
Offline (Unknown gender) lonewolff
Reply #108 Posted on: September 29, 2014, 09:37:14 PM
"Guest"


Email
See, he was 'the mole' all along. Throwing slander at me to take focus off himself  ;)
Logged
Offline (Unknown gender) Darkstar2
Reply #109 Posted on: September 29, 2014, 09:39:22 PM
Member
Joined: Jan 2014
Posts: 1244

View Profile Email
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 :P
Logged
Offline (Unknown gender) lonewolff
Reply #110 Posted on: September 29, 2014, 09:46:23 PM
"Guest"


Email
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 :P

As long as I get a free copy :)
Logged
Offline (Male) Goombert
Reply #111 Posted on: September 29, 2014, 10:10:13 PM

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

View Profile
Quote from: TKG
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.

Offline (Male) time-killer-games
Reply #112 Posted on: September 29, 2014, 10:28:01 PM

Contributor
Location: Virginia Beach
Joined: Jan 2013
Posts: 1157

View Profile Email
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
Offline (Unknown gender) lonewolff
Reply #113 Posted on: September 29, 2014, 10:35:31 PM
"Guest"


Email
Ah got ya :)

I thought it might be GM:S being a turd.
Logged
Offline (Male) time-killer-games
Reply #114 Posted on: September 29, 2014, 10:43:01 PM

Contributor
Location: Virginia Beach
Joined: Jan 2013
Posts: 1157

View Profile Email
Maybe it was, or maybe I'm being a turd.
Logged
Offline (Male) time-killer-games
Reply #115 Posted on: September 30, 2014, 12:58:19 PM

Contributor
Location: Virginia Beach
Joined: Jan 2013
Posts: 1157

View Profile Email
Quote from: TKG
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.

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! :D
Logged
Offline (Male) time-killer-games
Reply #116 Posted on: October 02, 2014, 12:45:20 PM

Contributor
Location: Virginia Beach
Joined: Jan 2013
Posts: 1157

View Profile Email
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. :D
Logged
Offline (Male) time-killer-games
Reply #117 Posted on: October 02, 2014, 02:00:17 PM

Contributor
Location: Virginia Beach
Joined: Jan 2013
Posts: 1157

View Profile Email
Sorry for taking so long Bob, I have the code and error message at the ready.

Code:
Code: [Select]
#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:
Code: [Select]
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
Offline (Male) time-killer-games
Reply #118 Posted on: October 02, 2014, 02:52:29 PM

Contributor
Location: Virginia Beach
Joined: Jan 2013
Posts: 1157

View Profile Email
Okay scratch what I said in the above post, it will compile fine now..
Code: [Select]
#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
Offline (Male) Goombert
Reply #119 Posted on: October 02, 2014, 04:45:55 PM

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

View Profile
Oh you fixed it? I was going to say that I don't know where that long came from but get rid of it. If that fixes it then yes, you are headed in the right direction!  (Y)

Now you can attach your child control when you create it to that message loop and intercept focus events.
http://msdn.microsoft.com/en-us/library/windows/desktop/ms646283%28v=vs.85%29.aspx

Just like we do for our main window in ENIGMA.
https://github.com/enigma-dev/enigma-dev/blob/master/ENIGMAsystem/SHELL/Platforms/Win32/WINDOWScallback.cpp#L99
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.

Pages: « 1 2 3 4 5 6 7 8 9 10 11 »
  Print