Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable X on Windows control box ?

Status
Not open for further replies.

bkdesler

Programmer
Oct 9, 2003
3
US
Hi

I am using a java front end to communicate with a Visio drawing
application.I am trying to disable the X button of the controlbox on visio application. I am using jni to accomplish that. I am to disable X button on main application window. However when I open another window(e.g. new drawing) - the child window initially opens with X not disabled. Only when I manually click on the restore button then the button seems to be disable. I call my C dll in java from windowOpened event of visio. My question is what should I do to disable the X button soon after the child window is opened? Here is the code I am using

LONG CurrentStyle;
HWND ahnd;
LONG X;
JNIEXPORT void JNICALL
Java_com_webnettrak_client_util_WindowsApi_RemoveC
loseFromWindow
(JNIEnv *env, jclass obj, jint hwnd)
{
// get parent window from child window handle
ahnd = GetParent((HWND)hwnd);
CurrentStyle = GetWindowLongW(ahnd, GWL_STYLE);
CurrentStyle = CurrentStyle &(~WS_SYSMENU);
X = SetWindowLongW(ahnd, GWL_STYLE, CurrentStyle) ;
SetWindowPos(ahnd,HWND_TOP,0,0,0,0,SWP_NOMOVE|SWP_
NOSIZE);
}

Thanks in advance

Dhiresh

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top