Pages: 1
  Print  
Author Topic: Splash functions  (Read 9791 times)
Offline (Unknown gender) time-killer-games
Posted on: May 08, 2013, 01:31:06 pm
"Guest"


Email
here's the code.


Code: [Select]
  HWND apphwnd;
  HANDLE handle;

    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 StartNewProcess(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,  // process security
                                        NULL,  // thread security
                                        FALSE, // no inheritance
                                        0,     // no startup flags
                                        NULL,  // no special environment
                                        NULL,  // default startup directory
                                        &startupInfo,
                                        &processInfo))
                        { /* success */
                        Sleep(5000);//wait for the window of exe application created
                        ::EnumWindows(&EnumWindowsProc, processInfo.dwThreadId);
                        hProcess = processInfo.hProcess;
                        } /* success */
                return hProcess;//Return HANDLE of process.
            }

  int splash_show_program(char *program)
  {
      StartNewProcess(program);
      ::SetParent(apphwnd,m_hWnd)
      ::SetWindowLong(apphwnd, GWL_STYLE, WS_VISIBLE);
      CRect rect;
      GetClientRect(&rect);
      ::MoveWindow(apphwnd, rect.left, rect.top,rect.right, rect.bottom, true);
  }

  int splash_terminate_program()
  {
      TerminateProcess(handle,0);
  }
« Last Edit: May 08, 2013, 01:33:22 pm by time-killer-games » Logged
Offline (Male) Goombert
Reply #1 Posted on: May 08, 2013, 11:29:40 pm

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

View Profile
When I am free if you don't start on bridges then I will get around to it when I can to expose the Window handle and create a proper bridge for the necessary systems.
Please note as well we have discussion ongoing regarding that functions should be placed in side namespace enigma_user {}; as that is the namespace the engine will use for function detection, everything outside the namespaces scope is hidden from the end user.
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: May 09, 2013, 12:14:05 pm
"Guest"


Email
Quite honestly, I have not a clue on how to impliment my code into enigma and I think it would be much better if some one else did the rest.
Logged
Pages: 1
  Print