Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorAlexander Kuznetsov <kuzsasha@gmail.com>2011-07-30 23:09:34 +0400
committerAlexander Kuznetsov <kuzsasha@gmail.com>2011-07-30 23:09:34 +0400
commit6e788c37df2d5209d66bcf7e3d19bd08cd583667 (patch)
treeda99374a5ae8a612fc23f2ecbeef93ebab61de62 /intern
parent805a169f7065222ce047d950c55b585b36bc4b24 (diff)
Hides console on win32 even if python path is 2 or more lines
Adding tlhelp32.h header
Diffstat (limited to 'intern')
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.cpp29
1 files changed, 27 insertions, 2 deletions
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 4f0e7d8e604..95b3456ce3b 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -55,6 +55,7 @@
#define _WIN32_IE 0x0501
#include <windows.h>
#include <shlobj.h>
+#include <tlhelp32.h>
// win64 doesn't define GWL_USERDATA
#ifdef WIN32
@@ -1242,8 +1243,32 @@ int GHOST_SystemWin32::toggleConsole(int action)
{
case 3: //hide if no console
{
- CONSOLE_SCREEN_BUFFER_INFO csbi = {{0}};
- if(!GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi) || csbi.dwCursorPosition.X || csbi.dwCursorPosition.Y>1)
+ DWORD sp = GetCurrentProcessId();
+ HANDLE ptree = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
+ PROCESSENTRY32 e = {0}; e.dwSize = sizeof(PROCESSENTRY32);
+
+ if( Process32First(ptree, &e)) {
+ do { //Searches for Blender's PROCESSENTRY32
+ if (e.th32ProcessID == sp) {
+ sp = e.th32ParentProcessID;
+ Process32First(ptree, &e);
+ do { //Got parent id, searches for its PROCESSENTRY32
+ if (e.th32ProcessID == sp) {
+ if(strcmp("explorer.exe",e.szExeFile)==0)
+ { //If explorer, hide cmd
+ ShowWindow(GetConsoleWindow(),SW_HIDE);
+ m_consoleStatus = 0;
+ }
+ break;
+ }
+
+ } while( Process32Next(ptree, &e));
+ break;
+ }
+ } while( Process32Next(ptree, &e));
+ }
+
+ CloseHandle(ptree);
break;
}
case 0: //hide