Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I have a small group of computers (about six) set up in a domain. I have created a login script to run and map the printer, map networked drives, synchronize the time, etc. We are planning expand later, and some users get confused and close the logon batch. How can I disabled the "close button" in the title bar so that users can't exit until the script is done?

Try this small program to Show/Hide Active Buttons:
http://website.lineone.net/~john.keeping/showhide.html
I found a few other ideas by typing "hide windows program buttons" in Google!

Here is a simple VC7 program that will do exactly what you want. Works on Win2k and above (only because I didn't use the generic GetConsoleWindow function).
------------ stdafx.h --------------
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//#pragma once
#define _WIN32_WINNT 0x0500#include <iostream>
#include <tchar.h>
#include <windows.h>
#include <wincon.h>---------- DisableX.cpp -------------
#include "stdafx.h"int _tmain(int argc, _TCHAR* argv[])
{
HWND h;
HMENU sm;
int i, j, c;
LPTSTR buf;// get the handle to the console
h = GetConsoleWindow();
// get handle to the System Menu
sm = GetSystemMenu(h, false);
// how many items are there?
c = GetMenuItemCount(sm);
j = -1;
buf = new TCHAR[256];
for (i=0; i<c; i++) {
// find the one we want
GetMenuString(sm, i, buf, 255, MF_BYPOSITION);
if (!strcmp(buf, "&Close")) {
j = i;
break;
}
}
// if found, remove that menu item
if (j >= 0)
RemoveMenu(sm, j, MF_BYPOSITION);
return 0;
}

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |