Click here to Skip to main content
15,903,175 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Find control on dialog Pin
Giorgi Dalakishvili21-May-08 11:18
mentorGiorgi Dalakishvili21-May-08 11:18 
AnswerRe: Find control on dialog Pin
Force Code21-May-08 11:21
Force Code21-May-08 11:21 
GeneralRe: Find control on dialog Pin
Giorgi Dalakishvili21-May-08 11:25
mentorGiorgi Dalakishvili21-May-08 11:25 
GeneralRe: Find control on dialog Pin
Force Code21-May-08 11:37
Force Code21-May-08 11:37 
GeneralRe: Find control on dialog Pin
Giorgi Dalakishvili21-May-08 11:50
mentorGiorgi Dalakishvili21-May-08 11:50 
GeneralRe: Find control on dialog Pin
Force Code21-May-08 12:14
Force Code21-May-08 12:14 
GeneralRe: Find control on dialog Pin
Rajesh R Subramanian21-May-08 20:21
professionalRajesh R Subramanian21-May-08 20:21 
AnswerRe: Find control on dialog Pin
Rajesh R Subramanian21-May-08 19:51
professionalRajesh R Subramanian21-May-08 19:51 
Hi Giorgi,

I chose the Start-->>Run dialog. I then found out the handle of the Run dialog window with Spy++ (You said that you will know it in your case). I am trying to find the OK button with code, using FindWindowEx(). And this small program works for me:
#include "stdafx.h"
#include "CPConsole.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

CWinApp theApp;

using namespace std;

int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
	int nRetCode = 0;

	// initialize MFC and print and error on failure
	if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
	{
		// TODO: change error code to suit your needs
		_tprintf(_T("Fatal Error: MFC initialization failed\n"));
		nRetCode = 1;
	}
	else
	{
		<font color="brick">HWND hTarget = FindWindowEx((HWND)0x010403CE, //Hard coded handle value 
                                          NULL, //Let the search begin with the first child
                                          _T("Button"), //Class name
                                          _T("OK")); //Window title
		if(hTarget)
			AfxMessageBox(_T("OK button was found"));
		else
			AfxMessageBox(_T("Unable to find the OK button"));</font>
	}
	return nRetCode;
}



Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP

GeneralRe: Find control on dialog Pin
Giorgi Dalakishvili21-May-08 19:58
mentorGiorgi Dalakishvili21-May-08 19:58 
Questionmodifying an REOBJECT Pin
Force Code21-May-08 10:00
Force Code21-May-08 10:00 
QuestionINCONSISTENCY IN VC++ Pin
edu.net21-May-08 9:35
edu.net21-May-08 9:35 
GeneralRe: INCONSISTENCY IN VC++ Pin
JudyL_MD21-May-08 10:02
JudyL_MD21-May-08 10:02 
GeneralRe: INCONSISTENCY IN VC++ Pin
edu.net21-May-08 10:40
edu.net21-May-08 10:40 
QuestionRe: INCONSISTENCY IN VC++ Pin
CPallini21-May-08 10:48
mveCPallini21-May-08 10:48 
QuestionHow to view .lib contents Pin
Jesse Evans21-May-08 7:57
Jesse Evans21-May-08 7:57 
AnswerRe: How to view .lib contents Pin
CPallini21-May-08 8:13
mveCPallini21-May-08 8:13 
GeneralRe: How to view .lib contents Pin
Jesse Evans21-May-08 8:23
Jesse Evans21-May-08 8:23 
GeneralYou're welcome. Pin
CPallini21-May-08 9:39
mveCPallini21-May-08 9:39 
GeneralRe: You're welcome. Pin
Hamid_RT21-May-08 17:56
Hamid_RT21-May-08 17:56 
GeneralRe: You're welcome. Pin
CPallini21-May-08 21:41
mveCPallini21-May-08 21:41 
GeneralRe: You're welcome. Pin
Hamid_RT21-May-08 23:27
Hamid_RT21-May-08 23:27 
GeneralRe: You're welcome. Pin
ThatsAlok16-Jul-09 20:37
ThatsAlok16-Jul-09 20:37 
JokeRe: You're welcome. Pin
Rajesh R Subramanian21-May-08 20:18
professionalRajesh R Subramanian21-May-08 20:18 
GeneralRe: You're welcome. Pin
CPallini21-May-08 21:41
mveCPallini21-May-08 21:41 
JokeRe: You're welcome. Pin
Cedric Moonen21-May-08 20:32
Cedric Moonen21-May-08 20:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.