FireFox 5 Addons
https://addons.mozilla.org/en-US/firefox/addon/tab-mix-plus/
posted @ 2011-07-19 15:44 DoNeY 閱讀(197) | 評論 (0) | 編輯 收藏
DKzone- Ouditian Technology
2011年7月19日 #
posted @ 2011-07-19 15:44 DoNeY 閱讀(197) | 評論 (0) | 編輯 收藏
2011年6月25日 #
posted @ 2011-06-25 13:03 DoNeY 閱讀(207) | 評論 (0) | 編輯 收藏
2011年3月18日 #
2010年2月2日 #
posted @ 2010-02-02 11:25 DoNeY 閱讀(278) | 評論 (0) | 編輯 收藏
2010年1月31日 #
posted @ 2010-01-31 14:22 DoNeY 閱讀(287) | 評論 (0) | 編輯 收藏
2010年1月27日 #
posted @ 2010-01-27 14:25 DoNeY 閱讀(423) | 評論 (0) | 編輯 收藏
2009年10月21日 #
大部分的病毒和木馬都是通過加載系統啟動項來運行的,也有一些是注冊成為系統服務來啟動,他們主要通過修改注冊表來實現這個目的,主要有以下幾個鍵值:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsCurrent\Version\Run
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\AppInit_DLLs
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Notify
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsCurrent\Version\RunOnce
HKEY_LOCAL_MACHINE\Software\Microsoft\WindowsCurrent\Version\RunServicesOnce
但是與一般的木馬,病毒不同的是,就有一些病毒偏偏不通過這些來加載自己,不隨著系統的啟動運行。木馬病毒的作者抓住了一些用戶的心理,等到用 戶運行某個特定的程序的時候它才運行。因為一般的用戶,只要發覺自己的機子中了病毒,首先要察看的就是系統的加載項,很少有人會想到映像劫持,這也是這種病毒高明的地方。
映像劫持病毒主要通過修改注冊表中的
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\
項來劫持正常的程序,比如有一個病毒 vires.exe 要劫持qq程序,它會在上面注冊表的位置新建一個qq.exe項,再在這個項下面新建一個字符串的鍵 debugger把其值改為C:\WINDOWS\SYSTEM32\VIRES.EXE(這里是病毒藏身的目錄)即可。
posted @ 2009-10-21 10:01 DoNeY 閱讀(181) | 評論 (0) | 編輯 收藏
2009年10月19日 #
posted @ 2009-10-19 13:56 DoNeY 閱讀(248) | 評論 (0) | 編輯 收藏
2009年10月16日 #
[FW]http://weblogs.asp.net/kennykerr/archive/2004/11/26/where-is-form-s-loaded-event.aspx
Wow, it’s been a while since I last posted something here. We’ve recently moved to BC so I’ve been pretty distracted. I hope to be able to post more regularly in the coming weeks.
This is a bit off-topic for me but here goes.
Recently I needed to run some code right after a form is displayed for the first time. The Form.Load event is handy for performing various tasks when a form is loading but before it is displayed for the first time. Unfortunately there is no corresponding Form.Loaded event to notify the application that the form has actually loaded and is visible.
Fortunately it’s quite easy to pull it off without resorting to the WaitForInputIdle function. All you need to do is override Form’s OnLoad method and add an event handler for the Application.Idle event. Since we only want to be notified a single time that the form is loaded, we immediately remove the delegate in the event handler. You can of course register the event handler earlier in the form or application’s lifetime but I prefer to keep delegates registered for as short a period as possible.
Here’s a simple example:
This might be useful, for example, if you need to prompt the user (the horror!) for something but would prefer the dialog box to appear in the context of your application’s main window.
© 2004 Kenny Kerr
posted @ 2009-10-16 09:48 DoNeY 閱讀(289) | 評論 (0) | 編輯 收藏
2009年10月14日 #
posted @ 2009-10-14 11:14 DoNeY 閱讀(1531) | 評論 (0) | 編輯 收藏
2009年10月13日 #
posted @ 2009-10-13 18:36 DoNeY 閱讀(1713) | 評論 (0) | 編輯 收藏
2009年2月26日 #
使用ruby來操作excel文件首先需要在腳本里包含以下語句
require 'win32ole'
把win32ole包含進來后,就可以通過和windows下的excel api進行交互來對excel文件進行讀寫了.
打開excel文件,對其中的sheet進行訪問:
excel = WIN32OLE::new('excel.Application')
workbook = excel.Workbooks.Open('c:\examples\spreadsheet.xls')
worksheet = workbook.Worksheets(1) #定位到第一個sheet
worksheet.Select
讀取數據:
worksheet.Range('a12')['Value'] #讀取a12中的數據
data = worksheet.Range('a1:c12')['Value'] #將數據讀入到一個二維表
找到第一處a列的值為空值
line = 1
while worksheet.Range("a#{line}")['Value']
line=line+1
end #line的值為第一處空白行的行數
將第一列的值讀入到一個數組中
line = '1'
data = []
while worksheet.Range("a#{line}")['Value']
data << worksheet.Range("a#{line}:d#{line}")['Value']
line.succ!
end
將數據寫入到excel表格中
worksheet.Range('e2')['Value'] = Time.now.strftime '%d/%m/%Y' #單個值
worksheet.Range('a5:c5')['Value'] = ['Test', '25', 'result'] #將一個數組寫入
調用宏定義
excel.Run('SortByNumber')
設置背景色
worksheet.Range('a3:f5').Interior['ColorIndex'] = 36 #pale yellow
# 將背景色恢復成無色
worksheet.Range('a3:f5').Interior['ColorIndex'] = -4142 # XlColorIndexNone constant
# 使用Excel constant 將背景色恢復成無色
worksheet.Range('a3:f5').Interior['ColorIndex'] = ExcelConst::XlColorIndexNone
保存
workbook.Close(1)
# 或
workbook. 'myfile.xls'
# 默認路徑是系統定義的"我的文檔"
結束會話
excel.Quit
一些相對完整的代碼片段
創建一個excel文件并保存
require 'win32ole'
excel = WIN32OLE.new("excel.application")
excel.visible = true # in case you want to see what happens
workbook = excel.workbooks.add
workbook. ('c:\examples\spreadsheet1.xls')
workbook.close
操作excel文件的幾個重要元素
Excel => workbook => worksheet => range(cell)
我理解的是excel為類名,workbook為一個具體的(excel文件)實例,創建好實例后,worksheet是實例(workbook,工作簿)中的一個工作表,然后可
以對工作表中的每個單元格(range(cell))進行具體的讀寫------------------按照這樣操作肯定沒有錯,不過下面的這些語句又讓我有些疑惑
excel.workbooks("Mappe1").worksheets("Tabelle1").range("a1").value #讀取名為Mappe1的excel文件中工作表名為Tabelle1的a1單元格中的值
excel.worksheets("Tabelle1").range("a1").value #作用同第一條語句
excel.activeworkbook.activesheet.range("a1").value #作用同第一條語句
excel.activesheet.range("a1").value #作用同第一條語句
excel.range("a1").value #作用同第一條語句
excel可以直接操作所有的屬性,默認為當前活躍的工作簿/工作表
對單元格的操作:
某個單元格: sheet.range("a1")
a1到c3的值: sheet.range("a1", "c3") 或 sheet.range("a1:c3")
第一列: sheet.range("a:a")
第三行: sheet.range("3:3")
獲得單元格的值:
range.text #讀取值,返回為字符串格式,如果單元格內為數字,有可能會被截斷小數點后的位數
sheet.range("a1").text
range.value #讀取值,數字不會截斷
sheet.range("a1").value
對單元格設置值
sheet.range("a1").value = 1.2345
或
sheet.range("a1").value = '1.2345'
迭代訪問:
sheet.range("a1:a10").each{|cell|puts cell.value}
如果范圍是一個矩形,則會按行循環迭代訪問
sheet.range("a1:b5").each{|cell|puts cell.value}
block迭代,并打印出每行的第一個值
sheet.range("b3:c7").rows.each{|r|puts r.cells(1,1).value}
posted @ 2009-02-26 10:25 DoNeY 閱讀(2866) | 評論 (0) | 編輯 收藏
2009年2月24日 #
posted @ 2009-02-24 15:58 DoNeY 閱讀(219) | 評論 (0) | 編輯 收藏
2008年12月31日 #
2008-12-02
第1講【創建框架】
1 新建MFC exe / dialog based
2 刪除dialog類的顯示代碼
3 添加WelflGameFrm類
4 在app類的InitInstance 函數中 添加http://hi.baidu.com/welflau/希望能保留原創作者鏈接,謝謝!
m_pMainWnd = new CWelflGameFrm;
m_pMainWnd->ShowWindow( m_nCmdShow );
m_pMainWnd->UpdateWindow();
5 將CWelflGameFrm()構造函數改為public 成員
6 在構造函數CWelflGameFrm中添加:
RECT rect;
Create(NULL,"ch07-1: ミDirectGraphics");
CClientDC dc(this);
int width = dc.GetDeviceCaps(HORZRES);
int height = dc.GetDeviceCaps(VERTRES);
GetWindowRect( &rect );
width = ( width - ( rect.right - rect.left ))/2 ;
height = (height - (rect.bottom - rect.top ))/2 ;
MoveWindow( width , height , (rect.right - rect.left ) , (rect.bottom - rect.top ) ,true);
7 為CWelfGameFrm類添加WindowProc函數,并加入代碼:http://hi.baidu.com/welflau/希望能保留原創作者鏈接,謝謝!
switch( message )
{
case WM_CREATE :
if( !d3dCreate( m_hWnd , 640 , 480 , true ))
PostMessage( WM_CLOSE );
return 0 ;
case WM_DESTROY :
d3dRelease();
return 0 ;
}
8 為工程添加兩個文件
myd3d.cpp, myd3d.h
9 編譯出現
fatal error C1010: unexpected end of file while looking for precompiled header directive
解決方案:在Project Settings里C++頁面的Precomplie Header里把出錯源文件設置為不使用預編譯頭就可以了,詳見視頻
10 將BOOL CWelfGameApp::InitInstance()中的
return FALSE;改為 return TRUE;
11 為CWelfGameFrm類添加OnPaint響應
添加如下代碼:
d3dClear(0);
//
d3d_Device->Present( NULL , NULL , NULL , NULL );
第2講【繪制文字和圖像】
目錄
【一】、從DirectGraphic中獲取DC(GDI)
【二】、2D圖像繪制
【一】、從DirectGraphic中獲取DC(GDI)
1 添加類d3dHdc 在 myd3d.h文件中
class d3dHdc
{
private :
HDC m_hdc ;
LPDIRECT3DSURFACE9 m_Surface ;
public :
void Release();
inline operator HDC(){ return m_hdc ;};
public :
d3dHdc();
~d3dHdc();
};
2在myd3d.cpp中添加函數定義
d3dHdc::d3dHdc()
{
m_hdc = 0 ;
m_Surface = 0 ;
// 獲得設備
if( !d3d_Device )
return ;
if( d3d_Device->GetBackBuffer( 0 , 0 , D3DBACKBUFFER_TYPE_MONO , &m_Surface ) != D3D_OK )
return ;
m_Surface->GetDC( &m_hdc );
}
d3dHdc::~d3dHdc()
{
Release();
}
void d3dHdc::Release()
{
if( m_Surface )
{
if( m_hdc )
m_Surface->ReleaseDC( m_hdc );
m_Surface->Release();
m_hdc = NULL ;
m_Surface = NULL ;
}
}
3 現在就可以使用他了
在繪制函數中添加:
d3dHdc hdc ;
SetTextColor( hdc , RGB( 255 , 255 , 255 ));
SetBkMode( hdc , 1 );
TextOut( hdc , 0 , 0 , str , strlen( str ));
hdc.Release();
【二】、2D圖像繪制
1 新建d3dTexture類
class d3dTexture
{
private :
int m_Width ;
int m_Height ;
LPDIRECT3DTEXTURE9 m_Texture ;
public :
void BltFast( int x , int y );
void BltFast( int l , int t , int r , int b );
public :
BOOL Create( LPCTSTR file );
void Release();
inline operator LPDIRECT3DTEXTURE9(){ return m_Texture ;};
public :
d3dTexture();
~d3dTexture();
};
2 并添加定義:
/*////////////////////////////////////////////////
3D 紋理類d3dTexture 函數定義 2008-12-02
/*////////////////////////////////////////////////
d3dTexture::d3dTexture()
{
m_Texture = NULL ;
}
d3dTexture::~d3dTexture()
{
Release();
}
void d3dTexture::Release()
{
if( m_Texture )
m_Texture->Release();
m_Texture = NULL ;
}
BOOL d3dTexture::Create( LPCTSTR file )
{
D3DXIMAGE_INFO in ;
memset( &in , 0 , sizeof( in ));
// ﹍て
Release();
//更
D3DXCreateTextureFromFileEx( d3d_Device ,
file , D3DX_DEFAULT , D3DX_DEFAULT ,
0 , 0 , D3DFMT_UNKNOWN , D3DPOOL_MANAGED ,
D3DX_DEFAULT ,
D3DX_DEFAULT , 0 , &in , NULL , &m_Texture );
if( m_Texture == NULL )
return false ;
// 眔戈
m_Width = in.Width ;
m_Height = in.Height ;
return true ;
}
void d3dTexture::BltFast(int x, int y)
{
BltFast( x , y , x + m_Width , y + m_Height );
}
void d3dTexture::BltFast(int l , int t , int r , int b )
{
D3DTLVERTEX v[4] ;
//郴翴 擋篶
memset( v , 0 , sizeof( v ));
v[0].x = v[3].x = (float)(l) ;
v[1].x = v[2].x = (float)(r);
v[0].y = v[1].y = (float)(t);
v[2].y = v[3].y = (float)(b);
v[0].rhw = v[1].rhw = v[2].rhw = v[3].rhw =
v[0].z = v[1].z = v[2].z = v[3].z = 0.5f ;
v[0].diffuse = v[1].diffuse = v[2].diffuse = v[3].diffuse = -1 ;
v[1].tu = v[2].tu = 1.0f ;
v[2].tv = v[3].tv = 1.0f ;
//砞酶瓜家Α
d3d_Device->SetTexture( 0 , m_Texture );
d3d_Device->SetFVF( D3DFVF_TLVERTEX );
d3d_Device->DrawPrimitiveUP( D3DPT_TRIANGLEFAN , 2 , (LPVOID)v , sizeof( D3DTLVERTEX ));
}
3 編譯時會出錯
解決方法:
在myd3d.h文件中添加
#include "d3dx9tex.h"
和
#pragma comment(lib,"d3dx9.lib")
以及
const DWORD D3DFVF_TLVERTEX = (D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1 );
typedef struct _D3DTLVERTEX
{
float x , y , z , rhw ;
D3DCOLOR diffuse , specular;
float tu, tv;
}D3DTLVERTEX ;
4 在WelfGameFrm中添加兩個成員
d3dTexture m_Bk ;
d3dTexture m_Role ;
5 在WelfGameFrm的Create響應添加:
m_Bk.Create( "背景.tga" );
m_Role.Create( "娃娃.tga" );
6 調用BltFast進行繪制
//開始繪制
d3d_Device->BeginScene();
d3d_Device->SetRenderState( D3DRS_CULLMODE , D3DCULL_NONE );
d3d_Device->SetRenderState( D3DRS_ZENABLE , D3DZB_FALSE );
m_Bk.BltFast( 0 , 0 );
m_Role.BltFast( 0 , 0 );
d3d_Device->EndScene();
7 將BltFast函數改進
第3講 WelfGame【圖像透明及顏色】
http://hi.baidu.com/welflau/希望能保留原創作者鏈接,
【一】、實現透明圖像
1 在RenderScene()中添加設置代碼
在背景繪制前添加:
d3d_Device->SetRenderState( D3DRS_CULLMODE , D3DCULL_NONE );
d3d_Device->SetRenderState( D3DRS_ZENABLE , D3DZB_FALSE );
d3d_Device->SetRenderState( D3DRS_SHADEMODE , D3DSHADE_FLAT );
d3d_Device->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE );
在前景繪制的前面添加
d3d_Device->SetRenderState( D3DRS_SRCBLEND , D3DBLEND_SRCALPHA );
d3d_Device->SetRenderState( D3DRS_DESTBLEND , D3DBLEND_INVSRCALPHA );
d3d_Device->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );//開啟混色
效果
2 為d3dTexture添加BltFast函數
void d3dTexture::BltFast(int l , int t , int r , int b , DWORD diffuse )
{
D3DTLVERTEX v[4] ;
//郴翴 擋篶
memset( v , 0 , sizeof( v ));
v[0].x = v[3].x = (float)(l) ;
v[1].x = v[2].x = (float)(r);
v[0].y = v[1].y = (float)(t);
v[2].y = v[3].y = (float)(b);
v[0].rhw = v[1].rhw = v[2].rhw = v[3].rhw =
v[0].z = v[1].z = v[2].z = v[3].z =
//肅︹
v[0].diffuse = v[1].diffuse = v[2].diffuse = v[3].diffuse = diffuse ;
v[1].tu = v[2].tu =
v[2].tv = v[3].tv =
//砞酶瓜家Α
d3d_Device->SetTexture( 0 , m_Texture );
d3d_Device->SetFVF( D3DFVF_TLVERTEX );
d3d_Device->DrawPrimitiveUP( D3DPT_TRIANGLEFAN , 2 , (LPVOID)v , sizeof( D3DTLVERTEX ));
}
添加以下幾句:
d3d_Device->SetTextureStageState( 0 , D3DTSS_ALPHAARG1 , D3DTA_TEXTURE );
d3d_Device->SetTextureStageState( 0 , D3DTSS_ALPHAARG2 , D3DTA_DIFFUSE );
d3d_Device->SetTextureStageState( 0 , D3DTSS_COLORARG1 , D3DTA_TEXTURE );
d3d_Device->SetTextureStageState( 0 , D3DTSS_COLORARG2 , D3DTA_DIFFUSE );
d3d_Device->SetTextureStageState( 0 , D3DTSS_COLOROP , D3DTOP_SELECTARG1 );
d3d_Device->SetTextureStageState( 0 , D3DTSS_ALPHAOP , D3DTOP_MODULATE );
//以下為前景
m_Role.BltFast( 100, 100, 250 ,250 ,D3DCOLOR_ARGB( 128 , 255 , 255 , 255 ));//最后一個參數為顏色,包括透明度
效果圖
posted @ 2008-12-31 18:04 DoNeY 閱讀(421) | 評論 (0) | 編輯 收藏
posted @ 2008-12-31 17:59 DoNeY 閱讀(277) | 評論 (0) | 編輯 收藏
轉自http://www.cppblog.com/ACM-Boy/archive/2008/12/31/70843.html
string 轉 CString
CString.format("%s", string.c_str());
char 轉 CString
CString.format("%s", char*);
char 轉 string
string s(char *);
string 轉 char *
char *p = string.c_str();
CString 轉 string
string s(CString.GetBuffer());
1,string -> CString
CString.format("%s", string.c_str());
用c_str()確實比data()要好.
2,char -> string
string s(char *);
你的只能初始化,在不是初始化的地方最好還是用assign().
3,CString -> string
string s(CString.GetBuffer());
GetBuffer()后一定要ReleaseBuffer(),否則就沒有釋放緩沖區所占的空間.
posted @ 2008-12-31 17:43 DoNeY 閱讀(241) | 評論 (0) | 編輯 收藏
2008年10月21日 #
Origin Link http://blog.2ndboy.net/?p=116#comment-3104
我算得上是 UltraEdit 的鐵桿用戶啦(雖然是 D 版用戶:)),所以寫 Lua 程序當然用 UltraEdit 啦!讓 UltraEdit 支持 Lua 的語法高亮很簡單,去 UE 的官網,下載 Lua 的語法文件集成在自帶的語法高亮文件里就可以啦。
但是 UE 官網上這個語法文件貌似比較舊,是 02 年 8 月發布的,塊注釋居然用的是“[[”和“]]”:“Block Comment On = [[ Block Comment Off = ]]”。于是手工改成“Block Comment On = –[[ Block Comment Off = –]]”保存,結果發現行注釋“–”是可以正確顯示的,但是塊注釋就只能顯示快注釋開始標記所在的那一行。貌似是 UE 的 bug?估計跟行注釋有沖突,因為語法文件里是這么寫的“Line Comment = — Block Comment On = –[[ Block Comment Off = –]]”。試了一下把行注釋放在塊注釋后面也不行,開動 Google,結果在 UE 的論壇上找到了答案。
把 Lua 的語法文件第一行改成如下這個樣子就可以啦:
(DoNeY注:哈,終于有了解決方案,下面聽作者講一下這一微小滴奧妙所在)
查了一下 UE 的幫助文檔,上面對“Block Comment On Alt”的描述是這樣的“The second set of block comments are in the form “Block Comment On Alt = ” and “Block Comment Off Alt = ” followed by up to five characters each that define the comment designators. If a Block Comment On Alt is defined but the Block Comment Off Alt is not defined the commenting will stop at the end of the line.”。看來塊注釋指示器有兩種,這個辦法還真是比較巧妙,但是要熟讀 UE 文檔才能想的到呀。
(DoNeY注:意即如果ultraedit在wordfile中對某個語言的語法著色只定義其Block Comment On Alt =作為第二種塊注釋的起始符號,而不定義第二種塊注釋的結束符號Block Comment Off Alt =,那么這個Block Comment On Alt 所定義的符號將會只注釋掉從符號開始至行尾的部分,也就相當于換一個方法定義了行注釋的符號了)
改完以后再看 Lua 代碼里的塊注釋,現在已經可以完美顯示啦:D
posted @ 2008-10-21 17:35 DoNeY 閱讀(3404) | 評論 (0) | 編輯 收藏
First, the XML tags movable="true" and enableMouse="true" must be in the frames declaration. Note: Some frame templates like 'button' already include enableMouse="true".
Example:
I haven't discovered any adverse side effects to doing this yet, I am not even sure if this is the intended use for it.
Using this method can result in the frame not responding to other mouse events, also both mouse buttons will drag the frame.
You can also specify <Size> and <Anchors> within <TitleRegion>, e.g.
posted @ 2008-10-21 16:11 DoNeY 閱讀(743) | 評論 (0) | 編輯 收藏