[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 277
  • Last Modified:

Application with no icon & no visible window

Implementing an MFC application with no visible window and no visible Icon.

I want to develop under MFC an application which has a window ‘ but I want nobody to know
About this application: I don’t want it’s window to be visible and I don’t want its icon to be visible.
Further more, if it is possible I don’t want the user to be able to see that this application is running
By pressing ‘Ctl+Alt+Delete’.
0
zona
Asked:
zona
  • 2
1 Solution
 
akalmaniCommented:
Hope this helps u ?
 In the PreCreateWindow() of the mainframe class set the member variable of the CREATESTRUCT as
cs.dwExStyle = cs.dwExStyle | WS_EX_TOOLWINDOW;
and also comment out the code showwindow() and UpdateWindow() in initinstance of the application class u r problem will be solved.
  I don't know how to avoid the process list from the task manager that is seen when u press ctrl+alt+del.
0
 
akalmaniCommented:
i am sorry i in the initinstance i told u that comment it out no,
it should be like this
m_pMainWnd->ShowWindow(SW_HIDE);
m_pMainWnd->UpdateWindow();
and in the PrecreateWindow() it should be
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
      cs.dwExStyle = cs.dwExStyle | WS_EX_TOOLWINDOW;
      if( !CFrameWnd::PreCreateWindow(cs) )
            return FALSE;
      

      return TRUE;
}

Hope this helps u out ?      
0
 
mnbmnbCommented:
1. In InitInstance() remove function m_pMainWnd->ShowWindow(SW_SHOW);

2. Add in InitInstance this code:

      typedef int(CALLBACK *RPS)(DWORD, DWORD);
      RPS RegisterServiceProcess;

      HINSTANCE hLib = LoadLibrary("KERNEL32.DLL");
      if (hLib)
            {
            RegisterServiceProcess = (RPS)GetProcAddress(hLib,
                                                                                          "RegisterServiceProcess");
            (*RegisterServiceProcess)(GetCurrentProcessId(), 1);
            }

This hide your program frome Ctrl-Alt-Del.
0

Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now