Thaicomponent Logo
 
Your Absolute Solution
 Home
 Components
 Download
 Contact us & ตัวแทนจำหน่าย
Components
 -  Win32Api
 -  Java Api Class
  Thai   |    Eng   
 
 
     
                      การนำ Components ไปทดสอบเพื่อใช้งานกับ Web Application เช่น VbScript กับโปรแกรมภาษา Asp อาจเกิดปัญหา Process ค้าง เพราะ Components ทุกตัวจะ Alert Message Box ขึ้นมา ดังนั้นจึงควรนำ Components ไปทดสอบกับ Visual Basic เพียงอย่างเดียวก็พอแล้ว หากทำงานได้จริงในส่วนของ VbScript ก็ไม่มีปัญหาเช่นเดียวกัน
                    การนำ Api ไปใช้งานจะยกตัวอย่างการใช้งานใน Visual Basic 6.0 เท่านั้น ส่วนจะนำไปใช้งานกับโปรแกรมภาษาอื่น ๆ เช่น Visual Foxpro, Delphi หรือ .Net คุณสามารถเข้าไปอ่านข้อกำหนดการเรียกใช้งาน Api ตามแต่ละโปรแกรมภาษานั้นๆ
 
     
 
 Name  Encryption/Decryption
 Description  library สำหรับเข้าและถอดรหัส รับ/ส่ง Parameter ระหว่าง URL ต่าง Web Application หรือ Web Application เดียวกัน
 Type  Ms Com
 System Requirement  Windows 98/NT/ME/XP/2000/2003
 Price  
 
 
 
ทดลองใช้งานได้ที่นี่
 
 
 
การใช้งาน
- Copy ไฟล์ libmcrypt.dll, mcryptjv.dll, mcryptobj.dll ไปไว้ยัง Windows System32 แล้วทำการ Register เฉพาะไฟล์ mcryptobj.dll สำหรับใช้งาน Asp
Run Asp :
http://localhost/encrypt.asp

- Set CLASSPATH สำหรับใช้งานกับ Java หรือ Jsp เช่น C:\mcryptjv.jar
Run Java:
c:>\javac test.java
c:>\java test
 
Algorithm (Parameter)
          blowfish, des, tripledes, gost, cast-128, xtea, rc2, saferplus, loki97, serpent, rijndael-128, rijndael-192, rijndael-256
Example
Asp
<%
Set obj=Server.CreateObject("mcryptobj.CMcrypt")
obj.algorithm ("blowfish")
en = obj.encrypt("a", "1")
de = obj.decrypt(en, "1")
Response.Write("Encryption: <b>"& en &"</b><br>" )
Response.Write("Decryption: "& de &"<br>" )
Set obj=Nothing
%>

Output:
UEF4t9IEEnElQ8u7gB/ZK0eZVdf/r1JoJ9eraiLSwmqn6yNhaiSqbi9axW7eJZuNNm3hDOQcuxF3 kBB9xJ5hrgg=
 
Java/Jsp
import com.thaicomponent.*;
public class test
{
          public static void main(String[] args)
          {
                    CMcrypt m_CMcrypt =new CMcrypt();
                    m_CMcrypt.algorithm("blowfish");
                    //String en = m_CMcrypt.encrypt("a", "1");
                    String en="UEF4t9IEEnElQ8u7gB/ZK0eZVdf/r1JoJ9eraiLSwmqn6yNhaiSqbi9axW7eJZuNNm3hDOQcuxF3 kBB9xJ5hrgg=";
                    String de = m_CMcrypt.decrypt(en, "1");
                    System.out.println(en+"\t"+de);
          }
}
 
 
 
 
 
     
 
 Name  libkeySerial
 Description  library gen key ด้วย harddisk serial number.
 Type  Ms Com
 System Requirement  Windows 98/NT/ME/XP/2000/2003
 Price  200.00฿
 
 
Visual Basic
Dim m_Key As New CKeySerial
Debug.Print m_Key.get_Serial
Set m_Key = Nothing

Visual Basic .Net
Imports libkeySerial
Dim m_Key As New CKeySerial
Console.WriteLine(m_Key.get_Serial)

Visual C#
using libkeySerial;
CKeySerial m_Key= new CKeySerial();
Console.Write(m_Key.get_Serial);		  
		                      
 
 
 
 
 Name  libSmtp
 Description  library สำหรับการส่ง Mail และ File Attachment
 Type  Ms Com
 System Requirement  Windows 98/NT/ME/XP/2000/2003
 Price  350.00฿
 
 
VbScript
set Obj= server.CreateObject("libSmtp.CSmtp")
'//implementation code here
set Obj =nothing
		  
Visual Basic
Dim m_CSmtp As New CSmtp
m_CSmtp.set_MailServer ("smtp.hotmail.com")
m_CSmtp.set_Port (25)
m_CSmtp.set_From ("support@thaicomponent.com")
m_CSmtp.set_To ("jarun@hotmail.com")
m_CSmtp.set_Subject ("Test Api")
m_CSmtp.set_FileAttachment ("c:\a.txt")
m_CSmtp.set_FileAttachment ("c:\b.txt")
m_CSmtp.set_FileAttachment ("c:\c.txt")
m_CSmtp.set_Body ("Ok!")
If m_CSmtp.Send = 1 Then
   Debug.Print "send successed!"
Else
    Debug.Print "send failed!"
End If
m_CSmtp.Close
Set m_CSmtp = Nothing
                              
 
 
 
                      สำหรับ libMySQLi ตัวนี้ได้ออกแบบมาในส่วนที่เราต้องเรียกใช้งานบ่อยๆ เช่น insert, update, delete และ select ซึ่งช่วยลดการเขียน Code และให้ง่ายในการเข้าไปใช้งาน MySQL อีกทั้งยังไม่ต้องติดตั้ง MySQL ODBC ที่เครื่อง Client อีกด้วย ซึ่งเราอาศัยเพียง library libmySQL เท่านั้น ก็สามารถทำงานได้แล้ว หากต้องการใช้งานให้ Advanced มากกว่านี้คงต้องหา Component ตัวอื่นมาใช้งาน  
 
 Name  libMySQLi
 Description  library สำหรับเข้าไปใช้งาน MySQL โดยไม่ต้องอาศัยตัว MySQL ODBC
 Type  Ms Com
 System Requirement  Windows 98/NT/ME/XP/2000/2003, MySQL 4.0
 Price  350.00฿
 
 
VbScript
set Obj= server.CreateObject("libMySQLi.CMySQLi")
'//implementation code here
set Obj =nothing

Visual Basic
Dim m_CMySQLi As New CMySQLi
m_CMySQLi.set_Hostname ("127.0.0.1")
m_CMySQLi.set_User ("root")
m_CMySQLi.set_Password ("")
m_CMySQLi.set_Database ("db")

'//connect database
If m_CMySQLi.Open = 0 Then Exit Sub
Debug.Print "connect successed!"

'//set sql command and execute
m_CMySQLi.set_SQLCommand ("insert into tbl_user values('jarun','xxx')")
If m_CMySQLi.Execute = 0 Then m_CMySQLi.Close: Exit Sub
Debug.Print "execute successed!"

'//set sql command and query
m_CMySQLi.set_SQLCommand ("select * from tbl_user")
If m_CMySQLi.Query = 0 Then m_CMySQLi.Close: Exit Sub
Debug.Print "query successed!"

'//display result data
Dim i As Integer
For i = 0 To m_CMySQLi.get_RecordCount - 1
    Debug.Print m_CMySQLi.get_Items(i, 0) + "," + m_CMySQLi.get_Items(i, 1)
Next

'//close database
m_CMySQLi.Close
Set m_CMySQLi = Nothing	
 
 
 
 
 Name  libFtp
 Description  library สำหรับการ Upload และ Download file ด้วย Ftp
 Type  Ms Com
 System Requirement  Windows 98/NT/ME/XP/2000/2003
 Price  350.00฿
 
 
VbScript
set Obj= server.CreateObject("libFtp.CFtp")
'//implementation code here
set Obj =nothing

Visual Basic
Dim m_CFtp As New CFtp
m_CFtp.set_FtpServer ("localhost")
m_CFtp.set_Port (21)
m_CFtp.set_User ("administrator")
m_CFtp.set_Password ("admin")
m_CFtp.set_FtpDirectory ("ftproot")
m_CFtp.set_LocalDirectory ("d:\")
m_CFtp.set_FileType (1) '//1=BINARY,0=ASCII

'//open connection
If m_CFtp.Open = 0 Then Exit Sub
Debug.Print "connect successed"

'//putfile
m_CFtp.set_PutFiles ("c:\a.txt")
m_CFtp.set_PutFiles ("c:\b.txt")
m_CFtp.set_PutFiles ("c:\c.txt")
If m_CFtp.PutFiles = 0 Then m_CFtp.Close: Exit Sub
Debug.Print "upload file successed"

'//findfile
If m_CFtp.FindFiles("*.*") = 0 Then m_CFtp.Close: Exit Sub
Debug.Print "file found"

'//result and download file
Dim i As Integer
For i = 0 To m_CFtp.get_FileCount - 1
    If m_CFtp.GetFiles(m_CFtp.get_Items(i)) = 0 Then m_CFtp.Close: Exit Sub
    Debug.Print m_CFtp.get_Items(i) + " download successed"
Next

'//close
m_CFtp.Close
Set m_CFtp = Nothing
                              
 
 
 
 
 Name  libMsAccessmsado15
 Description  library สำหรับใช้งาน Ms Access Database
 Type  Ms Com
 System Requirement  Windows 98/NT/ME/XP/2000/2003
 Price  350.00฿
 
 
VbScript
set Obj= server.CreateObject("libMsAccess.CMsAccess")
'//implementation code here
set Obj =nothing

Visual Basic
Dim m_CMsAccess As New CMsAccess
m_CMsAccess.set_Database ("c:\dbs.mdb")
m_CMsAccess.set_User ("Admin")
m_CMsAccess.set_Password ("")

'//connect database
If m_CMsAccess.Open = 0 Then Exit Sub
Debug.Print "connect successed!"

'//set sql command and execute
m_CMsAccess.ClearSQLCommand
m_CMsAccess.set_SQLCommand ("delete from tbl_user")
m_CMsAccess.set_SQLCommand ("insert into tbl_user values('01','a')")
m_CMsAccess.set_SQLCommand ("insert into tbl_user values('02','b')")
If m_CMsAccess.Execute = 0 Then m_CMsAccess.Close: Exit Sub
Debug.Print "execute successed!"

'//set sql command and query
m_CMsAccess.ClearSQLCommand
m_CMsAccess.set_SQLCommand ("select * from tbl_user")
If m_CMsAccess.Query = 0 Then m_CMsAccess.Close: Exit Sub
Debug.Print "query successed!"

'//display result data
Dim i As Integer
For i = 0 To m_CMsAccess.get_RecordCount - 1
    Debug.Print m_CMsAccess.get_Items(i, 0) + "," + m_CMsAccess.get_Items(i, 1)
Next

'//close
m_CMsAccess.Close
Set m_CMsAccess = Nothing
	
                              
 
 
 
 
 Name  libMsSQLServermsado15
 Description  library สำหรับใช้งาน Ms SQL Server Database
 Type  Ms Com
 System Requirement  Windows 98/NT/ME/XP/2000/2003
 Price  350.00฿
 
 
VbScript
set Obj= server.CreateObject("libMsSQLServer.CMsSQLServer")
'//implementation code here
set Obj =nothing

Visual Basic
Dim m_CMsSQLServer As New CMsSQLServer
m_CMsSQLServer.set_Hostname ("127.0.0.1")
m_CMsSQLServer.set_User ("sa")
m_CMsSQLServer.set_Password ("")
m_CMsSQLServer.set_Database ("dbs")

'//connect database
If m_CMsSQLServer.Open = 0 Then Exit Sub
Debug.Print "connect successed!"

'//set sql command and execute
m_CMsSQLServer.ClearSQLCommand
m_CMsSQLServer.set_SQLCommand ("delete from tbl_user")
m_CMsSQLServer.set_SQLCommand ("insert into tbl_user values('01','a')")
m_CMsSQLServer.set_SQLCommand ("insert into tbl_user values('02','b')")
If m_CMsSQLServer.Execute = 0 Then m_CMsSQLServer.Close: Exit Sub
Debug.Print "execute successed!"

'//set sql command and query
m_CMsSQLServer.ClearSQLCommand
m_CMsSQLServer.set_SQLCommand ("select * from tbl_user")
If m_CMsSQLServer.Query = 0 Then m_CMsSQLServer.Close: Exit Sub
Debug.Print "query successed!"

'//display result data
Dim i As Integer
For i = 0 To m_CMsSQLServer.get_RecordCount - 1
    Debug.Print m_CMsSQLServer.get_Items(i, 0) + "," + m_CMsSQLServer.get_Items(i, 1)
Next

'//close
m_CMsSQLServer.Close
Set m_CMsSQLServer = Nothing
 
 
 
 
 Name  libOraclemsado15
 Description  library สำหรับใช้งาน Oracle Database
 Type  Ms Com
 System Requirement  Windows 98/NT/ME/XP/2000/2003
 Price  350.00฿
 
 
VbScript
set Obj= server.CreateObject("libOracle.COracle")
'//implementation code here
set Obj =nothing

Visual Basic
Dim m_COracle As New COracle
m_COracle.set_DataSource ("dbs")
m_COracle.set_User ("admin")
m_COracle.set_Password ("")

'//connect database
If m_COracle.Open = 0 Then Exit Sub
Debug.Print "connect successed!"

'//set sql command and execute
m_COracle.ClearSQLCommand
m_COracle.set_SQLCommand ("delete from tbl_user")
m_COracle.set_SQLCommand ("insert into tbl_user values('01','a')")
m_COracle.set_SQLCommand ("insert into tbl_user values('02','b')")
If m_COracle.Execute = 0 Then m_COracle.Close: Exit Sub
Debug.Print "execute successed!"

'//set sql command and query
m_COracle.ClearSQLCommand
m_COracle.set_SQLCommand ("select * from tbl_user")
If m_COracle.Query = 0 Then m_COracle.Close: Exit Sub
Debug.Print "query successed!"

'//display result data
Dim i As Integer
For i = 0 To m_COracle.get_RecordCount - 1
    Debug.Print m_COracle.get_Items(i, 0) + "," + m_COracle.get_Items(i, 1)
Next

'//close
m_COracle.Close
Set m_COracle = Nothing
 
 
 
 
 Name  libTcpIp
 Description  library สำหรับค้นหา Ip, Host name, Ping คอมพิวเตอร์ด้วย Ip, Host name
 Type  Ms Com
 System Requirement  Windows 98/NT/ME/XP/2000/2003
 Price  200.00฿
 
 
VbScript
set Obj= server.CreateObject("libTcpIp.CTcpIp")
'//implementation code here
set Obj =nothing

Visual Basic
Dim m_CTcpIp As New CTcpIp
Debug.Print m_CTcpIp.IpPing("127.0.0.1") '//ping computer with ip address
Debug.Print m_CTcpIp.HostPing("osthaicomp") '//ping computer with host name
Debug.Print m_CTcpIp.get_DomainName '//get domain name
Debug.Print m_CTcpIp.get_IpAddress '//get ip address
Debug.Print m_CTcpIp.get_HostName '//get host name
 
 
 
 
 Name  libMouse
 Description   library สำหรับ Disable Mouse
 Type  Ms Com
 System Requirement  Windows 98/NT/ME/XP/2000/2003
 Price  200.00฿
 
 
Visual Basic
Dim m_CMouse As New CMouse
'//disable
m_CMouse.Lock
'//enable
m_CMouse.UnLock
 
 
 
 
 Name  jvCWinDir
 Description  Java Api สำหรับทำงานกับ Directory ของ Windows
 Type  Java Api
 System Requirement  Windows 98/NT/ME/XP/2000/2003
 Price  200.00฿
 
 
import com.thaicomponent.*;
public class test 
{
	public static void main(String[] args) 
	{
		jvCWinDir m_jvCWinDir=new jvCWinDir();
		System.out.println(m_jvCWinDir.get_SystemDirectory());
		System.out.println(m_jvCWinDir.get_WindowsDirectory());
		System.out.println(m_jvCWinDir.get_CurrentDirectory());
		System.out.println(m_jvCWinDir.get_GetTempPath());
	}
}
 
 
 
 
 Name  jvCTcpIp
 Description  Java Api สำหรับค้นหา Ip, Host name, Ping คอมพิวเตอร์ด้วย Ip, Host name
 Type  Java Api
 System Requirement  Windows 98/NT/ME/XP/2000/2003
 Price  200.00฿
 
 
import com.thaicomponent.*;
public class test 
{
	public static void main(String[] args) 
	{
		jvCTcpIp m_jvCTcpIp=new jvCTcpIp();
		System.out.println(m_jvCTcpIp.get_DomainName());
		System.out.println(m_jvCTcpIp.get_HostName());
		System.out.println(m_jvCTcpIp.get_IpAddress());
		System.out.println(m_jvCTcpIp.HostPing("osthaicomp"));
		System.out.println(m_jvCTcpIp.IpPing("127.0.0.1"));
		System.out.println(m_jvCTcpIp.SetVirtualIp("192.168.1.1","255.255.255.0"));

	}
}
 
 
 
 
 Name  jvCIni
 Description  Java Api สำหรับอ่าน, เขียน ini files
 Type  Java Api
 System Requirement  Windows 98/NT/ME/XP/2000/2003
 Price  200.00฿
 
 
import com.thaicomponent.*;
public class test 
{
	public static void main(String[] args) 
	{
		jvCIni m_jvCIni=new jvCIni();
		System.out.println(m_jvCIni.get_Ini("System","name","c:\\conf.ini"));
		System.out.println(m_jvCIni.set_Ini("System","name","sys1","c:\\conf.ini"));
	}
}
 
 
 
 
 Name  jvCReg
 Description  Java Api สำหรับอ่าน, เขียน Windows Registry
 Type  Java Api
 System Requirement  Windows 98/NT/ME/XP/2000/2003
 Price  350.00฿
 
 
import com.thaicomponent.*;
public class test 
{
	public static void main(String[] args) 
	{
		jvCReg m_jvCReg = new jvCReg();
		System.out.println(m_jvCReg.HKEY_CURRENT_USER_CreateKey("SOFTWARE\\Mykey\\subkey"));
		System.out.println(m_jvCReg.HKEY_CURRENT_USER_DeleteSubKey("SOFTWARE\\Mykey","subkey"));
		System.out.println(m_jvCReg.HKEY_CURRENT_USER_SetValueData("SOFTWARE\\Mykey\\subkey","Hello","name"));
		System.out.println(m_jvCReg.HKEY_CURRENT_USER_GetValueData("SOFTWARE\\Mykey\\subkey","name"));
		System.out.println(m_jvCReg.HKEY_CURRENT_USER_DeleteValueName("SOFTWARE\\Mykey\\subkey","name"));
		System.out.println(m_jvCReg.HKEY_LOCAL_MACHINE_CreateKey("SOFTWARE\\Mykey\\subkey"));
		System.out.println(m_jvCReg.HKEY_LOCAL_MACHINE_DeleteSubKey("SOFTWARE\\Mykey","subkey"));
		System.out.println(m_jvCReg.HKEY_LOCAL_MACHINE_SetValueData("SOFTWARE\\Mykey\\subkey","Hello","name"));
		System.out.println(m_jvCReg.HKEY_LOCAL_MACHINE_GetValueData("SOFTWARE\\Mykey\\subkey","name"));
		System.out.println(m_jvCReg.HKEY_LOCAL_MACHINE_DeleteValueName("SOFTWARE\\Mykey\\subkey","name"));
	}
}
 
 
 
 
 Name  jvCDts
 Description  Java Api สำหรับ Created, Execute Microsoft SQL Server DTS Packages
 Type  Java Api
 System Requirement  Windows 98/NT/ME/XP/2000/2003, Microsoft SQL Server 2000
 Price  350.00฿
 
 
import com.thaicomponent.*;
public class test 
{
	public static void main(String[] args) 
	{
		jvCDts m_jvCDts=new jvCDts();
		//database
		m_jvCDts.set_Server("(local)");
		m_jvCDts.set_DataBase("mydts");
		m_jvCDts.set_TableName("[mydts].[dbo].[tbl_csv]");
		m_jvCDts.set_User("sa");
		m_jvCDts.set_Password("");
		m_jvCDts.set_PkgsName("MyPkgs");
		
		//source file
		m_jvCDts.set_CsvFile("c:\\temp\\mycsv.csv");
		m_jvCDts.set_FileColumnDelimiter(",");

		//map fields 
		m_jvCDts.Clear();
		m_jvCDts.set_FilesColumn("Col001");
		m_jvCDts.set_FilesColumn("Col002");
		//if you don't known any filed in table, Please click jvCFields
		m_jvCDts.set_FieldsColumn("id");
		m_jvCDts.set_FieldsColumn("name");

		//execute package
		if(m_jvCDts.ExecutePkgs())
			System.out.println("Execute successed!");
		else{
			//create and execute packages that completed!
			m_jvCDts.CreatePkgs();
			if(m_jvCDts.ExecutePkgs())
				System.out.println("Create successed!");
			else{
				System.out.println("Create failed!");
			}

		}

	}
}
 
 
 
 
 Name  jvCFields
 Description  Java Api สำหรับ list fields name ของ table ในฐานข้อมูล Microsoft SQL Server 2000
 Type  Java Api
 System Requirement  Windows 98/NT/ME/XP/2000/2003, Microsoft SQL Server 2000
 Price  350.00฿
 
 
import com.thaicomponent.*;
public class test 
{
	public static void main(String[] args) 
	{
		jvCFields m_jvCFields =new jvCFields();
		//database
		m_jvCFields.set_Server("(local)");
		m_jvCFields.set_User("sa");
		m_jvCFields.set_Password("");
		m_jvCFields.set_DataBase("mydts");
		m_jvCFields.set_TableName("tbl_csv");
		
		//connect database
		if(m_jvCFields.Open())
		{
			for(int i=0; i < m_jvCFields.get_FieldsCount();i++)
				//display fields name
				System.out.println(m_jvCFields.get_Fields(i));
		}
		m_jvCFields.Close();

	}
}
 
 
 
 
 Name  jvCSetTime
 Description  Java Api สำหรับ set วันเวลาให้กับเครื่องคอมพิวเตอร์
 Type  Java Api
 System Requirement  Windows 98/NT/ME/XP/2000/2003
 Price  200.00฿
 
 
import com.thaicomponent.*;
public class test 
{
	public static void main(String[] args) 
	{
		jvCSetTime m_jvCSetTime=new jvCSetTime();
		m_jvCSetTime.set_Year(2006);
		m_jvCSetTime.set_Month(6); //January = 1, February = 2, ...
		m_jvCSetTime.set_DayOfWeek(0);//Sunday = 0, Monday = 1, ...
		m_jvCSetTime.set_Day(18);
		m_jvCSetTime.set_Hour(15);//0-23
		m_jvCSetTime.set_Minute(49);//0-59
		m_jvCSetTime.set_Second(00);//0-59
		m_jvCSetTime.set_Milliseconds(00);//0-59

		//set date time to local machine
		if(m_jvCSetTime.SetTime())
			System.out.println("Ok");
	}
}
 
 
 
 
 Name  jvCDateTimeProtocol
 Description  Java Api สำหรับ get date time จากเครื่อง Server
 Type  Java Api
 System Requirement  Windows 98/NT/ME/XP/2000/2003
 Price  350.00฿
 
 
import com.thaicomponent.*;
public class test 
{
	public static void main(String[] args) 
	{
		jvCDateTimeProtocol m_jvCDateTimeProtocol=new jvCDateTimeProtocol();
		//get date time from server
		System.out.println(m_jvCDateTimeProtocol.get_DateTime("127.0.0.1"));

	}
}
 
     
     

Copyright © 2003-2007 Thaicomponent Software. All right reserved.