<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Feeling

        三人行,必有我師焉

       ::  :: 新隨筆 :: 聯系 ::  :: 管理 ::
      185 隨筆 :: 0 文章 :: 392 評論 :: 0 Trackbacks

    #

    新增了4個Low Level Hook:Mouse_LL,Keyboard_LL, JournalRecord,JournalPlayback。由于是Low Level Hook,因此Hook是不依賴于dll,所以可以直接將HookProc在Java程序中編寫。這四個鉤子都是全局的,而且都很有用處。Mouse_LL,Keyboard_LL,自不必說,用來監聽鼠標和鍵盤的。Journal的2個Hook則是所謂的日志鉤子,WH_JOURNALPLAYBACK Hook使應用程序可以插入消息到系統消息隊列。可以使用這個Hook回放通過使用WH_JOURNALRECORD Hook記錄下來的連續的鼠標和鍵盤事件。只要WH_JOURNALPLAYBACK Hook已經安裝,正常的鼠標和鍵盤事件就是無效的。WH_JOURNALPLAYBACK Hook是全局Hook,它不能象線程特定Hook一樣使用。WH_JOURNALPLAYBACK Hook返回超時值,這個值告訴系統在處理來自回放Hook當前消息之前需要等待多長時間(毫秒)。這就使Hook可以控制實時事件的回放。

    基本上現在用SWT-Extension來實現這四個Hook還是很容易的,做了一下簡單的數據封裝和事件封裝,而且加入了結合體對象和JNI的handle互相轉換的函數。用來做C++的一些事情還是比較得心應手的。最新版本的Example提供了一個簡單的系統Record/Playback例子,可以記錄和回放系統事件。

     

    最新的build已經發布到 http://feeling.sourceforge.net 上了,有興趣的可以下載看看,并且可以作為Eclipse插件使用,支持 eclipse 3.2 以上版本。

    PS: Journal的2個Hook Vista已經停止支持了,所以這個例子在Vista 下是看不到的:-(
    posted @ 2007-12-12 18:18 三人行,必有我師焉 閱讀(1518) | 評論 (2)編輯 收藏

    SWT-Extension這個項目做了很久,但一直都沒有realease,只是個人做著玩玩,很重要的一個原因是對Windows System Hook的機制沒有能夠很好地實現出來。Hook本身不算是很難的技術,在C++,C#里都能夠很容易的實現,為什么運用Java就那么困難呢?

    首先當然主要還是我個人對C++并不在行了,其次就是Java和C++交互的問題了。要想通過C++把數據傳給Java,就要通過JNI標準的接口來實現,也就是要通過 JNIENV 來實現,但是HookProc 這個CallBack 是給系統進程調用的,不是給你Java調用的,你說系統進程調用了 HookProc 之后,沒法把這個事件傳遞給Java,那么還有一個方法,用Java不間斷的輪循Hook里的數據,這倒是能實現,網上也有一個老外的例子,但不好的地方就是當我系統沒工作的時候,你Java還在那兒輪循我干嘛?這不是浪費資源嗎?所以呢,這解鈴還需系鈴人,系統的事件還得讓系統來通知你才好。在Java里,有一個IO阻塞,比如當調用System.in.read()的時候,系統就是等待你的輸入,如果你不輸入,系統就一直等著不工作。還有線程,有wait方法,非要等著其他的線程通過notify把你喚醒你才能工作。在C++里也有這么一套機制:CreateEvent 和WaitForSingleObject,也就是說我先創建一個事件,然后將這個事件置于未激活狀態,讓它一直等待,將線程阻塞住,當HookProc被系統進程調用的時候,就將這個事件激活,通知Java程序你可以開始干活了,干完活以后再次被阻塞,直到這個Hook被uninstall掉。當然這其中還有一些 C++ 代碼的細節性問題,比如怎么讓不同的進程共享同一個事件,這里要說明的就是不同的進程可以共享同一個事件,但是不能共享同一個事件句柄,同一個事件,在不同的進程里有不同的句柄,句柄是不能跨進程的。 

    我個人認為Hook應當是SWT-Extension里一個很重要的組成部分,SWT本身只能實現線程鉤子,對于系統級的鉤子無能為力。因為系統機鉤子需要實現數據共享操作,還需要DLL入口句柄,這些我已都在SWT-Extension中實現了。唯一讓我遺憾的是沒有辦法實現日志鉤子,這是一個很有用的鉤子,可以用來記入當前用戶行為的操作,然后重新演示,我想如果做自動化測試這個會很有用,或者給游戲軟件練功什么的,呵呵。之所以不能實現是因為這個鉤子很特別,它要的不是DLL的句柄,而是應用程序的句柄,這沒有辦法從Java程序里獲得,我試過javaw.exe,但是也不行,會導致系統假死。以后有時間在研究吧。

    做完Hook,終于可以松一口氣,發一個小小的realease了,剩下的就是document工作要做了,一個枯燥無味的工作,就當練習一下英語好了。

    這里發一個Hook的截圖:




    沒有了標題欄的Eclipse
    最新的Build和代碼也可以在 http://feeling.sf.net 上下載了。
    posted @ 2007-12-07 15:08 三人行,必有我師焉 閱讀(2459) | 評論 (17)編輯 收藏

    1. Change priorities when it became apparent that items with major market impact didn't take much effort, or when it became apparent that items with minor market impact wuld take much more effort than they worth.
    2. Prioritize the task list based on their presentation of the feature's importance.
    3. Maintain a list of what is needed in the product.
    4. Iterative, incremental development. Each iteration is called a Sprint, and the results of the iteration is called a Product Increment.
    5. Whoever writes code owns it forever.
    6. produce an updated produce technical illustration with each Sprint(and release)that could be used to understand the product design and code.
    7. Institute a quick, daily meeting where the team would report what it is doing.
    8. Product Backlog: A list, list all of the things that the system should include and address, including functionality, features, and technology.
    9. The Product Backlog is a prioritized list of all product requirements. and it 's never finalized. Product backlog content can come from anywhere: users, customers, sales, marketing, customer service, and engineering can all submit items to the backlog. However, only the Product Owner can prioritize the backlog.
    10. Scrum relies on team initiative and integrity.
    11. The Scrum Team meets daily for a short status meeting, called the Daily Scrum.
    12. At the end of the Sprint, the team gets together with management at a Spring Review Meeting to inspect the product increment the team has built.
    posted @ 2007-09-24 13:44 三人行,必有我師焉 閱讀(420) | 評論 (1)編輯 收藏

    Since 19th century, human has been changing the earth continuously. They began to use various energies to server themselves. The most important application is electricity. If the electric power is cutted, wo even couldn't do anything. Air conditioner, fridge, wash matchine, computer and oven all need electric power. We use coal,water power,wind,biology and nuclear power to generate electric power. Generally, when we convert a power to another power, the efficiency is not perfect, we will lose some energy. Most of the lost energy is changed as hot energy. So when we touch the machine used electric power, we can feel it's hot.

    Except electric power, we also use another kind of power, that is chemical power. We can get it by burning coal and oil. This power is used broadly. For example, the car, the plane and some other traffic tools. But when we generate the chemical power, there will cause lots of waste gas. Some kind gases in the waste gas can let earth become a greenhouse. Then we generate a mass of hot energy but these greenhouse gases prevent it to run away to the universe. The hot energy stays at our planet, and the temperature becomes high little by little.

    Now the global warming is obvious, the ice of the south earth pole is melting little by little, the drought and the hurricane appears more and more. Each person can feel the earth is warming now.

    Now the big energy countries start to decrease the greenhouse gas releasing and increase the efficiency of power conversion.For example, we use water power, wind, nuclear power to generate electric power as much as possible, but not use coal and oil. Each people has the responsibility to protect our home.

    posted @ 2007-09-19 12:28 三人行,必有我師焉 閱讀(251) | 評論 (0)編輯 收藏

    Everyone knows that smoking is harmful for health, but why do so many people still smoke? It’s a complex society problem. There are several reasons that caused it.

     

    Firstly, cigar contains some matters which can let people depend on them. Nicotine is one of the most harmful matters in the cigar. The nicotine contained in one cigar can kill one mouse by poison. And some other matters of cigar can let people get cancer. Smoking also can damage liver and lung. In short, smoking is very dangerous.


     

    Secondly, lots of people smoking is caused by the social fashion. Generally, most of people started to smoke when they were teenager. They have a strong emulous mind, and they like to imitate the movie stars’ smoking behavior. The environment that the teenagers lives is bad for their growth.

     

    Lastly, it’s caused by economy. The tax of cigar is very huge, each government couldn’t ignore it. It will generate a big benefit, so most of countries don’t forbid selling cigar. Fortunately, some of them begin to forbid selling cigar to the underage people.

     

    Lots of parents don’t allow children to smoke, but it’s not very effective. Because they don’t let children smoke, but they still smoke. Children’s growth needs a clear and fresh environment, but not an environment full of smoking. The government must carry out more measures about forbidding smoking, and adult would better to give up smoking also.

    posted @ 2007-09-18 12:36 三人行,必有我師焉 閱讀(1024) | 評論 (0)編輯 收藏

    Grammar Website: http://www.windsn.com/main/grammar/
    Dictionary Online: http://www.godict.com
    Google Translator: http://www.google.com/language_tools?hl=zh-CN
    English Studying Fourm:http://www.maplesky.net/bbs/index.php (Can download a lot of resource from here)
    English Movie:
    Family Album U.S.A(走遍美國) 很好的英語口語學習教材
    Speed(生死時速) 練習聽力,語速很慢

    posted @ 2007-09-05 13:30 三人行,必有我師焉 閱讀(283) | 評論 (0)編輯 收藏

    在你看來,下面圖像的運動方向是順時針呢還是逆時針呢??
    每個人看來都是不一樣的 
     
    順時針的話,屬于是用右腦較多的類型
    逆時針屬于是用左腦較多的類型
    大部分人的眼里是逆時針方向轉動,但也有人看來是順時針方向轉動的。
    順時針的情況,女性比男性多 ~~
    試試吧!~ 

    我第一眼看上去是逆時針,第二眼又變成了順時針。

    怎么說呢,以不同的視角看,就會形成不同的旋轉路線,可能是逆時針也可能是順時針,我現在已經是忽左忽右,快暴走了。

    自己找到了一個比較好的解決方法,腦袋貼近屏幕向右偏轉45度看,很容易形成逆時針,向左偏轉45度看,很容易形成順時針,主要是人和圖片的視角問題。這圖片設計的也太巧妙了。

    Team里的人大部分看都是順時針,只有一個左撇子看是逆時針。
    posted @ 2007-07-25 17:11 三人行,必有我師焉 閱讀(1849) | 評論 (6)編輯 收藏

      中新網7月13日電 綜合報道,一名犯有重罪的羅馬尼亞犯人近日向上帝提出控訴,地方法院12日對此予以駁回。

      據悉,該名羅馬尼亞犯人是2005年7月因受賄罪被捕的。他被判處入獄20年,在獄中更是抱怨上帝對他不公,在2006年甚至向地方法院控告上帝。

      這名犯人說,早在他出生時在教堂受洗的時候就與上帝訂立了契約,讓他能夠快樂生活,但現在“上帝打破了這份契約,因此有必要控告他”。

      地方法院12日發布的判決書稱,“由于無法獲知上帝的家庭住址,因此無法向其傳達法院的意見,”并最終對囚犯的要求予以駁回。

    posted @ 2007-07-13 18:19 三人行,必有我師焉 閱讀(309) | 評論 (0)編輯 收藏

    昨晚趕工為SF上的項目做了個首頁:http://feeling.sf.net 。各位兄弟有空可以看看,幫忙提點意見,不過現在鋪的好像就有點大了,這么多頁面,不知道何時才能做完,打算就先這么擱一個首頁,以后有時間再說吧。

    SWT Extension Example我今天打包了一下,已經可以下載了,但是源代碼我暫時還沒打算開放下載,因為有些功能還沒做好,需要一段時間,最重要的是我打算對現有代碼進行重構,API可能有比較重大的調整,現在提供下載,對想要使用的兄弟來說是一種不負責任的態度。不過Code還是可以從CVS Checkout,地址可以在項目首頁上找到。

    SWT Extension Example下載地址:

    Java 版: http://feeling.sourceforge.net/downloads/example.zip
    Native版:http://feeling.sourceforge.net/downloads/example_native.zip (如果上網的機器上還沒有安裝JRE的兄弟請選擇這個)




    SWT Extension extends the Eclipse library SWT.

    It is a software development kit enabling you to work with native code from Java programs without using JNI. With SWT Extension, you don't need to create native libraries to call a function of the operating system API or a function from any dynamic library. You write code in the Java language only, and SWT Extension does the rest. SWT Extension provides quite a number of integration features to make your Java application look and behave like a Win32 citizen.

  • Window Decorations: making windows always-on-top, transparent, flashing on the taskbar, etc.
  • Custom Shape Window: creating non-rectangular windows using custom Regions.
  • Access to Windows Registry.
  • Shell Folders: getting paths and icons of the user folders (Favorites, My Pictures, etc)
  • Shell Links: managing the system link files.
  • System Info: gathering CPU and memory information.
  • Specially, you can get a lot of functions via SWT, because SWT Extension extends SWT.
  • posted @ 2007-06-28 17:10 三人行,必有我師焉 閱讀(1333) | 評論 (7)編輯 收藏

    大概因為開發環境是英文的緣故吧,做了這么久時間的SWT-Extension,直到今天才發現存取中文都是亂碼。不過顯而易見的是Test Case做得太少了,畢竟是自己的開源項目,在上面投入的是興趣,而不是精力。雖然一直在弄,但動輒就幾個月沒有commit,而且到現在也沒有一個正式版發布。本來可以積累一點user的,現在估計也都跑光了。

    下面這段代碼用于JNI中jstring和Window char之間轉換:

    char* jstringToNative( JNIEnv  *env, jstring jstr )
    {
      
    int length = env->GetStringLength(jstr );
      
    const jchar* jcstr = env->GetStringChars(jstr, 0 );
      
    char* rtn = (char*)malloc( length*2+1 );
      
    int size = 0;
      size 
    = WideCharToMultiByte( CP_ACP, 0, (LPCWSTR)jcstr, length, rtn,(length*2+1), NULL, NULL );
      
    if( size <= 0 )return NULL;
      env
    ->ReleaseStringChars(jstr, jcstr );
      rtn[size] 
    = 0;
      
    return rtn;
    }

    jstring nativeTojstring( JNIEnv
    * env, char* str )
    {
      jstring rtn 
    = 0;
      
    int slen = strlen(str);
      unsigned 
    short * buffer = 0;
      
    if( slen == 0 )
        rtn 
    = env->NewStringUTF( str ); 
      
    else
      {
        
    int length = MultiByteToWideChar( CP_ACP, 0, (LPCSTR)str, slen, NULL, 0 );
        buffer 
    = (unsigned short *)malloc( length*2 + 1 );
        
    if( MultiByteToWideChar( CP_ACP, 0, (LPCSTR)str, slen, (LPWSTR)buffer, length ) >0 )
          rtn 
    = env->NewString(  (jchar*)buffer, length );
      }
      
    if( buffer )
      free( buffer );
      
    return rtn;
    }



    JNI 用起來實在太麻煩了,比我做Java開發效率實在低得太多,各種各樣的類型轉換,我頭都暈了…… 另外JNI好像是SUN中國研究院搞的,怎么就沒有提供一個好的中文解決方案?

    Eclipse SWT Extension snapshot:













    posted @ 2007-06-25 12:43 三人行,必有我師焉 閱讀(946) | 評論 (2)編輯 收藏

    僅列出標題
    共9頁: 上一頁 1 2 3 4 5 6 7 8 9 下一頁 
    GitHub |  開源中國社區 |  maven倉庫 |  文件格式轉換 
    主站蜘蛛池模板: 亚洲国产精品久久久天堂| 无码AV动漫精品一区二区免费| 亚洲国产专区一区| 无码专区永久免费AV网站 | 最新免费jlzzjlzz在线播放| 久久精品免费网站网| 苍井空亚洲精品AA片在线播放| 亚洲精品熟女国产| 久久久久亚洲av无码专区蜜芽 | 国产亚洲Av综合人人澡精品| 亚洲国产成人精品激情| 亚洲毛片在线观看| 日韩亚洲欧洲在线com91tv| 亚洲日韩在线观看免费视频| 国产裸模视频免费区无码| 91免费精品国自产拍在线不卡| 特级无码毛片免费视频尤物| a级午夜毛片免费一区二区| 国产免费牲交视频免费播放 | 在免费jizzjizz在线播| 国产一级高青免费| 国产日韩久久免费影院| 日韩a毛片免费观看| 国产午夜亚洲精品不卡免下载| 亚洲a∨无码一区二区| 亚洲youwu永久无码精品| 亚洲精华国产精华精华液| 久久亚洲精品国产亚洲老地址| 67194在线午夜亚洲| 亚洲国产系列一区二区三区| 亚洲综合伊人制服丝袜美腿| 国产亚洲sss在线播放| 亚洲xxxx视频| 亚洲a∨无码精品色午夜| 亚洲国产精品无码观看久久| 亚洲av无码日韩av无码网站冲| 亚洲AV色欲色欲WWW| 免费人成视频在线播放| 久久精品无码专区免费| 日本免费人成网ww555在线| 无码人妻一区二区三区免费n鬼沢 无码人妻一区二区三区免费看 |