google rss rss

doneykoo [Ouditian]

DKzone- Ouditian Technology

2011年7月19日 #

FireFox 5 Addons


https://addons.mozilla.org/en-US/firefox/addon/tab-mix-plus/
https://addons.mozilla.org/en-US/firefox/addon/firegestures/
    
http://code.google.com/p/gmarks/downloads/detail?name=GMarks-1.0.3.xpi&can=2&q=
http://www.firefox.net.cn/forum/viewtopic.php?t=29894

posted @ 2011-07-19 15:44 DoNeY 阅读(183) | 评论 (0)编辑 收藏

2011年6月25日 #

[fw] as3优化总结

as3优化总结

有意思的一条:

10) 寻找局部变量(this方法同with方法比较)
局部变量的定位方法很多。我们发现用with比用this更加有优势!

posted @ 2011-06-25 13:03 DoNeY 阅读(192) | 评论 (0)编辑 收藏

2011年3月18日 #

20110318

今天项目Milestone3的review
总体各方面来说还挺满意

posted @ 2011-03-18 15:06 DoNeY 阅读(170) | 评论 (0)编辑 收藏

2010年2月2日 #

WowDLLChecker (c) Ouditian [rev.20100921] ver 1.0.3.22

最近不少wower包括我自己都碰到了wow目录下出现危险dll文件而可能遭木马窃取资料的情况,
做了个小工具,与大家分享,欢迎交流意见建议。   

[::艾泽拉斯国家地理 BBS.NGACN.CC::]

在对于那些dll文件的最后修改时间与标准版本最后修改时间比较,我不太清楚大家手头的dll文件如何, 希望大家能把使用中出现的情况反馈给我,在此感谢。

在您wow前、wow时打开WowDLLChecker,它将帮助您找出并保持检测扫描:
wow.exe和目录下DLL等被修改过的文件危险的多余DLL文件、以及缺失的文件
不用担心有dll文件属性是只读或隐藏或系统,工具是会扫描到的。
同时还为你检查是否有wow,laucher的映像劫持。

使用:放置到你的wow文件夹并执行。

PS. 此程序无任何对网络的访问。
这个链接应该可以吧      
猛击此处下载→ [ WowDLLChecker_20100921_1.0.3.22.rar] 59.3   KB
   

缺少.Net库的童鞋请下载[ http://www.microsoft.com/downloads/details.aspx?FamilyID=0856EACB-4362-4B0D-8EDD-AAB15C5E04F5&displaylang=zh-cn Microsoft .NET Framework Version 2.0 组件包(x86) ]



== Log ==
20091103 1.0.2.0 new features:  MD5 check;
                                Tool self check result;
                                Wow.exe and Launcher.exe check;
                                Colorized rows to indicate file status.
20091104 1.0.2.1 new features:  Changed last modified time judgement;
                                Configuration of keep checking;
                                Fixed language setting;
                                Minimized tray has a balloon tooltip now.
20091113 1.0.2.2 new features:  Disabled the judgement for last modified time;
                                Fixed the colorize process.
20091114 1.0.2.3 new features:  Looped in repair.exe;
                                Indicates wow client version the tool is based on;
                                Added suggestion message;
                                Adjusted the colorize process.
20091208 1.0.2.4 new features:  Now concerns some DLLs of vc7 env;
                Prepare checking system for multi regions.
20100202 1.0.3.0 new features:  Now supports examination for WOW.TW;
                Supports region selection between: zhCN, zhTW;
                Supports language selection between: simplified Chinese, traditional Chinese, english;
                Auto check your region for first running this app;
                Auto saves/loads your changed settings.
20100915 1.0.3.20 Updated for CWOW WLK.
                  Sorry that in this version, TW info is wrong.
20100916 1.0.3.21 Bug fix.
20100921 1.0.3.22 Enhanced security check with MD5 and Exe Dll FileVersion.
                  Compatible with different versions of msvc dlls.
                  Info of zhCN 3.2.2.12484 added.
                  Info of zhTW 3.3.5.12340 added.




WowDLLChecker.exe
Size: 69645 bytes
File Version: 1.0.3.22
Modified: Tuesday, September 21, 2010, 11:03:05
MD5: 9ADC90F7AA797F19C76EF5AF0D8AD74F
SHA1: EAC9FA7ABA22534D2E9CEEE87C8E37AA281E9CD2
CRC32: 43D7A492



WowDLLChecker_20100921_1.0.3.22.rar
Size: 61572 bytes
Modified: Tuesday, September 21, 2010, 11:05:47
MD5: E15F7C16B908A2BE4FC3E80B9ED1694B
SHA1: 3D736739890938C9AF85A0D4B6914D024613D0CE
CRC32: CA778324




LOG.
--DONE
多余非官方文件√
文件大小比较√
最后修改时间比较√
MD5√
IFEO of wow.exe, launcher.exe√
支持台服√
支持多语言√
自检测结果√

--TODO
被加载DLL
 

posted @ 2010-02-02 11:25 DoNeY 阅读(265) | 评论 (0)编辑 收藏

2010年1月31日 #

Notes of Learning OpenGL Programming Guide [3]



  1 // #pragma comment(linker, "/subsystem:\"windows\" /entry:\"mainCRTStartup\"")
  2 
  3 #include "GL\glut.h"
  4 #include <iostream>
  5 
  6 static GLfloat fSpin = 0.0;
  7 static GLfloat fClearBlue = 0.2;
  8 static bool bRotating = false;
  9 
 10 void display(void)
 11 {
 12     // clear
 13     glClear(GL_COLOR_BUFFER_BIT);
 14 
 15     glPushMatrix();
 16     glRotatef(-fSpin, 0.00.01.0);
 17     glColor3f(1.01.01.0);
 18     glRectf(-25.0-25.025.025.0);
 19 
 20     glColor3f(1.00.00.0);
 21 
 22     glBegin(GL_POLYGON);
 23     glVertex3i(-16,    18,    0);
 24     glVertex3i(16,    18,    0);
 25     glVertex3i(16,    10,    0);
 26     glVertex3i(-16,    10,    0);
 27     glEnd();
 28 
 29     glBegin(GL_POLYGON);
 30     glVertex3i(-4,    10,    0);
 31     glVertex3i(4,    10,    0);
 32     glVertex3i(4,    5,    0);
 33     glVertex3i(-4,    5,    0);
 34     glEnd();
 35 
 36     glBegin(GL_POLYGON);
 37     glVertex3i(-20,    5,    0);
 38     glVertex3i(20,    5,    0);
 39     glVertex3i(20,    -3,    0);
 40     glVertex3i(-20,    -3,    0);
 41     glEnd();
 42 
 43     glBegin(GL_POLYGON);
 44     glVertex3i(0,    2,    0);
 45     glVertex3i(18,    -16,0);
 46     glVertex3i(13,    -21,0);
 47     glVertex3i(0,    -8,0);
 48     glEnd();
 49     
 50     glBegin(GL_POLYGON);
 51     glVertex3i(0,    2,    0);
 52     glVertex3i(-18,    -16,0);
 53     glVertex3i(-13,    -21,0);
 54     glVertex3i(0,    -8,0);
 55     glEnd();
 56 
 57     glPopMatrix();
 58 
 59     glutSwapBuffers();
 60 }
 61 
 62 void spinDisplay(void)
 63 {
 64     // change the params for displaying the squre
 65     fSpin += 0.05;
 66     if (fSpin > 360.0) {
 67         fSpin -= 360.0;
 68     }
 69     glutPostRedisplay();    
 70 }
 71 
 72 void reshape(int w, int h)
 73 {
 74     glViewport(00, (GLsizei) w, (GLsizei) h);
 75     glMatrixMode(GL_PROJECTION);
 76     glLoadIdentity();
 77     glOrtho(-50.050.0-50.050.0-1.01.0);
 78     glMatrixMode(GL_MODELVIEW);
 79     glLoadIdentity();
 80 }
 81 
 82 void mouse(int button, int state, int x, int y)
 83 {
 84     switch(button) {
 85         case GLUT_LEFT_BUTTON:
 86             // start or stop the rotating square
 87             if (state == GLUT_DOWN && !bRotating) {
 88                 bRotating = true;
 89                 glutIdleFunc(&spinDisplay);
 90             }
 91             else if (state == GLUT_DOWN && bRotating) {
 92                 bRotating = false;
 93                 glutIdleFunc(NULL);
 94                 if ((GLint)(fSpin+0.5)%90 == 0) {
 95                     fClearBlue = 1.0 - fClearBlue;
 96                     glClearColor(0.00.0, fClearBlue, 0.0);
 97                 }
 98             }
 99             break;
100         case GLUT_RIGHT_BUTTON:
101             break;
102         default:
103             break;
104     }
105 }
106 
107 void init(void)
108 {
109     // select the clearing color
110     glClearColor(0.00.0, fClearBlue, 0.0);
111 
112     glShadeModel(GL_FLAT);
113 }
114 
115 void idle(void)
116 {
117     if (glutGetWindow() == 0) {
118         exit(0);
119     }
120 }
121 
122 /*
123  * Declare display mode, window size, position, 
124  * open a window titled,
125  * call init routines,
126  * register display, reshape, mouse callback function
127  * enter main loop
128  */
129 int main( int argc, char * argv[] )
130 {
131     glutInit(&argc, argv);
132 
133     // GLUT_DOUBLE - double buffer
134     glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
135     glutInitWindowPosition(100100);
136     glutInitWindowSize(400400);
137     glutCreateWindow("DoNeY's first OpenGL app");
138 
139     init();
140 
141     glutDisplayFunc(&display);
142     glutReshapeFunc(&reshape);
143     glutMouseFunc(&mouse);
144     glutIdleFunc(&idle);
145     
146     glutMainLoop();
147     return 0;
148 }
149 



posted @ 2010-01-31 14:22 DoNeY 阅读(271) | 评论 (0)编辑 收藏

2010年1月27日 #

sample OpenGL project in VS2008


 1  1 
 2  2 #include "GL\glut.h"
 3  3 
 4  4 void Render()
 5  5 {
 6  6     glClearColor(0.00.00.30.0);
 7  7     glClear(GL_COLOR_BUFFER_BIT);
 8  8     glColor3f(1.00.50.5);
 9  9     glOrtho(0.01.00.01.0-1.01.0);
10 10     glBegin(GL_POLYGON);
11 11     {
12 12         glVertex3f(0.50.750.0);
13 13         glVertex3f(0.80.250.0);
14 14         glVertex3f(0.20.250.0);
15 15     }
16 16     glEnd();
17 17 
18 18     //glRectf(-0.5f,-0.5f,0.5f,0.5f);
19 19 
20 20     glFlush();
21 21 }
22 22 
23 23 int main( int argc, char * argv[] )
24 24 {
25 25     glutInit(&argc, argv);
26 26     glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);
27 27     glutInitWindowPosition(100100);
28 28     glutInitWindowSize(400400);
29 29     glutCreateWindow("DoNeY's first OpenGL app");
30 30     glutDisplayFunc(&Render);
31 31     glutMainLoop();
32 32     return 0;
33 33 }
34 34 
35 

posted @ 2010-01-27 14:25 DoNeY 阅读(408) | 评论 (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 阅读(165) | 评论 (0)编辑 收藏

2009年10月19日 #

WowDLLChecker_20091208_1.0.2.4

     摘要: WowDLLChecker (c) Ouditian [rev.20091208] ver 1.0.2.4 for CWOW 3.1.3
Put this checker into your World of Warcraft directoy and execute it to check dangerous DLLs.


WowDLLChecker.exe  阅读全文

posted @ 2009-10-19 13:56 DoNeY 阅读(235) | 评论 (0)编辑 收藏

2009年10月16日 #

Where is Form's Loaded event? [FW]

Where is Form's Loaded event?

[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:


 1 protected override void OnLoad(EventArgs args)
 2 {
 3     base.OnLoad(args);
 4 
 5     Application.Idle += new EventHandler(OnLoaded);
 6 }
 7 
 8 private void OnLoaded(object sender,
 9                       EventArgs args)
10 {
11     Application.Idle -= new EventHandler(OnLoaded);
12 
13     // TODO: add relevant code here
14 }
15 

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 阅读(273) | 评论 (0)编辑 收藏

2009年10月14日 #

[share] 我的针对批处理文件bat,cmd的UltraEdit语法高亮wordfile



  1 
  2 /L18"BAT_FILE" BAT_FILE_LANG Line Comment = rem Block Comment On = /* Block Comment Off = */ Escape Char = \ String Chars = " File Extensions = bat cmd
  3 /Delimiters = ~!@^&*()-+=|/\{}[]:;"`'<> ,    .?
  4 /Function String = "call"
  5 /Function String 1 = "start"
  6 /Function String 2 = "%:"
  7 /Variable String = "^%[1-9a-zA-Z]++[12345^%]"
  8 /Indent Strings = "(" "if" "else"
  9 /Unindent Strings = ")"
 10 /Open Brace Strings =  "{" "(" "%"
 11 /Close Brace Strings = "}" ")" "%"
 12 /Open Fold Strings = "("
 13 /Close Fold Strings = ")"
 14 /C1"Keywords" STYLE_KEYWORD
 15 assoc    
 16 at       
 17 attrib   
 18 break    
 19 cacls    
 20 call     
 21 cd       
 22 chcp     
 23 chdir    
 24 chkdsk   
 25 chkntfs  
 26 cls      
 27 cmd      
 28 color    
 29 comp     
 30 compact  
 31 convert  
 32 copy     
 33 date     
 34 del      
 35 dir      
 36 diskcomp 
 37 diskcopy 
 38 doskey   
 39 echo     
 40 endlocal 
 41 erase    
 42 exit     
 43 fc       
 44 find     
 45 findstr  
 46 for      
 47 format   
 48 ftype    
 49 goto     
 50 graftabl 
 51 help     
 52 if       
 53 label    
 54 md       
 55 mkdir    
 56 mode     
 57 more     
 58 move     
 59 path     
 60 pause    
 61 popd     
 62 print    
 63 prompt   
 64 pushd    
 65 rd       
 66 recover  
 67 rem      
 68 ren      
 69 rename   
 70 replace  
 71 rmdir    
 72 set      
 73 setlocal 
 74 shift    
 75 sort     
 76 start    
 77 subst    
 78 time     
 79 title    
 80 tree     
 81 type     
 82 ver      
 83 verify   
 84 vol      
 85 xcopy    
 86 /C2"C++ Keywords" STYLE_KEYWORD
 87 /C3"Microsoft C extensions" STYLE_EXTENSION
 88 @
 89 %
 90 (
 91 )
 92 /C5"COLOR5" STYLE_COLOR5
 93 !
 94 %
 95 &
 96 *
 97 +
 98 -
 99 // /
100 <
101 = ==
102 >
103 ^
104 |
105 ~
106 /C6"COLOR6" STYLE_COLOR6
107 /C7"Variables"
108 ** % x%
109 /C8"Constant/Global/Symbol"
110 ** WII DEB FIN REL

posted @ 2009-10-14 11:14 DoNeY 阅读(1509) | 评论 (0)编辑 收藏

2009年10月13日 #

UltraEdit 与Unix 正则表达式

     摘要: UltraEdit 允许在搜索菜单下面列出了的许多搜索和替换功能中使用正则表达式。正则表达式能让更多的复杂的搜索和替换功能变成简单的操作。(中文版界面上显示为“正规表达式”) 有两个可使用的语法集合。下面的第一表显示出在 UltraEdit 的更早的版本被使用的原来的 UltraEdit 句法。第二表给出了可选的"Unix"类型的正则表达式。这可以从配置单元启用。 &n...  阅读全文

posted @ 2009-10-13 18:36 DoNeY 阅读(1697) | 评论 (0)编辑 收藏

2009年2月26日 #

ruby操作excel文件

使用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.SaveAs '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.saveas('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 阅读(2850) | 评论 (0)编辑 收藏

2009年2月24日 #

qsort

 1 #include "stdafx.h"
 2 
 3 #include "stdlib.h"
 4 #include "string.h"
 5 #include "stdio.h"
 6 
 7 int cmp_i(const void *a, const void *b)
 8 {
 9     int res = *(int *)a - *(int *)b;
10     return res;
11 }
12 int cmp_s(const void *a, const void *b)
13 {
14     int res = strcmp((char *)a, (char *)b);
15     return res;
16 }
17 
18 int main()
19 {
20     int values[] = {3,3546,6134,1,234,12435,51,3,4,32,3241,34514,5};
21     char strs[][15= {"32","66","6134","1","234","12435","51","3","4","32","3241","34514","5"};
22 
23     printf("-------------------\nQsort int\n");
24     for(int i=0;i<10;i++)
25     {
26         printf("%d\t",values[i]);
27     }
28     printf("\n");
29     qsort(values, 10sizeof(int), cmp_i);
30     for(int i=0;i<10;i++)
31     {
32         printf("%d\t",values[i]);
33     }
34     printf("\n");
35     
36     printf("-------------------\nQsort str\n");
37     for(int i=0;i<10;i++)
38     {
39         printf("%s\t",strs[i]);
40     }
41     printf("\n");
42     qsort(strs, 10sizeof(char)*15, cmp_s);
43     for(int i=0;i<10;i++)
44     {
45         printf("%s\t",strs[i]);
46     }
47 
48 }
49 

posted @ 2009-02-24 15:58 DoNeY 阅读(207) | 评论 (0)编辑 收藏

2008年12月31日 #

游戏开发学习过程(连载中...)(转自 威尔弗的空间)

转自 : http://hi.baidu.com/welflau/blog/item/1b17032320bb05499358075e.html

http://hi.baidu.com/welflau/希望能保留原创作者链接,谢谢!

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 = 0.5f ;

       //肅︹

       v[0].diffuse = v[1].diffuse = v[2].diffuse = v[3].diffuse = diffuse ;

       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 ));

}

添加以下几句:

       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 阅读(409) | 评论 (0)编辑 收藏

JavaScript 仿LightBox内容显示效果、拖放效果和渐变效果

JavaScript 仿LightBox内容显示效果

详解定位与定位应用

拖放效果渐变效果

posted @ 2008-12-31 17:59 DoNeY 阅读(267) | 评论 (0)编辑 收藏

CString,int,string,char*之间的转换(转)

转自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 阅读(226) | 评论 (0)编辑 收藏

2008年10月21日 #

[FW] 在UltraEdit里正确显示Lua的块注释(语法着色)

 

Origin Link http://blog.2ndboy.net/?p=116#comment-3104
Thanks to 2ndboy


在 UltraEdit 里正确显示 Lua 的块注释(DoNeY注:语法着色问题)

  我算得上是 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 的语法文件第一行改成如下这个样子就可以啦:

 

/L12″Lua” Block Comment On = --[[ Block Comment Off = ]] Block Comment On Alt = -- Escape Char = \ String Chars = “‘ File Extensions = 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 阅读(3380) | 评论 (0)编辑 收藏

Making Draggable Frames 【为wow插件编写可拖动的Frame】


FW: http://www.wowwiki.com/Making_Draggable_Frames

XML Declarations

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:


<Frame name="TellTrackFrame" enableMouse="true" movable="true" resizable="true" parent="UIParent" hidden="true">

Simple Dragging

One simple way to detect drag is to add OnDragStart and OnDragStop script elements to the frame:
<Scripts>
<OnLoad>
 this:RegisterForDrag("LeftButton");
</OnLoad>
<OnDragStart>
 this:StartMoving();
 this.isMoving = true;
</OnDragStart>
<OnDragStop>
 this:StopMovingOrSizing();
 this.isMoving = false;
</OnDragStop>
</Scripts>

Advanced Dragging

Another way, which is more responsive but requires an onhide element so that the frame wont get stuck to the mouse:
<Scripts>
<OnMouseUp>
 if ( this.isMoving ) then
  this:StopMovingOrSizing();
  this.isMoving = false;
 end
</OnMouseUp>
<OnMouseDown>
 if ( ( ( not this.isLocked ) or ( this.isLocked == 0 ) ) and ( arg1 == "LeftButton" ) ) then
  this:StartMoving();
  this.isMoving = true;
 end
</OnMouseDown>
<OnHide>
 if ( this.isMoving ) then
  this:StopMovingOrSizing();
  this.isMoving = false;
 end
</OnHide>
</Scripts>

Note: this method also demonstrates an optional isLocked parameter to determine whether you can drag the frame or not.

Parent Dragging

Some advanced dragging addons use overlays that make default Blizzard frames draggable. This is possible by using GetParent when starting and stopping drag. To do this, one must make the parent frame movable through the use of the SetMovable widget function, i.e. frame:SetMovable(true). One drawback with overlay frames that are mouse enabled is that they will prevent the parent frame's click script tags from being called so you often have to simulate their click events.

Quick Dragging Code

While somewhat untested there is an easier and more automatic way to activate dragging. If you have your <Frame> delcaration attributes "enableMouse" and "movable" set to true, dragging may be accomplished by adding a <TitleRegion> tag inside of your <Frame>
<Frame name="myname" frameStrata="HIGH" toplevel="true" enableMouse="true" movable="true" parent="UIParent">
 
<TitleRegion setAllPoints="true"/>
 
</Frame>

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.

<Frame name="myname" frameStrata="HIGH" toplevel="true" enableMouse="true" movable="true" parent="UIParent">
 
<TitleRegion>
  
<Size>
   
<AbsDimension x="200" y="20"/>
  
</Size>
  
<Anchors>
   
<Anchor point="TOP"/>
  
</Anchors>
 
</TitleRegion>
 
</Frame>

This way, your <Frame> can still receive mouse events, and you can only drag it by clicking within its <TitleRegion>.

Lua Only Approach

If your frame is called MyFrame -
MyFrame:SetMovable(true)
MyFrame
:EnableMouse(true)
MyFrame
:SetScript("OnMouseDown",function()
  MyFrame
:StartMoving()
end)
MyFrame
:SetScript("OnMouseUp",function()
  MyFrame
:StopMovingOrSizing()
end)








posted @ 2008-10-21 16:11 DoNeY 阅读(711) | 评论 (0)编辑 收藏

仅列出标题  
  doneykoo blogjava