- 界面漂亮,至少支持Office那种的界面
- 支持自己的多个Blog帐户,可以快速切换,可以同时发布到好几个帐户上。
- 能从服务器端拿到分类。
- 支持插件,常用站点插件能自动下载。主要为了适应dudu这种能天天增加功能的站长。
- 支持非英语语言和不同的编码,实现多语言界面。
- 支持在线更新,好多Blog站点的接口也可以更新
- 支持模板
- 支持Comments和自动恢复
- 尽可能多的把Web上的操作拿到本地来作(比如修改参数什么的)
- 要在IE上出现BlogIt的Button,支持从IE中抓东西,自动放到模板里。
- 支持已经发布的Blog记录
- 如果可能,利用Mono实现Linux版本,包括图形和command line界面
- 实现本地文件直接变成Blog.比如,鼠标右键点击文件,出现“blog this file'的菜单,点击就blog
- 支持Blog备份和搬家的功能。比如你的这个blog服务商不怎么着,你想搬到博客园来,就不用一点一点的拷贝了。
- 添加到IE右键菜单中,点右键Blog this page.
写这个东西,主要是因为多数客户端都是老外写的,不符合我们中国人的习惯。欢迎鲜花或者鸡蛋,排砖也无妨。
1, PInvoke什么意思? Platform Invocation Services
2, 干什么用? 导入外部函数?什么是外部函数,就是不属于.Net托管的函数。
3,如何用?看下面的例子。用[DllImport(dllname)]来实现,但是首先要把System.Runtiime.InteropServices using进来。但是不using也行,就要敲全称,随你便了。
[DllImport("user32.dll")]
static extern int MessageBoxA(int hWnd,
string msg,
string caption,
int type );
private void button1_Click(object sender, System.EventArgs e)
{
MessageBoxA( 0, "Msg:hello", "Caption:Hello",0 );
}
4,万一我的程序中已经有了一个函数叫MessageBoxA怎么办?这时候,可以使用EntryPoint来帮忙,下面的例子中,你把自己的函数定义为MyMsg.
[DllImport("user32.dll",EntryPoint="MessageBoxA")]
static extern int MyMsg(int hWnd,
string msg,
string caption,
int type );
private void button1_Click(object sender, System.EventArgs e)
{
MyMsg( 0, "Msg:hello", "Caption:Hello",0 );
}
5,charset如何使用?****A的是Ansi编码,****W的是unicode编码,如何使用charset,看你的函数调用而定。2K以后都用unicode了,前面的9x都是ansi编码,但是这是缺省的,微软给9x打布丁支持unicode不算。
API有两个版本: A(ASNI)版本和W(Unicode)版本. A版本调用时候会用ANSI来封送字符串,一般是win95/98上。W版本用Unicode来封送,在NT,2K和XP上。
.Net和win32交互的时候,默认是使用CharSet.Ansi来传送。
在
当 ExactSpelling 字段为 false(它是 C++ 托管扩展和 C# 中的默认值),平台调用将首先搜索未处理的别名 (MessageBox),如果没有找到未处理的别名,则将搜索已处理的名称 (MessageBoxA)。请注意,ANSI 名称匹配行为与 Unicode 名称匹配行为不同。
//CharSet.Ansi will call MessageBoxA
//CharSet.Unicode will call MessageBoxW
[DllImport("user32.dll",EntryPoint="MessageBox",CharSet=CharSet.Ansi)]
static extern int MyMsg(int hWnd,
string msg,
string caption,
int type );
private void button1_Click(object sender, System.EventArgs e)
{
MyMsg( 0, "Msg:hello", "Caption:Hello",0 );
}
6,Dll里面的callback函数如何实现?看下面这个例子:
delegate bool CallBackDef( int hWnd, int lParm );
[DllImport("user32.dll")]
static extern int GetWindowText( int hWnd,
StringBuilder text,
int count );
[DllImport("user32.dll")]
static extern int EnumWindows(CallBackDef callback, int lParam );
static bool PrintWindow(int hWnd, int lParm )
{
StringBuilder text = new StringBuilder(255);
GetWindowText( hWnd, text, 255 );
Console.WriteLine( text.ToString() );
return true;
}
private void button1_Click(object sender, System.EventArgs e)
{
CallBackDef callBack = new CallBackDef( PrintWindow );
EnumWindows( callBack, 0 );
}
7,MarshalAs如何用,什么时候用?
在MessageBox传递string去Dll的时,C#编译器知道Win32LPSTR等价与一个C#字符串。但是如果想覆盖默认.Net行为, 这时候就需要MarshallAs
[DllImport("user32.dll", CharSet=CharSet.Unicode )]
static extern int MessageBox( int hWnd,
[MarshalAs(UnmanagedType.LPWStr)]
string msg,
[MarshalAs(UnmanagedType.LPWStr)]
string caption,
int type);
8,我怎么知道要调用的函数在那个dll了?
这个问题我不会比你更清楚,特殊的函数应该在你特殊的dll中。Win32中常用的几个dll是user32.dll, kernel32.dll和GDI32.dll.用dumpbin -exports kernel32.dll可以看到这个dll所有的API函数。
9,相互之间传递struct怎么办?我是说传递很复杂的struct?
传递一个结构,这个要用到StructLayoutAttribute属性。比如:
PtInRect 具有以下非托管签名:
BOOL PtInRect(const RECT *lprc, POINT pt);
请注意,由于函数需要指向 RECT 类型的指针,必须通过引用来传递 Rect 结构。
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential)]
public struct Point
{
public int x;
public int y;
}
[StructLayout(LayoutKind.Explicit)]
public struct Rect
{
[FieldOffset(0)] public int left;
[FieldOffset(4)] public int top;
[FieldOffset(8)] public int right;
[FieldOffset(12)] public int bottom;
}
class Win32API
{
[DllImport("User32.dll")]
public static extern bool PtInRect(ref Rect r, Point p);
}
10,哪里有不错的教程,我可以学到更详细的东西?
google一下多的是。MSDN里面也有一些不错的教程:(vs.net 2003)
11,最后,这位大哥,你说了很多,我想问一个对我来说最关键的问题,我看了你的东西,似是而非,不会用怎么办?
这位兄弟勇气可嘉,我给你准备了一个站点。这里有一个PInvoke的Add-In tools for Visual Studio.Net,几乎所有的Win32 API都有。安装了以后,基本不用自己写了。
安装的主要目的是经常带着笔记本跑来跑去,调试不方便,不如安装一个windows版本的,盼望功能上不会有大的区别。