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

📄 adofiltr.h

📁 windows ce开发技巧与实例光盘代码
💻 H
字号:
/////////////////////////////////////////////////////////////////////////////
//
// AdoFiltr.h : Wrapper functions for the DESKTOPTODEVICE and DEVICETODESKTOP
// functions exported by ADOFILTR.DLL.
//
// Original code from:
// Copyright (c) 2000-2001 Nathan Lewis
// nlewis@programmer.net
// http://www.ticz.com/~nlewis
//
// Modified by Olivier G. Gaumond (2002)
// ogaumond@yahoo.com
//
// I encapsulated the functions in a C++ class
//
//
// This program is free software; you can redistribute it and/or modify it
// so long as credit is given to the original author listed above.
// 
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE.
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_ADOFILTR1_H__D2BD37E3_B8F5_11D6_802A_0004762AD386__INCLUDED_)
#define AFX_ADOFILTR1_H__D2BD37E3_B8F5_11D6_802A_0004762AD386__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define DESKTOPTODEVICE		DesktopToDevice
#define DEVICETODESKTOP		DeviceToDesktop


class CAdoFiltr  
{

protected:
	/** 
	 * Protected constructor to ensure only one instance of the class  
	 * to implement the Singleton pattern
	 */
	CAdoFiltr();
	
	/** 
	 * Protected destructor to insure only one instance of the class  
	 * to implement the Singleton pattern
	 */
	virtual ~CAdoFiltr();
	
	/** Pointer to the only instance of the class */
	static CAdoFiltr* s_pSelf;

	/** Handle on the library once it is open */
	HMODULE m_hLib;

	/** Saves the result of the loading of the dll*/
	HRESULT m_hrLoadErr;

	/** 
	 * Attempts to load ADOFILTR.DLL from the directory 
	 * CE Services / ActiveSync was installed into.
	 */
	HMODULE LoadAdoFiltrDll();

	/** 
	 * Calls the specified AdoFiltr function (either DESKTOPTODEVICE or DEVICETODESKTOP)
	 * to transfer tables between the desktop and the device.
	 */
	HRESULT CallAdoFiltrFunc(LPCSTR pszFuncName, LPCTSTR pszDesktopLocn,
						 LPCTSTR pszTableList, BOOL bSync, BOOL bOverwrite,
						 LPCTSTR pszDeviceLocn);

public:
	/** Method to obtain the unique instance of the class */
	static CAdoFiltr* getInstance();
	
	/**
	 * This function allows programmatic transfer of a desktop database file to a Windows
	 * CE based device
	 * @param pszDesktopLocn The file name and path of the Microsoft Access database 
	 * file (.mdb) file to be transferred, or the Data Source Name (DSN) if (ODBC) support is enabled. 
	 * @param pszTableList The list of tables and fields that is converted and copied to 
	 * the Windows CE-based device. It takes the following form: 
	 * [!]tablename[<period>fieldname]<period><period>[[!]tablename[<period>fieldname]<period><period>]
	 * A leading exclamation point (!) marks this table as read-only on the device.
	 * @param bSync Optional. TRUE enables ActiveSync. FALSE disables ActiveSync.
	 * @param bOverwrite Optional. TRUE, the default, overwrites tables with the same name 
	 * on the device. FALSE generates new table names. 
	 * @param pszDeviceLocn Optional. The database (.cdb) file to which tables are copied on 
	 * the device.
	 * @return HRESULT error code
	 * @note The information provided here was extracted from MSDN.
	 * See DESKTOPTODEVICE and ADOCE in MSDN for more information about parameters.
	 */
	HRESULT DesktopToDevice(LPCTSTR pszDesktopLocn,
						LPCTSTR pszTableList,
						BOOL bSync = FALSE,
						BOOL bOverwrite = TRUE,
						LPCTSTR pszDeviceLocn = NULL);

	/**
	 * This function allows programmatic transfer of a Windows CE based device database 
	 * file to a desktop computer
	 * @param pszDesktopLocn The file name and path of the .mdb file to contain the 
	 * converted tables or the DSN name, if ODBC support is enabled. 
	 * @param pszTableList The list of tables and fields that is converted and copied to 
	 * the Windows CE-based device. It takes the following form: 
	 * [!]tablename[<period>fieldname]<period><period>[[!]tablename[<period>fieldname]<period><period>]
	 * A leading exclamation point (!) marks this table as read-only on the device.
	 * @param bSync Optional. TRUE enables ActiveSync. FALSE disables ActiveSync.
	 * @param bOverwrite Optional. TRUE, the default, overwrites tables with the same name 
	 * on the device. FALSE generates new table names. 
	 * @param pszDeviceLocn Optional. The database (.cdb) file to which tables are copied on 
	 * the device.
	 * @return HRESULT error code
	 * @note The information provided here was extracted from MSDN.
	 * See DESKTOPTODEVICE and ADOCE in MSDN for more information about parameters.
	 */
	HRESULT DeviceToDesktop(LPCTSTR pszDesktopLocn,
						LPCTSTR pszTableList,
						BOOL bSync = FALSE,
						BOOL bOverwrite = TRUE,
						LPCTSTR pszDeviceLocn = NULL);


};

#endif // !defined(AFX_ADOFILTR1_H__D2BD37E3_B8F5_11D6_802A_0004762AD386__INCLUDED_)

⌨️ 快捷键说明

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