不管用什么方式win32,mfc,atl/com如何能够使一个界面的"X"关闭按钮不显示。也就是这个功能用户点击不了,无效。怎么做?
解决方案 »
- 关于HOOK TrackMouseEvent函数
- 关于socket服务端的问题,还有2天就要纳品了,求求你们帮帮我吧
- 各位大虾 请问怎样获取任意ACCESS数据库中数据表的名称啊?
- 中图分类号和文献标识码是什么东西?
- 怎样把一组BMP图像生成MPEG2的格式?来者有分
- 急急急!
- !!!谁有FFT算法的C++或者C源码(100)!!!!!!!!!!!!
- 紧急求救!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- 线程调用树?怎么找到父线程?
- 我现在想把一副图象放在按纽区域,请问有无方法可以操纵一副图象在窗口中的位置
- SkinMagic 2.4 使用中发现的问题
- 模拟鼠标在菜单上移动的过程
switch(LOWORD(wParam))
{
case SC_CLOSE:
return 0;
}
break;
通常都是
switch(xxx) {
case WM_CLOSE:
EndDialog();//这里注释掉也不行吗
break;
HELLOWIN.C -- Displays "Hello, Windows 98!" in client area
(c) Charles Petzold, 1998
------------------------------------------------------------*/#include <windows.h>LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
static TCHAR szAppName[] = TEXT ("HelloWin") ;
HWND hwnd ;
MSG msg ;
WNDCLASS wndclass ;
wndclass.style = CS_HREDRAW | CS_VREDRAW ;
wndclass.lpfnWndProc = WndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = szAppName ;
if (!RegisterClass (&wndclass))
{
MessageBox (NULL, TEXT ("This program requires Windows NT!"),
szAppName, MB_ICONERROR) ;
return 0 ;
}
hwnd = CreateWindow (szAppName, // window class name
TEXT ("The Hello Program"), // window caption
WS_OVERLAPPEDWINDOW, // window style
CW_USEDEFAULT, // initial x position
CW_USEDEFAULT, // initial y position
CW_USEDEFAULT, // initial x size
CW_USEDEFAULT, // initial y size
NULL, // parent window handle
NULL, // window menu handle
hInstance, // program instance handle
NULL) ; // creation parameters
ShowWindow (hwnd, iCmdShow) ;
UpdateWindow (hwnd) ;
while (GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage (&msg) ;
DispatchMessage (&msg) ;
}
return msg.wParam ;
}LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_LBUTTONUP:
SendMessage(hwnd,WM_CLOSE,0,0);
return 0 ;
case WM_SYSCOMMAND:
switch(LOWORD(wParam))
{
case SC_CLOSE://右上角的叉叉功能没了
return 0;
}
break;
case WM_CLOSE://你要的处理代码假设如下:
if(MessageBox(hwnd,TEXT("退出程序吗? "),TEXT("标题"),MB_YESNO|MB_ICONQUESTION)!=IDYES)
return 0;
DestroyWindow(hwnd);
return 0; case WM_DESTROY:
PostQuitMessage (0) ;
return 0 ;
}
return DefWindowProc (hwnd, message, wParam, lParam) ;
}
然后就和普通菜单一样的让 CLOSE 按钮不可用,CLOSE按钮句柄用ID取得即可