javaµ÷ÓÃwindows API
ʹÓÃjinvokeµ÷ÓÃwindowsAPI¡£jnaʹÓñȽÏÂé·³£¬ÐèҪдc´úÂëºÍ²ÎÊýת»»£¬jinvokeµÄʹÓþÍÏñjdkÖеİüÒ»Ñù¡£
¹ÙÍøʹÓòο¼£ºhttp://www.jinvoke.com/calling-the-win32-api-from-java
Ò»¸öµ¯³ö¿òµÄÀý×Ó£¨ÕâÖÖ´úÂëÓÃÓÚµ÷ÓÃÈκÎdll£¬²»Ö»ÊÇwindowsµÄ£¬Ò²¿ÉÒÔÊÇ×Ô¼ºÐ´µÄdll£©
import com.jinvoke.JInvoke;
import com.jinvoke.NativeImport;
public class HelloWindows
{
@NativeImport(library="User32")
public static native int MessageBox(int hwnd,
String text,
String caption,
int type); //windows Api MessageBoxº¯ÊýÔÐÍ
public static void main(String[]argc)
{
JInvoke.initialize();
MessageBox(0,"Thisi MessageBox is a native Win32 MessageBox",
"Hellow World",0);
}
}
ÔËÐÐЧ¹û£º
*
ʹÓÃÒÔÉÏ´úÂ뷽ʽ¿ÉÒÔÈÎÒâµ÷Óñ¾µØµÄDLLÎļþ¡£
×¢Ò⣺1.import com.jinvoke.JInvoke;import com.jinvoke.NativeImport;//ÒýÓðü
2.@NativeImport(library="User32")//Ö¸¶¨±¾µØµÄDLLÎļþ
3.public static native int MessageBox(int hwnd,String text,String caption,int type); //windows Api MessageBoxº¯ÊýÔÐÍ ÉùÃ÷Ò»¸ö¿ÉÒÔÔÚjavaµ±Ç°ÀàÖÐʹÓõķ½·¨
4.JInvoke.initialize();//ʵÀý»¯JInvoke
5.MessageBox(0,"Thisi MessageBox is a native Win32 MessageBox","Hellow World",0);//È»ºó¾Í¿ÉÒÔ¿ªÊ¼µ÷ÓÃDLLÖеĺ¯ÊýÁË
*
Èç¹ûÖ»ÊÇΪÁËʹÓÃUser32.dllÖеĺ¯Êý¿ÉÒÔÖ±½ÓʹÓÃjinvoke.jarÖÐÌṩµÄUser32À࣬¶ø²»±ØʹÓÃ@NativeImport(library="User32")È¥°üº¬Ò»¸öDLL£¬ÔÙÈ¥ÉùÃ÷Ò»¸ö×öº¯ÊýµÄÀàÐÍת»»µÄ·½·¨¡£
*
±àÒëÊÇÐèÒª´øÉÏjinvoke.jar¼´£ºjava -classpath .;jinvoke.jar HelloWindows
Ïà¹ØÎĵµ£º
Javaѧϰ´ÓÈëÃŵ½¾«Í¨
Ò»¡¢ JDK (Java Development Kit)
JDKÊÇÕû¸öJavaµÄºËÐÄ£¬°üÀ¨ÁËJavaÔËÐл·¾³£¨Java Runtime Envirnment£©£¬Ò»¶ÑJava¹¤¾ßºÍJava»ù´¡µÄÀà¿â(rt.jar)¡£²»ÂÛʲôJavaÓ¦Ó÷þÎñÆ÷ʵÖʶ¼ÊÇÄÚÖÃÁËij¸ö°æ±¾µÄJDK¡£Òò´ËÕÆÎÕJDKÊÇѧºÃJavaµÄµÚÒ»²½¡£×îÖ÷Á÷µÄJ ......
ÉîÒ¹ÏÐÁÄJavaÓëPHP ÒÔ¼°¼Ü¹¹Éè¼Æ˼ÏëÓë×î¼Ñʵ¼ù
·¢ÐÅÈË: wesley (ÐÄÖеÄÉÁÖ), ÐÅÇø: Java
±ê Ìâ: ÉîÒ¹ÏÐÁÄJavaÓëPHP ÒÔ¼°¼Ü¹¹Éè¼Æ˼ÏëÓë×î¼Ñʵ¼ù
·¢ÐÅÕ¾: ˮľÉçÇø (Thu Dec 24 01:55:04 2009), Õ¾ÄÚ
תÔØ×Ô±¾ÈËÐÂÀ˲©¿Í
http://blog.sina.com.cn/s/blog_53923f940100g7xx.html
£¨ÀÏÎâ×ÔÑÔ×ÔÓ
×î½üƵ·±ÌýË ......
ÏÂÊöÊ®Ëĸö¼¼ÇÉ£¬ÊÇÐí¶àÈËÔÚ´óÁ¿µÄÊý¾Ý¿â·ÖÎöÓëÉè¼Æʵ¼ùÖУ¬Öð²½×ܽá³öÀ´µÄ¡£¶ÔÓÚÕâЩ¾ÑéµÄÔËÓ㬶ÁÕß²»ÄÜÉú°ïÓ²Ì×£¬ËÀ¼ÇÓ²±³£¬¶øÒªÏû»¯Àí½â£¬ÊµÊÂÇóÊÇ£¬Áé»îÕÆÎÕ¡£²¢Öð²½×öµ½£ºÔÚÓ¦ÓÃÖз¢Õ¹£¬ÔÚ·¢Õ¹ÖÐÓ¦Óá£
1. Ôʼµ¥¾ÝÓëʵÌåÖ®¼äµÄ¹Øϵ
¡¡¡¡
¿ÉÒÔÊÇÒ»¶ÔÒ»¡¢Ò»¶Ô¶à¡¢¶à ......
javaÖеÄ×Ö·û´®Ò²ÊÇÒ»Á¬´®µÄ×Ö·û¡£µ«ÊÇÓëÐí¶àÆäËûµÄ¼ÆËã»úÓïÑÔ½«×Ö·û´®×÷Ϊ×Ö·ûÊý×é´¦Àí²»Í¬£¬Java½«×Ö·û´®×÷ΪStringÀàÐͶÔÏóÀ´´¦Àí¡£½«×Ö·û´®×÷ΪÄÚÖõĶÔÏó´¦ÀíÔÊÐíJavaÌṩʮ·Ö·á¸»µÄ¹¦ÄÜÌØÐÔÒÔ·½±ã´¦Àí×Ö·û´®¡£ÏÂÃæÊÇһЩʹÓÃƵÂʱȽϸߵĺ¯Êý¼°ÆäÏà¹Ø˵Ã÷¡£
substring()
ËüÓÐÁ½ÖÖÐÎʽ£¬µÚÒ»ÖÖÊÇ£ºString  ......