Revision: 38859
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38859
Author: alexk
Date: 2011-07-30 19:09:34 +0000 (Sat, 30 Jul 2011)
Log Message:
-----------
Hides console on win32 even if python path is 2 or more lines
Adding tlhelp32.h header
Modified Paths:
--------------
trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp
Modified: trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp 2011-07-30
17:27:54 UTC (rev 38858)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp 2011-07-30
19:09:34 UTC (rev 38859)
@@ -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 @@
{
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
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs