Click here to Skip to main content
15,900,816 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionAdding Scrollbar to a Dialog in MFC Pin
pix_programmer18-May-11 20:52
pix_programmer18-May-11 20:52 
AnswerRe: Adding Scrollbar to a Dialog in MFC Pin
Chandrasekharan P18-May-11 22:04
Chandrasekharan P18-May-11 22:04 
GeneralRe: Adding Scrollbar to a Dialog in MFC Pin
pix_programmer18-May-11 22:12
pix_programmer18-May-11 22:12 
GeneralRe: Adding Scrollbar to a Dialog in MFC Pin
Chandrasekharan P18-May-11 22:26
Chandrasekharan P18-May-11 22:26 
Questionvoice chat in client/server Pin
includeh1018-May-11 12:18
includeh1018-May-11 12:18 
AnswerRe: voice chat in client/server Pin
Code-o-mat19-May-11 0:24
Code-o-mat19-May-11 0:24 
QuestionHow create a windows 7 gadget with MFC in VC++2010? Pin
Hadi Dayvary18-May-11 7:36
professionalHadi Dayvary18-May-11 7:36 
AnswerRe: How create a windows 7 gadget with MFC in VC++2010? Pin
Mark Salsbery18-May-11 8:25
Mark Salsbery18-May-11 8:25 
Question.def and 64 bit Pin
Paul Bryan Porter18-May-11 5:57
Paul Bryan Porter18-May-11 5:57 
AnswerRe: .def and 64 bit Pin
Chris Meech18-May-11 6:30
Chris Meech18-May-11 6:30 
GeneralRe: .def and 64 bit Pin
Paul Bryan Porter19-May-11 12:55
Paul Bryan Porter19-May-11 12:55 
AnswerRe: .def and 64 bit Pin
Chris Losinger18-May-11 15:32
professionalChris Losinger18-May-11 15:32 
GeneralRe: .def and 64 bit Pin
Paul Bryan Porter19-May-11 12:59
Paul Bryan Porter19-May-11 12:59 
AnswerRe: .def and 64 bit Pin
Chris Losinger19-May-11 13:15
professionalChris Losinger19-May-11 13:15 
GeneralRe: .def and 64 bit Pin
Paul Bryan Porter20-May-11 5:44
Paul Bryan Porter20-May-11 5:44 
QuestionCreate DSN for SQL Server at Run time Pin
manju 318-May-11 2:36
manju 318-May-11 2:36 
QuestionRe: Create DSN for SQL Server at Run time Pin
David Crow18-May-11 3:08
David Crow18-May-11 3:08 
QuestionOpen other Application From Dialogue Pin
camuoi28817-May-11 22:59
camuoi28817-May-11 22:59 
AnswerRe: Open other Application From Dialogue Pin
Richard MacCutchan17-May-11 23:22
mveRichard MacCutchan17-May-11 23:22 
GeneralRe: Open other Application From Dialogue Pin
camuoi28817-May-11 23:48
camuoi28817-May-11 23:48 
GeneralRe: Open other Application From Dialogue Pin
Richard MacCutchan18-May-11 1:19
mveRichard MacCutchan18-May-11 1:19 
AnswerRe: Open other Application From Dialogue Pin
వేంకటనారాయణ(venkatmakam)17-May-11 23:30
వేంకటనారాయణ(venkatmakam)17-May-11 23:30 
AnswerRe: Open other Application From Dialogue Pin
Legor17-May-11 23:31
Legor17-May-11 23:31 
GeneralRe: Open other Application From Dialogue Pin
camuoi28817-May-11 23:43
camuoi28817-May-11 23:43 
AnswerRe: Open other Application From Dialogue Pin
ShilpiP18-May-11 1:55
ShilpiP18-May-11 1:55 
Simple Example of CreateProcess
//Global Variable
DWORD g_nRetVal = 0;
DWORD g_nWaitCode = 0;
HANDLE g_hWaited = NULL;

DWORD WINAPI RunUtils(void *pParam) { 
	LPCTSTR szExe = TEXT("Path of executable");
	LPTSTR szParams = TEXT(" /d C:");
	HANDLE hEvent = NULL;
	PROCESS_INFORMATION ProcessInfo;
	ZeroMemory(&ProcessInfo, sizeof(ProcessInfo));
	STARTUPINFO StartupInfo;
	ZeroMemory(&StartupInfo, sizeof(StartupInfo));
	StartupInfo.cb = sizeof(StartupInfo);
	StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
	StartupInfo.wShowWindow = SW_HIDE;
	hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
	if (CreateProcess(szExe, szParams, NULL, NULL, FALSE, CREATE_NEW_CONSOLE, NULL, NULL, &StartupInfo, &ProcessInfo)) {
		g_nWaitCode = WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
		switch (g_nWaitCode) {
			case WAIT_OBJECT_0:
				GetExitCodeProcess(ProcessInfo.hProcess, &g_nRetVal);
				break;

			case WAIT_FAILED:
				g_nWaitCode = GetLastError();
				break;
		}
		::CloseHandle(ProcessInfo.hProcess);
		::CloseHandle(ProcessInfo.hThread);
		
		ResetEvent(hEvent);

		HWND hWnd = (HWND) pParam;
		SendMessage(hWnd, WM_USER_THREAD_WAITED, 0, 0);
	}
	return 0;
}

void CThunghiemDlg::OnButtonOpen()
{
	// TODO: Add your control notification handler code here
	HANDLE hExecThread = NULL;
	if(m_bCleanUp)
	{
		hExecThread = CreateThread(NULL, 0, &RunUtils, (LPVOID) m_hWnd, 0, NULL);
	}
}


You can do the same by using ShellExecute
void CThunghiemDlg::OnButtonOpen() 
{
	ShellExecute(NULL, "open", "path of executable", NULL, NULL, SW_SHOWNORMAL);	
	
}

"Every Little Smile can touch Somebody's Heart...
May we find Hundreds of Reasons to Smile Everyday... and
May WE be the Reason for someone else to smile always!" (ICAN)

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.