2006年10月25日星期三
2006年9月27日星期三
2006年9月14日星期四
My Emacs config file
(create-fontset-from-fontset-spec
"-misc-fixed-medium-r-*-*-16-*-*-*-c-*-fontset-global,
chinese-gb2312:-*-*-medium-r-normal-*-16-*-*-*-*-*-gb2312.1980-*")
;(setq default-frame-alist
; (append '((font . "fontset-global")) default-frame-alist))
(set-language-environment 'Chinese-GB)
(set-keyboard-coding-system 'euc-cn)
(set-clipboard-coding-system 'euc-cn)
(set-terminal-coding-system 'euc-cn)
(set-buffer-file-coding-system 'euc-cn)
(set-selection-coding-system 'euc-cn)
(prefer-coding-system 'euc-cn)
(setq default-process-coding-system 'euc-cn)
(setq-default pathname-coding-system 'euc-cn)
;; 改变 Emacs 固执的要你回答 yes 的行为。按 y 或空格键表示 yes,n 表示 no。
(fset 'yes-or-no-p 'y-or-n-p)
;;高亮显示要拷贝的区域
(transient-mark-mode t)
;;显示匹配的括号
(show-paren-mode t)
;;显示大文件时加快速度
(setq lazy-lock-defer-on-scrolling t)
(setq font-lock-support-mode 'lazy-lock-mode)
(setq font-lock-maximum-decoration t)
;;不要生成临时文件
(setq-default make-backup-files nil)
;;使用shift + -> 或<- 选取内容
(pc-selection-mode t)
(add-hook 'c-mode-hook 'linux-c-mode)
(add-hook 'c++-mode-hook 'linux-cpp-mode)
;; 设置imenu的排序方式为按名称排序
(setq imenu-sort-function 'imenu--sort-by-name)
(defun linux-c-mode()
;; 将回车代替C-j的功能,换行的同时对齐
(define-key c-mode-map [return] 'newline-and-indent)
(interactive)
;; 设置C程序的对齐风格
(c-set-style "K&R")
;; 自动模式,在此种模式下当你键入{时,会自动根据你设置的对齐风格对齐
(c-toggle-auto-state)
;; 此模式下,当按Backspace时会删除最多的空格
(c-toggle-hungry-state)
;; TAB键的宽度设置为4
(setq c-basic-offset 4)
;; 在菜单中加入当前Buffer的函数索引
(imenu-add-menubar-index)
;; 在状态条上显示当前光标在哪个函数体内部
(which-function-mode)
)
(defun linux-cpp-mode()
(define-key c++-mode-map [return] 'newline-and-indent)
(define-key c++-mode-map [(control c) (c)] 'compile)
(interactive)
(c-set-style "K&R")
(c-toggle-auto-state)
(c-toggle-hungry-state)
(setq c-basic-offset 8)
(imenu-add-menubar-index)
(which-function-mode)
)
;;不用 TAB 字符来indent, 这会引起很多奇怪的错误。编辑 Makefile 的时候也不用
;;担心,因为 makefile-mode 会把 TAB 键设置成真正的 TAB 字符,并且加亮显示的
(setq-default indent-tabs-mode nil)
(setq default-tab-width 8)
(setq tab-stop-list ())
;(loop for x downfrom 40 to 1 do
; (setq tab-stop-list (cons (* x 4) tab-stop-list)))
;;把这些缺省禁用的功能打开
(put 'set-goal-column 'disabled nil)
(put 'narrow-to-region 'disabled nil)
(put 'upcase-region 'disabled nil)
(put 'downcase-region 'disabled nil)
(put 'LaTeX-hide-environment 'disabled nil)
;;-------------------------让Emacs拥有tabs-------------------
;;http://learn.tsinghua.edu.cn/homepage/2001315450/emacs_elisp.html
;;到上面的网页下载tabbar.el 保存到/usr/share/emacs/site-lisp/
(require 'tabbar)
(tabbar-mode)
(define-prefix-command 'lwindow-map)
;;(global-set-key (kbd "") 'lwindow-map)
(global-set-key (kbd "") 'tabbar-backward-group)
(global-set-key (kbd "") 'tabbar-forward-group)
(global-set-key (kbd "") 'tabbar-backward)
(global-set-key (kbd "") 'tabbar-forward)
;;使用Win+方向键在tabbed buffer之间切换
;;调整tab的配色
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(tabbar-selected-face ((t (:inherit tabbar-default-face :background "#F0F0E8" :foreground "black" :box (:line-width 2 :color "white" :style released-button) :weight semi-bold :height 1.3))))
'(tabbar-unselected-face ((t (:inherit tabbar-default-face :background "grey" :foreground "black" :box (:line-width 2 :color "grey" :style pressed-button) :height 1.3)))))
;;;;;;;;;; global setting
;;(set-scroll-bar-mode nil) ;; 去掉滚动条
;;(tool-bar-mode -1) ;; 去掉工具栏
(setq require-final-newline t) ;; 以空行结束
(add-to-list 'load-path (expand-file-name "F:/emacs/site-lisp/")) ;; set load-path
(setq visible-bell t) ;; 关闭出错时的提示声
(setq inhibit-startup-message t) ;;关闭开启画面
(setq column-number-mode t) ;; 显示列号
(setq mouse-yank-at-point t) ;; 用光标定位文本插入位置
(setq kill-ring-max 200) ;; 设置粘贴缓冲条目数量
(setq enable-recursive-minibuffers t) ;; 设置递归使用minibuffer
;;(setq scroll-margin 3
;; scroll-conservatively 10000) ;;防止页面滚动时跳动
(setq default-major-mode 'text-mode) ;;设置默认模式是text mode
(show-paren-mode t)
(setq show-paren-style 'parentheses) ;; 设置显示括号匹配,但不跳转
(mouse-avoidance-mode 'animate) ;;让鼠标不要挡住光标
(setq user-full-name "kpld")
(setq user-mail-address "kpld@hotmail.com")
(setq frame-title-format "emacs@%b") ;;在标题栏显示buffer的名字,而不是 emacs@wangyin.com 这样没用 的提示。
(global-font-lock-mode t) ;; 进行语法加亮
(setq next-line-add-newlines nil
resize-mini-windows t
track-eol t
kill-whole-line t
Man-notify-method 'pushy
woman-cache-level 2
woman-cache-filename nil
uniquify-buffer-name-style 'forward
vc-follow-symlinks t
line-move-ignore-invisible t
ring-bell-function 'ignore
tooltip-gud-tips-p t)
;;让emacs在windows上启动时最大化
;;修改注册表如下
;;[HKEY_LOCAL_MACHINE\SOFTWARE\GNU\Emacs]
;;"EMACS.Toolbar"="0"
(w32-send-sys-command #xf030)
;(defun w32-restore-frame ()
;"Restore a minimized frame"
;(interactive)
;(w32-send-sys-command 61728))
;(defun w32-maximize-frame ()
;"Maximize the current frame"
;(interactive)
;(w32-send-sys-command 61488))
;(w32-maximize-frame)
;; 设置备份版本控制 start
(setq version-control t
kept-old-versions 2
kept-new-versions 5
delete-old-versions t
backup-directory-alist
'(("." . "D:/tmp")
(cons tramp-file-name-regexp nil))
backup-by-copying t
backup-by-copying-when-linked t
backup-by-copying-when-mismatch t)
(setq dired-kept-versions 1)
;; 设置备份版本控制 end
(setq dired-recursive-copies 'top) ;;让dired可以递归地拷贝和删除目录
(setq dired-recursive-deletes 'top) ;;
;; 设置显示时间
(display-time-mode 1)
(setq display-time-24hr-format t)
(setq display-time-day-and-date t)
;;;;;;;;; 设置界面 start
(set-cursor-color "Wheat")
(set-mouse-color "Wheat")
(set-foreground-color "Wheat")
(set-background-color "DarkSlateGray")
;(if window-system
; (setq default-frame-alist
; (append
; '( (top . 80)
; (left . 100)
; (width . 110)
; (height . 35))
; default-frame-alist))
;)
;;;;;;;;; 设置界面 end
;;;;; Esay Edit for C++/C programming
;; TAB and RET auto align and indent
(add-hook 'c++-mode-hook
(lambda ()
(c-set-style "bsd")
(hs-minor-mode)
(local-set-key "\C-c\t" 'complete-symbol)
(local-set-key "\C-m" 'newline-and-indent)
(setq mslk-c++-key (make-keymap))
(local-set-key "\C-j" mslk-c++-key)
(define-key mslk-c++-key "\C-j" 'complete-symbol)
(define-key mslk-c++-key "\C-o" 'hs-hide-all)
(define-key mslk-c++-key "\C-p" 'hs-show-all)
(define-key mslk-c++-key "\C-h" 'hs-hide-block)
(define-key mslk-c++-key "\C-u" 'hs-show-block)
(define-key mslk-c++-key "\C-l" 'hs-hide-level)
(define-key mslk-c++-key "\C-m" 'hs-toggle-hiding)
))
(add-hook 'c-mode-hook 'c++-mode)
(defun my-indent-or-complete ()
(interactive)
(if (looking-at "\\>")
(hippie-expand nil)
(indent-for-tab-command)))
(add-hook 'c-mode-common-hook
(function (lambda ()
(define-key c-mode-base-map [(tab)] 'my-indent-or-complete)
(define-key c-mode-base-map [(control m)] 'align-newline-and-indent)
(c-toggle-auto-state))))
;;;;;;;;;;;;;;;; 调用Lisp扩展包
;;;;;;;; load ido.el
(require 'ido)
(ido-mode t)
(autoload 'table-insert "table" "WYGIWYS table editor") ;;所见即所得做表格
(require 'recentf) ;; 保存最近打开的文件
(recentf-mode 1)
(defun recentf-open-files-compl ()
(interactive)
(let* ((all-files recentf-list)
(tocpl (mapcar (function
(lambda (x) (cons (file-name-nondirectory x) x))) all-files))
(prompt (append '("File name: ") tocpl))
(fname (completing-read (car prompt) (cdr prompt) nil nil)))
(find-file (cdr (assoc-ignore-representation fname tocpl)))))
(global-set-key [(control x)(control r)] 'recentf-open-files-compl)
;;;;;;;;;;; global key setting
(global-set-key [home] 'beginning-of-buffer)
(global-set-key [end] 'end-of-buffer)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(blink-cursor-mode nil nil (frame))
'(column-number-mode t)
'(cua-mode nil)
'(global-font-lock-mode t nil (font-core))
'(show-paren-mode t nil (paren)))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 在EMACS中浏览WEB网页并支持中文 ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; (require 'w3m-load)
; (setq w3m-display-inline-image t)
; (setq w3m-use-mule-ucs t)
; (setq w3m-use-toolbar t)
; (setq w3m-use-cookies t)
; (setq w3m-bookmark-file-coding-system 'chinese-iso-8bit)
; (setq w3m-coding-system 'chinese-iso-8bit)
; (setq w3m-default-coding-system 'chinese-iso-8bit)
; (setq w3m-file-coding-system 'chinese-iso-8bit)
; (setq w3m-file-name-coding-system 'chinese-iso-8bit)
; (setq w3m-terminal-coding-system 'chinese-iso-8bit)
; (setq w3m-input-coding-system 'chinese-iso-8bit)
; (setq w3m-output-coding-system 'chinese-iso-8bit)
; (setq w3m-tab-width 8)
; (setq w3m-home-page "http://www.gun.org")
; (setq w3m-view-this-url-new-session-in-background t)
; (add-hook 'w3m-fontify-after-hook 'remove-w3m-output-garbages)
; (defun remove-w3m-output-garbages()
; (interactive)
; (let ((buffer-read-only))
; (setf (point) (point-min))
; (while (re-search-forward "[\200-\240]" nil t)
; (replace-match " "))
; (set-buffer-multibyte t))
; (set-buffer-modified-p nil))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; End of configure W3M in Emacs ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Begin of configure Gnus in Emacs ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Gnus 是个古老的,强大的邮件,新闻阅读lisp程序.
;;设置头像文件可惜我一直没搞定
;(setq message-required-news-headers
; (nconc message-required-news-headers
; (list '(X-Face . gnus-random-x-face))))
;;用户资料设定
;(setq user-full-name "kpld")
;(setq user-mail-address "kpld@222.com")
;;服务器的设定
;(setq gnus-select-method '(nntp "news.yaako.com"))
;(add-to-list 'gnus-secondary-select-methods '(nntp "news.newsfan.net"))
;(add-to-list 'gnus-secondary-select-methods '(nntp "news.php.net"))
;(add-to-list 'gnus-secondary-select-methods '(nntp "news.newsgroup.com.hk"))
;(add-to-list 'gnus-secondary-select-methods '(nntp "news.CN99.com"))
;(add-to-list 'gnus-secondary-select-methods '(nntp "groups.google.com"))
;;开启代理功能,为了能让gnus支持离线浏览,gnus 5.10.x会自动开启该功能。
;(gnus-agentize)
;;自动换行功能。
;(add-hook 'message-mode-hook
; (lambda ()
; (setq fill-column 72);;这里的72是等一行到了72个字符后开始换行
; (turn-on-auto-fill)))
;(setq message-cite-function 'message-cite-original-without-signature)
;; 设定帖子的字符集
;(setq gnus-summary-show-article-charset-alist '((1 . cn-gb-2312) (2 . big5)))
;(setq gnus-default-charset 'cn-gb-2312) ;; 默认编码
;(setq gnus-group-name-charset-group-alist '((".*" . cn-gb-2312))) ;; 组名编码
;(setq gnus-summary-show-article-charset-alist '((1 . cn-gb-2312) (2 . big5))) ;; 刷新编码
;(setq gnus-newsgroup-ignored-charsets '(unknown-8bit x-unknown iso-8859-1)) ;; 忽略编码
;; 改变阅读新闻时窗口的布局,窗口划分为上4下6(比例)
;(gnus-add-configuration '(article
; (vertical 1.0
; (summary .4 point)
; (article 1.0))))
;;开启记分
;(setq gnus-use-adaptive-scoring t)
;(setq gnus-save-score t)
;(add-hook 'mail-citation-hook 'sc-cite-original)
;(add-hook 'message-sent-hook 'gnus-score-followup-article)
;(add-hook 'message-sent-hook 'gnus-score-followup-thread)
;(defvar gnus-default-adaptive-score-alist
; '((gnus-kill-file-mark (from -10))
; (gnus-unread-mark)
; (gnus-read-mark (from 10) (subjnnect 30))
; (gnus-catchup-mark (subject -10))
; (gnus-killed-mark (from -1) (subject -30))
; (gnus-del-mark (from -2) (subject -15))
; (gnus-ticked-mark (from 10))
; (gnus-dormant-mark (from 5))))
;(setq gnus-score-find-score-files-function
; '(gnus-score-find-hierarchical gnus-score-find-bnews bbdb/gnus-score)
; gnus-use-adaptive-scoring t)
;;;
;(setq gnus-confirm-mail-reply-to-news t
; message-kill-buffer-on-exit t
; message-elide-ellipsis "[...]\n"
; )
;;排序
;(setq gnus-thread-sort-functions
; '(
; (not gnus-thread-sort-by-date)
; (not gnus-thread-sort-by-number)
; ))
;; 新闻组分组
;; 有时订阅了很多新闻组,堆在一起不好管理。这个功能可以创建目录来分层管理
;; 这些新闻组。
;; group topic
;(add-hook 'gnus-group-mode-hook 'gnus-topic-mode)
;; 现在可以在group buffer里面M-x gnus-topic-create-topic来创建一个"topic",
;; 然后将某个新闻组或者其他topic给C-k掉,再移动到你创建的topic下C-y,就可以
;; 将它们收到这个topic下。
;; topic的好处除了分层之外,还有就是可以将不常看的topic折叠起来,不要显示。
;; 就像下面这样。
;;
;; [ Gnus -- 0 ]
;; [ MAIL -- 3 ]...
;; [ NEWS -- 0 ]
;; [ emacs -- 0 ]
;; *: nntp+binghe.6600.org: gnu.emacs.help
;; *: nntp+binghe.6600.org:gnu.emacs.gnus
;; [ 人文与社会 -- 0 ]
;; [ 语言 -- 0 ]
;; *: nntp+news.newsfan.net:教育就业.外语.日语
;; *: nntp+news.newsfan.net: 教育就业.外语.英语
;; [ misc -- 0 ]...
;;
;; 参考 gnus info -> Group Buffer -> Group Topics
;;中文设置
;(setq gnus-summary-show-article-charset-alist
; '((1 . cn-gb-2312) (2 . big5) (3 . gbk) (4 . utf-8)))
;(setq
; gnus-default-charset 'cn-gb-2312
; gnus-group-name-charset-group-alist '((".*" . cn-gb-2312))
; gnus-newsgroup-ignored-charsets
; '(unknown-8bit x-unknown iso-8859-1 ISO-8859-15 x-gbk GB18030 gbk DEFAULT_CHARSET))
;另外,有些用web方式发出的邮件里有html,加入下面的设置,只看其中的
;plain text部分:
;(eval-after-load "mm-decode"
; '(progn
; (add-to-list 'mm-discouraged-alternatives "text/html")
; (add-to-list 'mm-discouraged-alternatives "text/richtext")))
;;设置头像文件
;(setq gnus-posting-styles
; '((".*"
; (name "YouName")
; (face "")
;;这个我都是抄老外的,自己找去,在Gnus里看到好的头像,然后到
;;groups.google里把他的字符串贴过来 -_-!
; (address "YouEmail@gmail.com")
; (organization "www.emacs.cn")
; (signature "
; My name is K T")
; )
;))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; End of configure Gnus in Emacs ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;自动补全功能
(global-set-key [(meta ?/)] 'hippie-expand)
(setq hippie-expand-try-functions-list
'(try-expand-line
try-expand-line-all-buffers
try-expand-list
try-expand-list-all-buffers
try-expand-dabbrev
try-expand-dabbrev-visible
try-expand-dabbrev-all-buffers
try-expand-dabbrev-from-kill
try-complete-file-name
try-complete-file-name-partially
try-complete-lisp-symbol
try-complete-lisp-symbol-partially
try-expand-whole-kill))
;; 代码折叠
(load-library "hideshow")
(add-hook 'java-mode-hook 'hs-minor-mode)
(add-hook 'perl-mode-hook 'hs-minor-mode)
(add-hook 'php-mode-hook 'hs-minor-mode)
(add-hook 'emacs-lisp-mode-hook 'hs-minor-mode)
2006年8月26日星期六
Linux中库的生成与使用(转)
ln -s libhello.so.1.0 libhello.so.1
ln -s libhello.so.1 libhello.so
现在假设有一个叫hello的程序开发包,它提供一个静态库libhello.a 一个动态库libhello.so,一个头文件hello.h,头文件中提供sayhello()这个函数
/* hello.h */
void sayhello();
另外还有一些说明文档。这一个典型的程序开发包结构
1.与动态库连接
linux默认的就是与动态库连接,下面这段程序testlib.c使用hello库中的sayhello()函数
#include <stdio.h>
#include "hello.h"
{
sayhello();
return 0;
}
$gcc -c testlib.c -o testlib.o
用如下命令连接:
$gcc testlib.o -lhello -o testlib -L/usr/test -L./
在连接时要注意,假设libhello.o 和libhello.a都在缺省的库搜索路径下/usr/lib下,如果在其它位置要加上-L参数
与与静态库连接麻烦一些,主要是参数问题。还是上面的例子:
$gcc testlib.o -o testlib -WI,-Bstatic -lhello
注:这个特别的"-WI,-Bstatic"参数,实际上是传给了连接器ld.
指示它与静态库连接,如果系统中只有静态库当然就不需要这个参数了。
如果要和多个库相连接,而每个库的连接方式不一样,比如上面的程序既要和libhello进行静态连接,又要和libbye进行动态连接,其命令应为:
$gcc testlib.o -o testlib -WI,-Bstatic -lhello -WI,-Bdynamic -lbye
3.动态库的路径问题
为了让执行程序顺利找到动态库,有三种方法:
(1)把库拷贝到/usr/lib和/lib目录下。
(2)在LD_LIBRARY_PATH环境变量中加上库所在路径。例如动态库libhello.so在/home/ting/lib目录下,以bash为例,使用命令:
$export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/ting/lib
(3) 修改/etc/ld.so.conf文件,把库所在的路径加到文件末尾,并执行ldconfig刷新。这样,加入的目录下的所有库文件都可见、
有时候可能需要查看一个库中到底有哪些函数,nm命令可以打印出库中的涉及到的所有符号。库既可以是静态的也可以是动态的。nm列出的符号有很多,常见的有三种,一种是在库中被调用,但并没有在库中定义(表明需要其他库支持),用U表示;一种是库中定义的函数,用T表示,这是最常见的;另外一种是所谓的“弱态”符号,它们虽然在库中被定义,但是可能被其他库中的同名符号覆盖,用W表示。例如,假设开发者希望知道上央提到的hello库中是否定义了printf():
$nm libhello.so |grep printf
U printf
U表示符号printf被引用,但是并没有在函数内定义,由此可以推断,要正常使用hello库,必须有其它库支持,再使用ldd命令查看hello依赖于哪些库:
$ldd hello
libc.so.6=>/lib/libc.so.6(0x400la000)
/lib/ld-linux.so.2=>/lib/ld-linux.so.2 (0x40000000)
从上面的结果可以继续查看printf最终在哪里被定义,有兴趣可以go on
生成库
/* hello.c */
#include "hello.h"
void sayhello()
{
printf("hello,world\r\n");
}
用gcc编绎该文件,在编绎时可以使用任何全法的编绎参数,例如-g加入调试代码等:
$gcc -c hello.c -o hello.o
连接成静态库使用ar命令,其实ar是archive的意思
$ar cqs libhello.a hello.o
2.连接成动态库
生成动态库用gcc来完成,由于可能存在多个版本,因此通常指定版本号:
$gcc -shared -Wl,-soname,libhello.so.1 -o libhello.so.1.0 hello.o
另外再建立两个符号连接:
$ln -s libhello.so.1.0 libhello.so.1
$ln -s libhello.so.1 libhello.so
这样一个libhello的动态连接库就生成了。最重要的是传gcc -shared 参数使其生成是动态库而不是普通执行程序。
-Wl 表示后面的参数也就是-soname,libhello.so.1直接传给连接器ld进行处理。实际上,每一个库都有一个soname,当连接器发现它正在查找的程序库中有这样一个名称,连接器便会将soname嵌入连结中的二进制文件内,而不是它正在运行的实际文件名,在程序执行期间,程序会查找拥有soname名字的文件,而不是库的文件名,换句话说,soname是库的区分标志。
这样做的目的主要是允许系统中多个版本的库文件共存,习惯上在命名库文件的时候通常与soname相同
libxxxx.so.major.minor
其中,xxxx是库的名字,major是主版本号,minor 是次版本号
2006年8月14日星期一
2006年7月5日星期三
2006年4月25日星期二
2006年4月22日星期六
TransparentBlt的实现
int nXOriginDest,
int nYOriginDest,
int nWidthDest,
int nHeightDest,
HDC hdcSrc,
int nXOriginSrc,
int nYOriginSrc,
int nWidthSrc,
int nHeightSrc,
UINT crTransparent )
{
HDC hdcMem = CreateCompatibleDC( NULL );
if( hdcMem == NULL )
return false;
HBITMAP hBmp, hOldBmp;
hBmp = CreateCompatibleBitmap( hdcSrc, nWidthDest, nHeightDest );
if( hBmp == NULL )
return false;
hOldBmp = (HBITMAP)SelectObject( hdcMem, hBmp );
if( StretchBlt( hdcMem, 0, 0, nWidthDest, nHeightDest,
hdcSrc, nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc, SRCCOPY ) )
{
return false;
}
COLORREF crColor;
for( j=0; j<nHeightDest; j++ )
{
for( i=0; i<nWidthDest; i++ )
{
crColor= GetPixel( hdcMem, i, j );
if( crColor != crTransparent )
SetPixel( hdcDest, nXOriginDest+i, nYOriginDest+j, crColor );
}
}
DeleteObject( hBmp );
DeleteDC(hdcMem );
return true;
}
2006年3月7日星期二
打破封锁,技术无国界
au,*,801,http://optusnet.dl.sourceforge.net/
br,*,801,http://ufpr.dl.sourceforge.net/
ch,*,801,http://puzzle.dl.sourceforge.net/
ch,*,801,http://switch.dl.sourceforge.net/
de,*,801,http://mesh.dl.sourceforge.net/
fr,*,801,http://ovh.dl.sourceforge.net/
ie,*,801,http://heanet.dl.sourceforge.net/
jp,*,801,http://keihanna.dl.sourceforge.net/
jp,*,801,http://jaist.dl.sourceforge.net/
nl,*,801,http://surfnet.dl.sourceforge.net/
ru,*,801,http://citkit.dl.sourceforge.net/
ru,*,801,http://peterhost.dl.sourceforge.net/
uk,*,801,http://kent.dl.sourceforge.net/
us,*,801,http://internap.dl.sourceforge.net/
us,*,801,http://umn.dl.sourceforge.net/
us,*,801,http://easynews.dl.sourceforge.net/
tw,*,801,http://nchc.dl.sourceforge.net/