Click here to Skip to main content
14,691,895 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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?[^]

I am using the following code to initialize my app

BOOL CDemoApp::InitInstance()
	// 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:  
		//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; 

	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;
Updated 2-Nov-12 1:31am
__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();

Dialog initialisation should take place within the OnInitDialog()[^] function.

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

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900