Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3402364
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:07:44+00:00 2026-05-18T05:07:44+00:00

I am creating an MFC application which will be launched on click on Explorer

  • 0

I am creating an MFC application which will be launched on click on Explorer Context (Rightclick) menu.

But I need to launch only single instance of the application. For that I have to use FindWindow and AfxRegisterClass

I tried to register the class in my MFC app as below:

BOOL CNDSClientDlg::InitInstance()
{
    //Register Window Updated on 16th Nov 2010, @Subhen
    // Register our unique class name that we wish to use
    WNDCLASS wndcls;
    memset(&wndcls, 0, sizeof(WNDCLASS));
    //Class name for using FindWindow later
    wndcls.lpszClassName = _T("NDSApp");
    // Register new class and exit if it fails

    if(!AfxRegisterClass(&wndcls)) // [C]

    {
        return FALSE;
    }
}

and called the method in the constructor of the MFC class. I verified that the class is being registered while I am starting the application.

Now in my shell Extension I am trying to find the Class registered in my MFC as below:

CWnd *pWndPrev = NULL;
 pWndPrev = CWnd::FindWindow(_T("NDSApp"),NULL);
         if(pWndPrev != NULL)
            pWndPrev->BringWindowToTop();

But I am not able to get the CWnd to Window. Not able to figure it out. Please let me know if I am missing something or doing something wrong.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T05:07:45+00:00Added an answer on May 18, 2026 at 5:07 am

    FindWindow finds window instances not window classes. In your app which registers the class you need to actually create a window so that the extension can find that window.

    (Finding the window by class name is fine; the problem is you haven’t actually created anything to find.)

    Also, I suspect if you try to create a window based on the window-class you’ve registered it will fail because you’ve left most of the WNDCLASS structure null. See the example you linked to for better default values. (e.g. You must provide a wndproc and hinstance.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want the messagebox to only show if the number is equal to 0.
Let say I have the following desire, to simplify the IConvertible's to allow me
I have a new web app that is packaged as a WAR as part

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.