顯示具有 有用滴 標籤的文章。 顯示所有文章
顯示具有 有用滴 標籤的文章。 顯示所有文章

2009年3月31日 星期二

網頁開發除錯工具

記得曾經找過網頁開發工具,除錯的部分都用firefox的控制台,之前就夠用了但現在網站越來越大條了,發現用IE跑的話,有些問題出現,甚至跑不動,重新找了一遍除錯工具

適用 FireFox -- Firebug 1.3.3

適用 IE --(IEDevToolBarSetup.msi)
微軟官方抓下來忘了留網址,自己找吧!

2009年3月24日 星期二

SKYPE API

Skype4COM reference

https://developer.skype.com/Docs/Skype4COM

Examples

https://developer.skype.com/Docs/Examples#head-3ff2bc7e3da15010b5c305b7604c85275f971b60

CLASS ref

https://developer.skype.com/Docs/Skype4COMLib

Skype4COMLib Version History

https://developer.skype.com/Docs/Skype4COMLib/VersionHistory

2009年3月14日 星期六

開啟關閉 windows mobile WIFI

1.
[DllImport("coredll.dll")]
public static extern int DevicePowerNotify(string device, CEDEVICE_POWER_STATE state, int flags);


[DllImport("coredll.dll")]
public static extern int SetDevicePower(string pvDevice, int df, CEDEVICE_POWER_STATE ds);


没有专门针对WIFI设备的API, 但是可以通过上面两个方法,控制WIFI状态

2. ref: http://topic.csdn.net/u/20080728/20/a5efe62a-629c-4811-add5-bc6c53fcdd5b.html
用无线管理器ChangeRadioState函数可以指定打开或关闭某一设备,包括WIFI


首先使用函数HRESULT GetWirelessDevices()获得一个设备链表,在设备链表中根据设备类型,找到wifi设备,然后调用ChangeRadioState()打开或者关闭指定的设备。
有关上述函数的详细使用,可以查windows mobile 6 documentation

GetWirelessDevices(),ChangeRadioState()都是MS公布给OEM的标准接口,WM6都是支持的。

openNETCF有,且有例子,你找找去。


看看人家做的
http://www.cnblogs.com/MS-Frank/archive/2008/11/14/1333664.html

軟體 wifiswitch
http://www.winbile.net/bbs/forums/threads/1014040.aspx
http://www.pudn.com/downloads90/sourcecode/windows/comm/detail342414.html

Native Wifi api
该api的可以实现windows的无线客户端的网络参数配置(WlanSetProfile),连接指定的ap,断开连接和获得其他关于无线网络的信息(ssid,rssi等)。

並且有一個斷開WIFI的範例。

另一個繼續深入的搜尋資源
http://search.pudn.com/search.asp?keyword=%20wifi


coredll 全部的函式名稱
http://topic.csdn.net/t/20050826/13/4233161.html

2009年3月12日 星期四

OpenNetCF` Smart Device Framework(SDF)

http://blog.csdn.net/khler/archive/2008/06/27/2592008.aspx
很遺憾,.Net Compact Framework類庫對於在Windows Mobile做應用程序開發是很不成熟的,有時候你不得不依賴於會引起諸多問題的Platform Invoke機制。 Smart Device Framework(SDF),一個對.NetCF進行了擴展的功能庫,覆蓋了.Net Compact Framework所未觸及的區域。
如果你之前使用.NetCF為Windows Mobiel開發過應用程序,那麼你就會發現僅僅依靠微軟提供的類庫是不能滿足所有功能需要的。在這種情況下,你不得不依賴於Platform Invoke(即通常所說的P/Invoke)——一種為了與操作系統共享數據而不得不使用的令人不快的東西。幸運的是,OpenNetCF組織推出了一個叫Smart Device Framework(SDF)的類庫,它填補了微軟.NetCF類庫的不足,將所有對操作系統的服務的調用封裝到了這個類庫中,方便基於託管代碼平台的開 發者直接訪問平台服務而不需要繁瑣的P/Invoke調用。

Windows Mobile Registry 系統存取 (C#)

.NET Compact Framework使用P/Invoke服务 (二)

Windows Mobile 中开关 WIFI 的“通用”代码

codedll.dll完整函數名稱




HOW TO:在類別庫中尋找 .NET Compact Framework 的支援成員

使用 .NET Compact Framework 進行裝置的程式設計

裝置的 COM 互通性
使用 Unmanaged DLL 函式

要看DLL中有什麼內容,可以使用DumpBin.exe, 如果是ATL COM DLL, 可以使用OLE/COM Object Viewer

dll查看

求 DLL 入口函数查询工具

http://topic.csdn.net/u/20081114/09/def024cb-fb52-4276-bec6-a42cf3c585e5.html



http://topic.csdn.net/u/20080728/20/a5efe62a-629c-4811-add5-bc6c53fcdd5b.html

http://www.pudn.com/login.asp




豐富的搜尋資源


Native Wifi api


WiFiSwitch



使用 Windows Mobile 5.0 中的图片、视频和照相机

使用 .NET Compact Framework 的條碼掃描器




2009年3月5日 星期四

在不同執行緒下存取UI控制項(textbox combobox)

問題描述 :在不同執行緒下呼叫方法,方法裡面需要存取主執行緒下的UI控制項

解法:

1.Form.CheckForIllegalCrossThreadCalls = False

2.建立委派

3.使用BackgroundWorker


這裡介紹第二種

首先在windows.form 的 onload事件建置一條執行緒

compareandprintout = new Thread(new ThreadStart(MRTcompareThread));
compareandprintout.Start();

這條thread 會執行compare()方法,存取UI控制項的程式就寫在裡面(存取textbox,combobox)
public void MRTcompareThread()
{
compare(); //裡面有無限迴圈
}

委派的建立!!


1.建立方法

publik int XXmethod(int a, int b);

2.宣告委派;委派參數,需要與被呼叫的方法一樣,包含回傳型別 (相同 signature)

   private delegate void XXDelegate();
   private delegate int XXDelegate(int a, int b);

3.引用委派(實體化),後指定方法

XXDelegate d = new XXDelegate(XXMethod); //參考的方法只要名稱就可以了
4.呼叫函數

invoke();


真的開始囉~~

於class form1裡宣告委派

delegate void SetTextCallback(Control ctl,String str); 設置textbox.text
delegate string GetTextCallback(Control ctl); 讀取textbox.text
delegate string GetCBTextCallback(ComboBox ctl, int i); 讀取ComboBox
delegate string GetCBTextCallback(Listcontrol ctl, int i); 讀取ComboBox


另外要寫委派方法
public string gettext(Control ctl)
{
if (this.InvokeRequired) //InvokeRequired required compares the thread ID of the // calling thread to the thread ID of the creating thread. // If these threads are different, it returns true.
{

GetTextCallback d = new GetTextCallback(gettext);
// this.Invoke(d);
string x;
x =(string) this.Invoke(d, new Object[] { ctl });
return x;
}
else
{
return ctl.Text;
}

}
public void settext(Control ctl,String str)
{
if (this.InvokeRequired)
{
SetTextCallback s = new SetTextCallback(settext);
this.Invoke(s, ctl, str );
}
else
{
ctl.Text = str;
}
}
public string getCBtext(ComboBox ctl, int i)
{
if (this.InvokeRequired)
{
string try1 = ctl.GetItemText(i); //i = 1 2 3 4 遞增,奇怪~難道我誤會MSDN? 給出來的是combobox的item索引
string try2 = (string)ctl.Items[i];//

GetCBTextCallback Gcb = new GetCBTextCallback(getCBtext); //建立
string x;
x = (string)this.Invoke(Gcb, ctl, i);
return x;
}
else
{
return (string) ctl.Items[i];
// return ctl.GetItemText(i);
}
}


在非產生UI控制項的副執行緒主程式 compare裡面有

while(true)
{
for (i = 1; i < style="color: rgb(51, 204, 255);"> getCBtext(comboBox1,i) && startstation == true)
//if (nowBox.Text == comboBox1.Items[i].ToString() )
{
//onBox.Text = comboBox1.Items[i].ToString(); //debug會出錯(不同控制項執行緒叫用 ... 我忘了)
string y = getCBtext(comboBox1,i) ;
settext(onBox, y); //叫用方法,自動判斷叫用invoke

}
}

for (i = 1; i < style="color: rgb(255, 0, 0);">// if (onBox.Text == comboBox1.Items[i].ToString())
{
if (goal > getonposition)
{
//nexterrorstop = comboBox1.Items[i - 1].ToString();
nexterrorstop = getCBtext(comboBox1,i-1);
}
else
{
nexterrorstop = "error";
}
}
}



}


VB版
一樣 ,先建立一個拿來更新 UI 的方法( UpdateUI),再建立一個有相同 signature 的委派( UpdateUICallBack)

Private Delegate Sub UpdateUICallBack(ByVal newText As String, ByVal c As Control)

Private Sub UpdateUI(ByVal newText As String, ByVal c As Control)
If Me.InvokeRequired() Then
Dim cb As New UpdateUICallBack(AddressOf UpdateUI)
Me.Invoke(cb, newText, c)
Else
c.Text = newText
End If
End Sub


ref:

舊文重發:Windows 表單與多執行緒


HOW TO:進行對 Windows Form 控制項的安全執行緒呼叫

VB/ VBA/ C#/ Java/ C++ 語言學習筆記

2009年1月20日 星期二

參考:
(原創) 使用preprocessor directive留住debug code (.NET) (C#)

Abstract
很多人以為debug mode和release mode的差異只是debug mode可以設Breakpoint而已,事實上,搭配preprocessor directive,debug mode另有妙用。

Introduction
preprocessor directive並不是什麼新東西,這在C語言就有的,如有些API在Windows 98和Windows XP不一樣,就得用preprocessor directive,讓不同的平台用不同的API。C#也可使用preprocessor directive,尤其用在debug時,非常方便。

我們常會有debug code,如try catch時,若有exception要顯示錯誤訊息,但真正發布產品時,則不希望顯示錯誤訊息,所以希望能留住debug code,以便日後debug,若用//或/* */的方式將debug code暫時當註解,常常遇到產品真正發布時,忘了將debug code拿掉的窘境,事實上,當使用debug mode時,C#自動定義了

2009年1月12日 星期一

幾個翻譯網站

zhua niao 抓鳥網(簡) -- web2.0
http://dict.zhuaniao.com/

蝙蝠英語(簡) -- 學習用的沒法英翻中
http://www.binvor.com/

蜂海詞(簡) -- 簡潔啊,還可以serch google, wiki, ...
http://tel.dict.cn/