Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I can minimize a notebook easy enough with Mathematica code, but how does one minimize all of the Mathematica front end? Just as if you clicked the minimize button on the menu bar? This is for version 8 on windows XP if that helps.

share|improve this question
    
What do you mean by this: "I can minimize a notebook easy enough with Mathematica code" ? –  Vitaliy Kaurov Aug 13 '12 at 0:49
1  
@VitaliyKaurov FrontEndTokenExecute[SelectedNotebook[], "WindowMiniaturize"] –  wxffles Aug 13 '12 at 2:08
1  
There was a FE token FrontEndHide, but it only worked on NeXt computers (as of Mma V3). It does nothing when executed in my current machine. –  belisarius Aug 13 '12 at 2:55
add comment

1 Answer 1

Until a better answer comes along, I present, for your edification, an ugly hack that isn't really Mathematica per se:

Needs["CCompilerDriver`"]

src = "
  #include \"WolframLibrary.h\"
  #include <windows.h>
  #include <string>

  BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
  {
    char title[256];
    GetWindowText(hwnd, title, sizeof(title));
    std::string t(title);
    if(t.find(\"Wolfram Mathematica 8\") != std::string::npos)
        ShowWindow(hwnd, SW_MINIMIZE);
    return TRUE;
  }

  EXTERN_C DLLEXPORT int hide(WolframLibraryData libData,
    mint Argc, MArgument *Args, MArgument Res)
  {
    EnumWindows(EnumWindowsProc, 0);
    return LIBRARY_NO_ERROR;
  }
";

hidelib = CreateLibrary[src, "hide", "Language" -> "C++",
  "CompileOptions" -> {"/EHsc"},
  "Libraries" -> {"user32.lib"},
  "Debug" -> False]

hide = LibraryFunctionLoad[hidelib, "hide", {}, "Void"]

And to use:

hide[]
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.