Click here to Skip to main content
12,300,347 members (54,763 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C++ MFC
Hello ,I am developing a Piano application using MFC Dialog,I need to make use of Multitouch in it,all examples i have seen so far is of SDI/MDI which include creation of "OnCreate()" function in CChildView Class,as CChildView is not created in dialog based how to achieve the Multitouch? http://msdn.microsoft.com/en-us/windows7trainingcourse_win7multitouchgesturenative_topic2#_Toc243305418[^]

I am using the following code to initialize my app

BOOL CDemoApp::InitInstance()
{
	 
		AfxEnableControlContainer();
	// Standard initialization
	// If you are not using these features and wish to reduce the size
	//  of your final executable, you should remove from the following
	//  the specific initialization routines you do not need.
 
	Application *pApp = NULL;
 
	try {
		// Try an optional debug value to test an expired application ID:  
		// 	extern const ADP_APPLICATIONID ADP_EXPIRED_APPLICATIONID;
		//pApp = new Application(ApplicationId(0xAE395E85,0x332E49E4,0xA250C7B0,0x34F907BC));
		
	} catch (AdpException& e) {
		//cout << "The attempt to authorize the application failed!\n" << e.what() << endl;
		if (pApp != NULL)
		delete pApp;
		// Your code may choose to abort/exit here after informing the user of the situation
		MessageBox(NULL,"Application is not authorised to run on this machine, a valid Application ID is needed. Exiting....","sample app",MB_OK);
		ADP_Close(); //(comment this line to run the application without authorizing the application id)
		exit( -1 ); //(comment this line to run the application without authorizing the application id)
	}
	
	// ... Your code can continue..Normal operation continues here
	if (pApp != NULL) 
		delete pApp; 
		
 
 
	CSplashWindow::ShowSplashScreen();
	CDemoDlg dlg;
	m_pMainWnd = &dlg;
	 
	INT_PTR nResponse = dlg.DoModal();
 
	if (nResponse == IDOK)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with OK
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with Cancel
	}
 
	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	return FALSE;
}
Posted 21-Sep-12 2:00am
Edited 2-Nov-12 0:31am
Nelek94K
v8
Comments
__John_ 21-Sep-12 8:35am
   
Multitouch is not dependant on OnCreate(). Why do you think you need OnCreate()?
SaurabSaini 21-Sep-12 9:13am
   
Acctually right from the registration to the windows and code definition is given in CChildview which is by default created in SDI/MDI as given in samples.I need to know can the same be performed on dialog class,as it is hard to find any samples in dialog based multitouch .
Richard MacCutchan 2-Nov-12 7:02am
   
You have updated your original post but you have not changed your question. Please try and explain exactly what help you need.
SaurabSaini 3-Nov-12 10:18am
   
Sir, In the code given above i am invoking my application using
INT_PTR nResponse = dlg.DoModal(); ie i am calling a dialog (which is my framework). But as per the documentation, for RegisterTouchWindow(), i need to provide a handle to the dialog ie hwnd....for which i need to give hwnd=CreateWindow(); by doing which my application doesnot run, by giving no Build errors.
Also WM_TOUCH message is not reading. I don't want to CreateWindow(); as i am already calling a Dialog from resource by Dlg.DoModal();
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Dialog initialisation should take place within the OnInitDialog()[^] function.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160525.2 | Last Updated 2 Nov 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100