⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 burncdpage.cpp

📁 把doc文档转成pdf后刻录成CD,用VC++开发,用了Nero的SDK和CXIMAGE的D
💻 CPP
📖 第 1 页 / 共 2 页
字号:
						break;
						
					case COMMAND_LISTFORMATS:
						code = s_BurnContext.CommandListFormats (params);
						break;
						
					case COMMAND_INTERNAL:
						// This command in strictly for INTERNAL use!!!
						// 
						code = s_BurnContext.CommandInternal (params);
						break;
						
					default:
						// Open the selected device. We didn't need this unitl now.
						
						code = s_BurnContext.OpenDevice (params);
						if (code == EXITCODE_OK)
						{
							switch (params.GetCommand())
							{
							case COMMAND_ERASE:
								code = s_BurnContext.CommandErase (params);
								break;
								
							case COMMAND_WRITE:
								code = s_BurnContext.CommandWrite (params);
								break;
								
							case COMMAND_CDINFO:
								code = s_BurnContext.CommandCDInfo (params);
								break;
								
							case COMMAND_READ:
								code = s_BurnContext.CommandRead (params);
								break;
								
							case COMMAND_EJECT:
							case COMMAND_LOAD:
								code = s_BurnContext.CommandEject (params);
								break;
								
							case COMMAND_DRIVE_INFO:
								code = s_BurnContext.CommandDriveInfo (params);
								break;
								
							case COMMAND_GET_SPEEDS:
								code = s_BurnContext.CommandGetSpeeds (params);
								break;
								
							case COMMAND_ESTIMATE:
								code = s_BurnContext.CommandEstimate (params);
								break;
								
							case COMMAND_INTERNAL:
								// This command is strictly for INTERNAL (testing) use!!!
								//
								code = s_BurnContext.CommandInternal (params);
								break;
								
							default:
								
								// This should never happen!
								
								_ASSERTE (FALSE);
								code = EXITCODE_INTERNAL_ERROR;
							}
						}
					}
				}
			}
		}
	}
	
	//printf ("\r");
	
	// Print the user interaction error, if any.
	// 
	s_BurnContext.PrintUserInteractionMessage ();
	
	// Write Nero error log.
	
	s_BurnContext.WriteNeroErrorLog (params);
	
	// Print the exit code to the error log.
	// This is good for checking success of batch mode runs.
	
	s_BurnContext.PrintLogLine(CExitCode (code).GetTextualExitCode());

*/
	::SendMessage(theConf.m_BurnWindow, WM_BURN_PROGRESS, 1, 100);

	return iRes;
}



LRESULT CBurnCDPage::OnBurnProgress(WPARAM wParam, LPARAM lParam)
{
	if (wParam==0)
		m_BurnProgress.SetPos(lParam);

	if ((wParam==1) && (lParam==100))
	{
		m_BurnProgress.SetPos(0);
		
		GetDlgItem(IDC_BURN_CD)->EnableWindow(TRUE);
		GetDlgItem(IDC_AVOID_BURN)->EnableWindow(TRUE);

		CPropertySheetEx* pParent=(CPropertySheetEx*) GetParent();
		pParent->SetWizardButtons(PSWIZB_BACK | PSWIZB_NEXT);
	}

	if (wParam==2)		//feedback
	{
		m_Feedback=theConf.m_Feedback;
		UpdateData(FALSE);
	}

	return 0;
}

void CBurnCDPage::FillComboDrives()
{
	NeroAPIGlueConnect(NULL);
	
	char pcLanguageFile [128];
    char pcSoftware [128];
    char pcVendor [128];
	char pcNeroFilesPath [128];
	
	
	strcpy(pcNeroFilesPath, "NeroFiles");
	strcpy(pcVendor, "ahead");
	strcpy(pcSoftware, "Nero - Burning Rom");
	
	// use the US-English error message file
	
	strcpy(pcLanguageFile, "Nero.txt");
	
	NERO_SETTINGS nsSettings;
	
	nsSettings.nstNeroFilesPath = pcNeroFilesPath;
	nsSettings.nstVendor = pcVendor;
	
	// set pointers to various callback functions
	
	nsSettings.nstIdle.ncCallbackFunction = NULL;      
	
	// this pointer is required to access non-static variables from callback functions
	
	nsSettings.nstIdle.ncUserData = this;
	nsSettings.nstSoftware = pcSoftware;
	nsSettings.nstUserDialog.ncCallbackFunction = NULL; 
	nsSettings.nstUserDialog.ncUserData = this;
	nsSettings.nstLanguageFile =pcLanguageFile;
	
	NEROAPI_INIT_ERROR initErr;
	initErr = NeroInit (&nsSettings, NULL);
	
	NERO_SCSI_DEVICE_INFOS* pndiDeviceInfos = NeroGetAvailableDrivesEx (MEDIA_CDRW, NULL);
	
	// check whether any devices have been found 
	if (!pndiDeviceInfos)
	{
		// no device found, let the user know
		//"NeroGetAvailableDrivesEx() returned no available devices."

		GetDlgItem(IDC_BURN_CD)->EnableWindow(FALSE);
		AfxMessageBox("GetAvailableDrivesEx() returned no available devices.");
	}
	else
	{
		// devices found
		// check the number of available devices to be sure
		
		if (pndiDeviceInfos->nsdisNumDevInfos > 0)
		{
			// we have some devices, now fill the ComboBox
			
			//AppendString("Found the following devices:");
			for (DWORD dDeviceCounter = 0; dDeviceCounter < pndiDeviceInfos->nsdisNumDevInfos; dDeviceCounter++)
			{
				//AppendString(pndiDeviceInfos->nsdisDevInfos[dDeviceCounter].nsdiDeviceName);
				
				// add the device name to the ComboBox and get the index number
				
				if (stricmp(pndiDeviceInfos->nsdisDevInfos[dDeviceCounter].nsdiDeviceName, IMAGE_RECORDER)!=0)
				{
					int i = m_Drive.AddString(pndiDeviceInfos->nsdisDevInfos[dDeviceCounter].nsdiDeviceName);
				
					// use the index number to access the corresponding entry
					// connect the entry's ItemData pointer to a NERO_DEVICE_INFO structure
					m_Drive.SetItemDataPtr(i, &pndiDeviceInfos->nsdisDevInfos[dDeviceCounter]);
				}
			}
			
			// select the first ComboBox entry
			m_Drive.SelectString(-1, pndiDeviceInfos->nsdisDevInfos[0].nsdiDeviceName);
		}
		else
		{
			//AppendString("The number of available devices is 0.");
			GetDlgItem(IDC_BURN_CD)->EnableWindow(FALSE);
			AfxMessageBox("The number of available devices is 0.");
		}
	}
}

/*
	//if we want to simulate the burning progress
	argc=8;
	//strcpy(argv[0], "NeroCMD");
	strcpy(argv[0], "--write");
	strcpy(argv[1], "--drivename");
	strcpy(argv[2], DriveName);	//theConf.m_DriveLetter.GetBuffer(0) //pbt->DriveName
	strcpy(argv[3], "--iso");
	strcpy(argv[4], theConf.m_ProjectName.GetBuffer(0));	//Title
	strcpy(argv[5], ProjectFolder.GetBuffer(0));			//Folder
	strcpy(argv[6], "--recursive");
	strcpy(argv[7], "--no_error_log");
*/

UINT DoNeroTask(int argc, char** ppargv)
{
	PARAMETERS params;
	EXITCODE code;
	CBurnContext s_BurnContext(&params);
	
	// Get the parameters from the command line.
	
	if (!getopt (params, //--
				argc, //++
				ppargv))
	{
		return s_BurnContext.Exit (EXITCODE_BAD_USAGE);
	}
	
	// Open the log file. If the log file name was not specified
	// no file will be be openned.
	
	s_BurnContext.OpenLogFile (params.GetErrorLogName());
	
	// Load the NEROAPI.DLL.
	
	code = s_BurnContext.NeroLoad ();
	if (code != EXITCODE_OK)
	{
		return s_BurnContext.Exit (code);
	}
	
	if (COMMAND_VERSION == params.GetCommand())
	{
		// Display version information.
		
		s_BurnContext.CommandVersion ();
		code = EXITCODE_OK;
	}
	else
	{
		// Initialize NeroAPI.
		
		code = s_BurnContext.InitNeroAPI ();
		if (code == EXITCODE_OK)
		{
			if (params.GetCommand () == COMMAND_IMAGE_INFO)
			{
				code = s_BurnContext.CommandImageInfo (params);
			}
			else
			{
				// Get available drives.
				
				code = s_BurnContext.GetAvailableDrives (params);
				if (code == EXITCODE_OK)
				{
					switch (params.GetCommand())
					{
					case COMMAND_LISTDRIVES:
						// Just give a nice listing of all available drives.
						
						code = s_BurnContext.CommandListDrives (params);
						break;
						
					case COMMAND_LISTFORMATS:
						code = s_BurnContext.CommandListFormats (params);
						break;
						
					case COMMAND_INTERNAL:
						// This command in strictly for INTERNAL use!!!
						// 
						code = s_BurnContext.CommandInternal (params);
						break;
						
					default:
						// Open the selected device. We didn't need this unitl now.
						
						code = s_BurnContext.OpenDevice (params);
						if (code == EXITCODE_OK)
						{
							switch (params.GetCommand())
							{
							case COMMAND_ERASE:
								code = s_BurnContext.CommandErase (params);
								break;
								
							case COMMAND_WRITE:
								code = s_BurnContext.CommandWrite (params);
								break;
								
							case COMMAND_CDINFO:
								code = s_BurnContext.CommandCDInfo (params);
								break;
								
							case COMMAND_READ:
								code = s_BurnContext.CommandRead (params);
								break;
								
							case COMMAND_EJECT:
							case COMMAND_LOAD:
								code = s_BurnContext.CommandEject (params);
								break;
								
							case COMMAND_DRIVE_INFO:
								code = s_BurnContext.CommandDriveInfo (params);
								break;
								
							case COMMAND_GET_SPEEDS:
								code = s_BurnContext.CommandGetSpeeds (params);
								break;
								
							case COMMAND_ESTIMATE:
								code = s_BurnContext.CommandEstimate (params);
								break;
								
							case COMMAND_INTERNAL:
								// This command is strictly for INTERNAL (testing) use!!!
								//
								code = s_BurnContext.CommandInternal (params);
								break;
								
							default:
								
								// This should never happen!
								
								_ASSERTE (FALSE);
								code = EXITCODE_INTERNAL_ERROR;
							}
						}
					}
				}
			}
		}
	}
	
	//printf ("\r");
	
	// Print the user interaction error, if any.
	// 
	s_BurnContext.PrintUserInteractionMessage ();
	
	// Write Nero error log.
	
	s_BurnContext.WriteNeroErrorLog (params);
	
	// Print the exit code to the error log.
	// This is good for checking success of batch mode runs.
	
	s_BurnContext.PrintLogLine(CExitCode (code).GetTextualExitCode());

	return (s_BurnContext.Exit(code));
}


BOOL WarnForFileOnCD(CString DriveLetter)
{
	CString FullDriveLetter=DriveLetter + _T(":\\*.*");
	
	//now populate the files of drive
	CFileFind m_filefind;
	BOOL bresult=m_filefind.FindFile(FullDriveLetter);
	
	if  (bresult)
	{
		bresult=m_filefind.FindNextFile();	
	
		if (bresult)
			return TRUE;
		else
			return FALSE;
	}

	return FALSE;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -