<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    blogjava's web log

    blogjava's web log
    ...

    // 得到路徑
    ???????????? string ?strPath = System.IO.Directory.GetCurrentDirectory();
    // 分割
    string ?str1 = " text1,text2,text3,text4 "
    string []?stri = str1.Split( new ? char [] { ' ' } );

    // 啟動一個程序

    using ?System;
    using ?System.Drawing;
    using ?System.Collections;
    using ?System.ComponentModel;
    using ?System.Windows.Forms;
    using ?System.Data;
    using ?System.Diagnostics;
    using ?System.Reflection;
    using ?System.Runtime.InteropServices;

    ????????
    /// ? <summary>
    ????????
    /// ?應用程序的主入口點。
    ????????
    /// ? </summary>

    ????????[STAThread]
    ????????
    static ? void ?Main()?
    ????????
    {
    ????????????
    // Get?the?running?instance.
    ????????????Process?instance? = ?RunningInstance();
    ????????????
    if ?(instance? == ? null )
    ????????????
    {
    ????????????????
    // 新實例
    ????????????????Application.Run( new ?Form1());
    ????????????}

    ????????????
    else
    ????????????
    {
    ????????????????
    // 相同的實例,并將窗口置前
    ????????????????HandleRunningInstance(instance);
    ????????}

    ????}


    public ? static ?Process?RunningInstance()
    {
    ????Process?current?
    = ?Process.GetCurrentProcess();
    ????Process[]?processes?
    = ?Process.GetProcessesByName?(current.ProcessName);
    ????
    // 查找相同名的進程
    ???? foreach ?(Process?process? in ?processes)
    ????
    {
    ????
    // 忽略當前線程
    ???? if ?(process.Id? != ?current.Id)
    ????
    {
    ????
    // 確認相同名的進程運行位置是否相同
    ???? if ?(Assembly.GetExecutingAssembly().Location.Replace( " / " ,? " \\ " )? == current.MainModule.FileName)
    {
    ????
    // 返回相同名進程
    ???? return ?process;
    }

    }

    }

    ????
    // 沒有其它進程,返回空值
    ???? return ? null ;
    }


    ?
    public ? static ? void ?HandleRunningInstance(Process?instance)
    ?
    {
    ?
    // 確認窗口是最小化或最大化
    ?ShowWindowAsync?(instance.MainWindowHandle?,?WS_SHOWNORMAL);

    ?
    // 將窗口置前
    ?SetForegroundWindow?(instance.MainWindowHandle);
    ?}


    ?[DllImport(
    " User32.dll " )]?

    private ? static ? extern ? bool ?ShowWindowAsync(IntPtr?hWnd,? int ?cmdShow);
    ?[DllImport(
    " User32.dll " )]? private ? static ? extern ? bool ?SetForegroundWindow(IntPtr?hWnd);
    ?
    private ? const ? int ?WS_SHOWNORMAL? = ? 1 ;

    ????????
    private ? void ?Form1_Load( object ?sender,?System.EventArgs?e)
    ????????
    {
    ????????
    ????????}

    ?}
    posted @ 2006-05-28 14:56 record java and net 閱讀(403) | 評論 (0)編輯 收藏

    [Serializable]
    ????
    public?class?MyObject?
    ????
    {
    ????????
    public?int?n1?=?0;
    ????????
    public?int?n2?=?0;
    ????????
    public?String?str?=?null;
    ????}

    using?System;
    using?System.Drawing;
    using?System.Collections;
    using?System.ComponentModel;
    using?System.Windows.Forms;
    using?System.Data;
    using?System.IO?;
    using?System.Runtime?.Serialization?.Formatters?.Binary?;
    using?System.Runtime?.Serialization?;

    //系列化
    private?void?button1_Click(object?sender,?System.EventArgs?e)
    ????????
    {
    ????????????MyObject?obj?
    =?new?MyObject();
    ????????????obj.n1?
    =?1;
    ????????????obj.n2?
    =?24;
    ????????????obj.str?
    =?"Some?String";
    ????????????IFormatter?formatter?
    =?new?BinaryFormatter();
    ????????????Stream?stream?
    =?new?FileStream("MyFile.bin",?FileMode.Create,?FileAccess.Write,?FileShare.None);
    ????????????formatter.Serialize(stream,?obj);
    ????????????stream.Close();

    ????????}

    //反。。。。。。
    ????????private?void?button2_Click(object?sender,?System.EventArgs?e)
    ????????
    {
    ????????????IFormatter?formatter?
    =?new?BinaryFormatter();
    ????????????Stream?stream?
    =?new?FileStream("MyFile.bin",?FileMode.Open,?FileAccess.Read,?FileShare.Read);
    ????????????MyObject?obj?
    =?(MyObject)?formatter.Deserialize(stream);
    ????????????stream.Close();
    ????????????MessageBox.Show?(obj.n1.ToString?()?);

    ????????}
    posted @ 2006-05-28 14:25 record java and net 閱讀(322) | 評論 (0)編輯 收藏
         摘要: pull模式 ???????? protected ? void ?Page_Load( object ?sender,?System.EventArgs?e)???????? {???????????? // ?在...  閱讀全文
    posted @ 2006-05-28 14:12 record java and net 閱讀(481) | 評論 (0)編輯 收藏
         摘要: 使用DataRelation類創建關系并利用父/子關系讀取數據示例void?Page_Load(object?sender,?System.EventArgs?e)????????????{????????????????//?連接字符串和?SQL?語句????????????????string?ConnString?=?System.Configuration.ConfigurationSet...  閱讀全文
    posted @ 2006-05-27 18:07 record java and net 閱讀(737) | 評論 (2)編輯 收藏
         摘要: 思路:建個模版文件,再用C#讀此文件,把里面的標記替換掉。。  閱讀全文
    posted @ 2006-05-27 17:32 record java and net 閱讀(327) | 評論 (0)編輯 收藏
    僅列出標題
    共31頁: First 上一頁 17 18 19 20 21 22 23 24 25 下一頁 Last 

    導航

    常用鏈接

    留言簿(44)

    新聞檔案

    2.動態語言

    3.工具箱

    9.文檔教程

    友情鏈接

    搜索

    最新評論

    主站蜘蛛池模板: 成年女人免费视频播放体验区| 日日噜噜噜噜夜夜爽亚洲精品| 无码的免费不卡毛片视频| 亚洲精品色午夜无码专区日韩| 免费无码VA一区二区三区| 亚洲资源最新版在线观看| 亚洲国产精品13p| 3344免费播放观看视频| 美女又黄又免费的视频| 亚洲AV成人片色在线观看高潮| 成年人在线免费看视频| 国产一级黄片儿免费看| 亚洲a视频在线观看| 亚洲综合国产一区二区三区| 一个人免费观看在线视频www| 麻豆69堂免费视频| 亚洲精品美女久久久久9999| 四虎在线播放免费永久视频| 无码av免费网站| 免费国产va视频永久在线观看| 亚洲欧洲一区二区| 亚洲精品动漫人成3d在线| 亚洲一区二区免费视频| 成年网在线观看免费观看网址| 亚洲人成在久久综合网站| 红杏亚洲影院一区二区三区| 在线观看AV片永久免费| 免费国产成人18在线观看| 边摸边吃奶边做爽免费视频99 | 亚洲乳大丰满中文字幕| 毛片a级三毛片免费播放| 精品国产污污免费网站 | 亚洲午夜免费视频| 国产V片在线播放免费无码| 亚洲狠狠婷婷综合久久| 亚洲视屏在线观看| 亚洲妇熟XXXX妇色黄| 亚洲人成影院在线无码观看| 成年人在线免费看视频| 91在线视频免费91| 免费看男女下面日出水来|