주석을 제거하면 트레이아이콘이 나오고 주석을 넣으면 아무 창도 안뜨고 백그라운드에서 실행
//NOTIFYICONDATA nid;
// nid.cbSize = sizeof(nid);
// nid.hWnd = m_hWnd; // 메인윈도우핸들
// nid.uID = IDR_MAINFRAME; // 아이콘리소스ID
// nid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; // 플래그설정
// nid.hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); // 아이콘로드
// CString Title = _T("초보자를위한작곡프로그램"); // 트레이위에커서가올라갔을때표시되는프로그램명
// lstrcpy(nid.szTip, Title);
// Shell_NotifyIcon(NIM_ADD, &nid);
ModifyStyleEx (WS_EX_APPWINDOW, WS_EX_TOOLWINDOW);
MoveWindow(-100,-100,0,0,1);
======아래는 퍼온글======
음....
프로그램 시작과 동시에 다이얼로그를 안보이게 할때면,(ShowWindow(SW_HIDE);를 쓰던지 우주 넘어로 날려버리던지(MoveWindow(0,0,0,0,1);) 그 와 동시에 작업표시줄에서도 그 다이얼로그의 흔적을 없애햐 한다..
너무너무 쉬운작업
그냥 초기화 함수에서
ModifyStyleEx(WS_EX_TOOLWINDOW, WS_EX_APPWINDOW);
호출하면 끗!
(혹시 안되면)
DWORD dwStyle = GetWindowLong(m_hWnd, GWL_EXSTYLE);
dwStyle &= ~WS_EX_APPWINDOW;
dwStyle |= WS_EX_TOOLWINDOW;
SetWindowLong(m_hWnd, GWL_EXSTYLE, dwStyle);
(이거 사용ㅋ)
설명하자면,
함수의 원형은
BOOL ModifyStyleEx(
DWORD dwRemove, //제거할 항목
DWORD dwAdd, //추가할 항목
UINT nFlags = 0
);
이렇게 된다..
속에 들어갈 윈도우 속성 인자들은
아래와 같고..ㅋ
- WS_EX_ACCEPTFILES Specifies that a window created with this style accepts drag-and-drop files.
- WS_EX_APPWINDOW Forces a top-level window onto the taskbar when the window is visible.
- WS_EX_CLIENTEDGE Specifies that a window has a 3D look — that is, a border with a sunken edge.
- WS_EX_CONTEXTHELP Includes a question mark in the title bar of the window. When the user clicks the question mark, the cursor changes to a question mark with a pointer. If the user then clicks a child window, the child receives a WM_HELP message.
- WS_EX_CONTROLPARENT Allows the user to navigate among the child windows of the window by using the TAB key.
- WS_EX_DLGMODALFRAME Designates a window with a double border that may (optionally) be created with a title bar when you specify the WS_CAPTION style flag in the dwStyle parameter.
- WS_EX_LEFT Gives window generic left-aligned properties. This is the default.
- WS_EX_LEFTSCROLLBAR Places a vertical scroll bar to the left of the client area.
- WS_EX_LTRREADING Displays the window text using left-to-right reading order properties. This is the default.
- WS_EX_MDICHILD Creates an MDI child window.
- WS_EX_NOPARENTNOTIFY Specifies that a child window created with this style will not send theWM_PARENTNOTIFY message to its parent window when the child window is created or destroyed.
- WS_EX_OVERLAPPEDWINDOW Combines the WS_EX_CLIENTEDGE and WS_EX_WINDOWEDGE styles
- WS_EX_PALETTEWINDOW Combines the WS_EX_WINDOWEDGE and WS_EX_TOPMOST styles.
- WS_EX_RIGHT Gives a window generic right-aligned properties. This depends on the window class.
- WS_EX_RIGHTSCROLLBAR Places a vertical scroll bar (if present) to the right of the client area. This is the default.
- WS_EX_RTLREADING Displays the window text using right-to-left reading order properties.
- WS_EX_STATICEDGE Creates a window with a three-dimensional border style intended to be used for items that do not accept user input.
- WS_EX_TOOLWINDOW Creates a tool window, which is a window intended to be used as a floating toolbar. A tool window has a title bar that is shorter than a normal title bar, and the window title is drawn using a smaller font. A tool window does not appear in the task bar or in the window that appears when the user presses ALT+TAB.
- WS_EX_TOPMOST Specifies that a window created with this style should be placed above all nontopmost windows and stay above them even when the window is deactivated. An application can use the SetWindowPosmember function to add or remove this attribute.
- WS_EX_TRANSPARENT Specifies that a window created with this style is to be transparent. That is, any windows that are beneath the window are not obscured by the window. A window created with this style receivesWM_PAINT messages only after all sibling windows beneath it have been updated.
- WS_EX_WINDOWEDGE Specifies that a window has a border with a raised edge.
그러나...
중요한건 이게 아니었다능..
나는 작업표시줄을 없애야 할땐, ModifyStyleEx(WS_EX_TOOLWINDOW, WS_EX_APPWINDOW); 이렇게 쓰는걸 외우고만 써서..
다시 생성할라니깐, 생각이 안나더라능...ㅡ.ㅡㅋ
난 왜이리 멍청한가 하는 자괴감과, 한심함이 멈먹이 된 바보인증 후에(어떻게 해야 하나..고민한지 5분후에..)
ModifyStyleEx( WS_EX_TOOLWINDOW,0 );
그냥 이렇게 쓰면, 다시 생겨난다...
당연한거....ㅡ.ㅡㅋ 속성을 제거 했으니, 다시 살리면 되잖아..ㅡ.ㅡㅋ
교훈..도대체 뭐하는 함수인지는 알고서나 함수를 쓰자..제길
'Development > visual studio' 카테고리의 다른 글
[Visual Studio에서 프로젝트 폴더 이름 변경] (0) | 2015.02.06 |
---|---|
[LINK에러시 가능한 해결법 한 가지] (0) | 2012.08.20 |
[error C2146: 구문 오류] (0) | 2012.08.19 |
[MFC 트레이아이콘으로 만들기] (0) | 2012.08.18 |
[error LNK2005] (1) | 2012.08.18 |