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

📄 utilities.h

📁 图像处理的压缩算法
💻 H
📖 第 1 页 / 共 3 页
字号:
	Returns:
		TRUE if successful, else FALSE
*/
BOOL SystemTimeToJulianDate(double *lpdDate, SYSTEMTIME *lpSysTime);

/**#
	get the string for given plot designation
	Example:
		void run_get_plot_designation_str()
		{
			char szTemp[50];
			if(get_plot_designation_str(COLDESIG_X, szTemp, 50))
			{
				out_str(szTemp);
			}	
		}
*/
BOOL get_plot_designation_str(int nPlotDesignation, LPSTR lpBuffer, int nBuffSize);

/**#
	convert Column(n).GetType() return values which are in the enum of OKDATAOBJ_DESIGNATION_Y
	return COLDESIG_Y enums
	Example:
		void run_cvt_col_type_to_designation()
		{
			int nRet = cvt_col_type_to_designation(OKDATAOBJ_DESIGNATION_Y);
			out_int("",nRet);
		}
*/
int cvt_col_type_to_designation(int nColType);

/**#
*/
//int		ConvertPlotIds(int nType, DWORD* pdwCntrl);
int		ConvertPlotIds(int nType, DWORD* pdwCntrl, DWORD *pdwLTPlotInfo = NULL);

/**#
*/
int cvt_x_from_step_to_str(double xFrom, double xStep, LPSTR lpBuffer, int nSize);


/**#
*/
int	WINAPI string_to_prefix_end_number(LPSTR lpszBuffer, LPCSTR lpcszString);

/**#
*/
int get_base_plot_type(int nPlotType);
/**#
	Compare the two given plot types and return 1 if they are compatible, returns 0 if not
*/
int compare_plot_types(int nPlotType1, int nPlotType2);

/** >File Management
		Add extension to file name if not present, or to get file extension string
	Parameters:
		lpszFilename = filename with or without path, typically from a buffer with MAXFULLPATH in size
		lpcszFileExt = file extension, without the dot.
		lpszExt2 = optional buffer, see Remark
	Remark:
		This function assumes that lpszFilename has extra space to append file extension
		if lpcszExt ==NULL, then return false if has extension and copied to into lpszExt2 if not NULL
		if lpcszExt !=NULL, then 
			if lpszExt2 == NULL, then replace/append ext regardless if existed or not, return FALSE if no change
			if lpszExt2 != NULL, then it is assumed to be 2nd ext, replace/append if not either, return FALSE if no change 
	Returns:
		It depends on the various combinations of the arguments, but in general TRUE indicates that extension is added or updated. FALSE indicate that there is no change to lpszFilename
	Example:
		void run_check_add_file_ext()
		{	
			char szTemp[20];
			char strFileName[100];
			string str = GetAppPath(1) + "origin.ini";
			lstrcat(strFileName, str);
			
			BOOL bRet = check_add_file_ext(strFileName,NULL,szTemp);
			out_str(szTemp);
		}
*/
BOOL check_add_file_ext(LPSTR lpszFilename, LPCSTR lpcszExt, LPSTR lpszExt2 = NULL);

/** >Font
		Get system fonts details
	Parameters:
		nType = OEM_FIXED_FONT, SYSTEM_FONT etc const, can also pass in GSFI_TYPE_DEFAULT, GSFI_TYPE_FIXED_WIDTH, GSFI_TYPE_SCALABLE for Origin fonts
		lpnFontSize = pointer to int to receive font size
		lpnCharSet = pointer to a byte to receive Character Set type
		lpszFontName = buffer to receive font face name
		nNameSize = size of lpszFontName
	Example:
		string get_system_font_name(int nType, int* lpnCharSet) // = ANSI_VAR_FONT, NULL);
		{
			int nFontSize;
			byte nCharSet = ANSI_CHARSET;
			
			string str;
			char	szTemp[LF_FACESIZE + 1];
			if(get_system_font_info(nType, &nFontSize, &nCharSet, szTemp, LF_FACESIZE))
				str = szTemp;
			if(lpnCharSet)
				*lpnCharSet = nCharSet;
			
			return str;
		}
*/
BOOL  get_system_font_info(int nType, int* lpnFontSize, byte* lpnCharSet, LPSTR lpszFontName, int nNameSize);

/** >Date Time
		Convert a text string that represents date/time into a Julian date value
	Parameters:
		lpcszDateStr = a date/time string
		lpcszFormatStr = pointer to a format picture string that is used to form the date string
	Returns:
		If successful then Julian date else NANUM
	Example:
		string strDate = "2003-03-21";
		string strFormt = "yyyy'-'MM'-'dd";
		double db;
		
		if(str_to_date_custom(strDate, strFormt,&db))
		{
			printf("You have entered %s\n", get_date_str(db));
		}
*/
BOOL str_to_date_custom(LPCSTR lpcszDateStr, LPCSTR lpcszFormatStr, double* pDate);

/** >Date Time
		Convert a Julian date value to a string formatted according to that represents date/time 
	Parameters:
		rDate = Julian date value
		lpcszFormatStr = pointer to a format picture string that is used to form the date string
		lpszDateStr = pointer to the target buffer
	Returns:
		If successful then TRUE else FALSE
	Example:
		string strDateIn = "2003-03-21";
		string strFormat = "yyyy'-'MM'-'dd";
		char szDateOut[MAXLINE];
		double db;
		
		if( str_to_date_custom(strDateIn, strFormat, &db) )
		{
			if( date_to_str_custom(db, strFormat, szDateOut) )
			{
				if( !strDateIn.CompareNoCase(szDateOut) )
					printf("success\n"); // date_to_str_custom gets what str_to_date_custom puts
				else
					printf("failure\n"); // date_to_str_custom did not get what str_to_date_custom put
			}
		}
*/
BOOL date_to_str_custom(double rDate, LPCSTR lpcszFormatStr, LPSTR lpszDateStr);

/** >Date Time
		Convert a time formated string to a Julian value
	Parameters:
		lpcszTime = string containing the time
		dwFlags = 
	Returns:
		A double containing a Julian date value
	Example:
		string strTime = "001:12:00:00.0"; // 1 day, 12 hrs, 0 mins, 0 secs
		double dTime;
		dTime = str_to_time(strTime);
		printf("%s = %f\n", strTime, dTime);
*/
double str_to_time(LPCTSTR lpcszTime, DWORD dwFlags=0);

#endif //#if  _OC_VER > 0x0703

#pragma dll(@OK)


/** >LabTalk Interface
		Evaluate an expression in LabTalk syntax.
	Parameters:
		lpcszLabTalkExpression = Pointer to a string containing the expression in LabTalk syntax.
		lpdbResult = Pointer to a double value to receive the results.
	Returns:
		TRUE if expression is valid, FALSE if expression leads to missing value
	Example:
		void	run_LT_evaluate()
		{
			double		vv;
			LT_get_var("@D",&vv); // get machine curremt date/time as Julian value	
			out_double("@D = ", vv);
			LT_evaluate("0^0",&vv); // evaluate expression using LabTalk interpreter
			out_double("0^0 = ", vv);
		}
*/
BOOL	LT_evaluate(LPCSTR lpcszLabTalkExpression, double * lpdbResult);

/** >LabTalk Interface
		Execute LabTalk script code.
	Parameters:
		lpcszLabTalkStr = Pointer to a string containing the LabTalk script code to execute.
		wCntrl = not used (must be 0)
	Return:
		TRUE if success, FALSE if LabTalk execution leads to error
	Example:
		void	run_LT_execute()
		{
			// Execute the LabTalk script which will bring up a message box and display
			// the value of the system string %Y:
			LT_execute("type -b %Y");
		}
*/
BOOL	LT_execute(LPCSTR lpcszLabTalkStr, int wCntrl = 0);

/** >LabTalk Interface
		You can use this command to get LabTalk variables, including system variables whose names begin with @
		This command is similar to LT_evaluate but you can tell if given name corresponds to a LabTalk variable
		even if its value is missing value, while LT_evaluate will not be able to differentiate. Also, using
		LT_evaluate to get value of a variable is slower. 
	Parameters:
		lpcszLabTalkVarName = LabTalk variable name, case insensitive
		lpdbResult = the double variable pointed to by lpdbResult recieves the LabTalk variable value
	Return:
		TRUE if lpcszLabTalkVarName is a LabTalk variable, and FALSE if it is not
	Example:
		void	run_LT_get_var()
		{
			double vv;
			LT_get_var("X2", &vv); // get the current X axis right limit (the variable "X2")
			out_double("vv = ", vv);
			LT_get_var("@D",&vv); // get machine curremt date/time as Julian value (the system variable @D)	
			out_double("vv = ", vv);
			if(LT_get_var("XYZ", &vv))	// try to get the value of the variable "XYZ"
				printf("in LabTalk, XYZ = %lf\n", vv);
			else
				out_str("XYZ is not a LabTalk variable");
		}
*/
BOOL	LT_get_var(LPCSTR lpcszLabTalkVarName, double * lpdbResult);  // Get LabTalk variable value

/** >LabTalk Interface
		It sets the value of a LabTalk variable
	Parameters:
		lpcszLabTalkVarName = LabTalk variable name, case insensitive
		dbValue = the new value
	Return:
		TRUE if OK, and FALSE if it fails.
	Example:
		void	run_LT_set_var()
		{
			double vv;
			if(LT_get_var("X", &vv))
			{
				vv += 10;
				// Set the new value:
				if(LT_set_var("X", vv))
					out_str("set X in LabTalk succeeded");
				else
					out_str("set X in LabTalk failed");
				
				LT_get_var("X", &vv);
				out_double("new value is ", vv);
			}
		}
*/
BOOL	LT_set_var(LPCSTR lpcszLabTalkVarName, double dbValue);	// Set LabTalk variable value

/** >LabTalk Interface
		lstrcpyn is used inside Origin to copy LabTalk string into the buffer supplied, so that if the buffer
		is too small, the result string will have one less character than specified to leave room for the
		terminating character.
	Parameters:
		lpcszLabTalkString = LabTalk global string, or any other LabTalk string expression
		pBuffer = character buffer to receive the string
		nBufferSize = size of the buffer including the terminating zero
	Return:
		Return TRUE if success, return FALSE if string variable is not correctly specified or string is 
		too long.
	Example:
		void	run_LT_get_str()
		{
			char	szBuffer[200];
			// Get the value of the string variable %Y (it usually contains the
			// Origin's client path)
			LT_get_str("%Y", szBuffer, 200);
			out_str(szBuffer);
		}
*/
BOOL	LT_get_str(LPCSTR lpcszLabTalkString, char* pBuffer, int nBufferSize); // Get LabTalk string


/** >LabTalk Interface
		Sets the value of a LabTalk global string variable or a LabTalk object string property.
	Parameters:
		lpcszVar = Origin string variables, %A through %Z, as well as LabTalk Object string properties
		lpcszContent = string content to be copied to Origin string variable, can be NULL to empty a string
	Return:
		Return TRUE if success, return FALSE if string variable is not correctly specified or string is 
		too long.
	Example:
		void	run_LT_set_str()
		{
			char	szBuffer[200];
			// Get the value of the string variable %L
			LT_get_str("%L", szBuffer, 200);
			
			// Display the value:
			out_str(szBuffer);
			
			// Now set it to a new value:
			LT_set_str("%L", "New string value!");
			// Get the value of the string variable %L
			LT_get_str("%L", szBuffer, 200);
			
			// Display the value:
			out_str(szBuffer);
		}
*/
BOOL	LT_set_str(LPCSTR lpcszVar, LPCSTR lpcszContent); // Set LabTalk string	variable



// these are defined in oc_tyeps.h
//#define AIC_LISTCTRL_SETNUMCOLS		1
//#define AIC_LISTCTRL_SETCELL			2
//#define AIC_LISTCTRL_DELROW			3
//#define AIC_LISTCTRL_ADDROW			4
// when uMsg = AIC_LISTCTRL_SET_GET_COL_TYPE, the function will set or get the types of the column;
// lp1 should be the column number, lp2 should be the type one want to set, lp3 = 0 means to get, else
// lp3 = 1 means to set; 
//the types are as following:
// NUMERIC           0
// TEXT              1
// TIME              2
// DATE              3
// MONTH             4
// DAY_OF_WEEK       5
// TEXT_NUMERIC  	 6

/**#
*/
int AscImpListCtrlMsg(LPCSTR lpcstrName, UINT uMsg, UINT lP1 = 0, UINT lP2 = 0, UINT lP3 = 0);

/**#
*/
int AscImpListCtrlInsRow(LPCSTR lpcstrName, StringArray *psa, int iRow=-1, BOOL bAddCol=TRUE);

//------ CPY 9/24/02 v7.0404 QA70-2658 ASCII_IMPORT_FROM_OC
// requires Origin 7 SR3 or later
/**	>Import Export
	Scan and analyse the given file to gather information for ascii import into worksheets.
	This function will look read the file to look for consistent structure by trying different
	separators that will yield the largest number of columns.
	Example:
		ASCIMP	ascimp;
		string strFile = GetOpenBox("*.dat");
		if(AscImpReadFileStruct(strFile,&ascimp)==0)
		{
			out_int("# of header lines= ", ascimp.iHeaderLines);
			out_int("# of columns = ", ascimp.iNumcolumns);
		}
		
	Parameters:
		lpcszFilename = a full path ASCII file name
		pASCIMPstruct = pointer to an ASCIMP struct that is not initialized on input but will be set when function returns
		dwCntrl = additional flags to control the reading, only AIRF_USE_ASCIMP is defined for now.
				dwCntrl = 0 for pASCIMPstruct to be used only as output, if AIRF_USE_ASCIMP, then it will be used as starting point for further scanning
	Return:
		 Returns 0 if no error, otherwise an error code is returned
	SeeAlso:
		Worksheet::ImportASCII
	
*/
int AscImpReadFileStruct(LPCSTR lpcszFilename, ASCIMP* pASCIMPstruct, DWORD dwCntrl=0);

// OLE Automation Object and COM support is only available only for OriginPro versions, or with a special COM enabled license.

#ifdef	ORIGIN_COM_SUPPORT
/** >COM
		Create an automation (COM) object.
	Remarks:
		This function is available only for OriginPro versions, or with a special COM enabled license
	Example:
		void	run_CreateObject()
		{
			Object	obj;
			// Create an MS Word application object:
			obj = CreateObject("Word.Application");
			// Make the application visible
			obj.Visible = true;
		}
	Parameters:
		lpcszObjectName=Name of the object to be created
	Return:
		 Returns a reference to the created object.

*/
Object	CreateObject(LPCSTR lpcszObjectName); // Create an automation (COM) object.

/** >COM
		It sets up an event handler for an automation object.
	Remarks:
		This function is available only for OriginPro versions, or with a special COM enabled license
	Parameters:
		pObj = pointer to an existing COM object reference  which must have been initialized.
		lpcszEventName = event name (it can retrieved from the object library for the given object)
		pOCFunc = pointer to a Function object which has been intialized with an existing Origin C function.
	Returns:
		0 if the event handler was set up successfully, 2 if an events COM interface cannot be retrieved from
		the object, 3 if the event name was wrong, 
	Example:
		Object	obj;	// this is the object which will fire an event
		// This is the event handler which catches the event. The prototype must agree
		// with the event's declaration, which can be found out by inspecting
		// the object library for each particular object.
		void	MyEventHandler()
		{
			printf("Event hanled\r\n");
		}
		void	run_SetEventHandlerForObject()
		{
			// Declare a function object (the function MyEventHandler must have been defined before)
			Function		fnEventHandler(MyEventHandler);
			
			Object obj = CreateObject("SomeObject.SomeObject");
			
			int		iRet;
			// This sets up the event handler. It tells the object obj: Call the function
			// MyEventHandler when event "SomeEvent" happens.
			iRet = SetEventHandlerForObject(&obj, "SomeEvent", &fnEventHandler);
			if (0 == iRet)
				out_str("Eevent handler set up successfully.");
		}

*/
int		SetEventHandlerForObject(Object *pObj, LPCSTR lpcszEventName, Function *pOCFunc);
#endif //#ifdef	ORIGIN_COM_SUPPORT

/** >User Interface Controls
		Opens a simple input box for entering a string.
	Parameters:
		lpcszMsg = Pointer to a string containing a message used to prompt the user.
		dwOption = not used (must be 0)
	Returns:
		the string which has been input
	Example:
		void	run_InputBox()
		{
			string		strInput = InputBox("Please enter your name");
			
			printf("You entered: %s\n", strInput);
			
		}

⌨️ 快捷键说明

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