CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2013
    Posts
    15

    I can't use FindWindowEx() to find control.

    I want to open Microsoft Security Essential program and click Scan now button with VC . I can find window but Can't find control. This is my code when I run this code it show Control not found . I try to test this code with click Browse button in Run program it work but when I try to use with Microsoft Security Essential it not found control. I don't know why maybe this control is in Tab . How to use FindWindowEx() click Scan now button in Microsoft Security Essential ?

    Code:
    int run_ms(){	
    
    	ShellExecute(NULL, L"open", L"C:/Program Files/Microsoft Security Client/msseces.exe", NULL, NULL, SW_SHOWNORMAL);
    
            HWND w;
    	w=FindWindow(NULL, L"Microsoft Security Essentials");
    
    		if(w==NULL)
    				MessageBox(NULL,L"Not found",L"",MB_OK);
    
    		else{
    				HWND cb;
    				cb = FindWindowEx(w,NULL,NULL,_T("&Scan now"));		
    
    			if(cb!=NULL)
    			{
    				SendMessage(cb,WM_LBUTTONDOWN, NULL,NULL);
    				SendMessage(cb,WM_LBUTTONUP, NULL,NULL);
    			}
    			else
    				MessageBox(NULL,L"Control not found",L"",MB_OK);
    		}
    
    			return 0;
    }
    Last edited by mmc01; February 14th, 2013 at 10:46 PM.

  2. #2
    Join Date
    Jul 2002
    Posts
    2,543

    Re: I can't use FindWindowEx() to find control.

    Start from learning Microsoft Security Essential window structure with Spy++.

  3. #3
    Join Date
    Feb 2013
    Posts
    15

    Re: I can't use FindWindowEx() to find control.

    I use Spy++ with button in Microsoft Security Essential it show like this

    Caption : &Scan now
    Class : ALT:BUTTON
    I use FindWindowEx() like this cb = FindWindowEx(w,NULL,NULL,_T("&Scan now")); but it not found Control.

  4. #4
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: I can't use FindWindowEx() to find control.

    Quote Originally Posted by mmc01 View Post
    I use Spy++ with button in Microsoft Security Essential it show like this

    I use FindWindowEx() like this cb = FindWindowEx(w,NULL,NULL,_T("&Scan now")); but it not found Control.
    And why you're so sure you're able to do that? Did you follow the advice Alex F gave you?
    Best regards,
    Igor

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured