zoukankan      html  css  js  c++  java
  • COM组件技术

    COM(component object module)

    组件和对象的区别:

         1、组件可以在另一个称为容器的应用程序中使用,也可以作为独立的过程使用。

         2、 组件可以有一个类构成,也可以由多个类构成,或者一个完整的应用程序。

        3、 组件是模块的重用,对象是代码的重用。

    使用组件的好处:

    1、 可以将系统中的组件用新的组件替换掉,以便于进行系统的升级和定制。

    2、可以在多个应用系统中重复利用同一个组件。

    3、可以方便地将应用系统扩展到网络环境下。

    4、COM 与语言、平台无关的特性使所有的程序员均可充分发挥自己的才智与专长编写组件模块。

     例子:

    视频播放:

    代码
    namespace media
    {
    public partial class Form1 : Form
    {
    string uu = "0";
    public Form1()
    {
    InitializeComponent();

    RegistryKey xx
    = Registry.LocalMachine;
    RegistryKey xx1
    = xx.OpenSubKey("SOFTWARE", true);
    string ss = "";
    foreach (string site in xx1.GetSubKeyNames())
    {
    if (site =="ww")
    {
    ss
    = "AA";
    RegistryKey xx2
    = xx1.OpenSubKey("ww", true);
    foreach (string tt in xx2.GetValueNames())
    {
    listBox1.Items.Add(tt);
    }
    }
    if (ss!="AA")
    {
    xx1.CreateSubKey(
    "ww");
    }
    xx.Close();
    if (listBox1.Focused ==false)
    {
    delmovie.Enabled
    = false;
    upmovie.Enabled
    = false;
    downmovie.Enabled
    = false;
    }
    else
    {
    delmovie.Enabled
    = true;
    upmovie.Enabled
    = true;
    downmovie.Enabled
    = true;
    }
    }
    }

    private void Form1_Load(object sender, EventArgs e)
    {

    }

    private void addmovie_Click(object sender, EventArgs e)
    {
    openFileDialog1.Filter
    = "Media Files|*.mpg;*.avi;*.wma;*.mov;*.wav;*.mp2;*.mp3|All Files |*.*";
    openFileDialog1.ShowDialog();
    RegistryKey xx
    = Registry.LocalMachine;
    RegistryKey xx1
    = xx.OpenSubKey("SOFTWARE", true);
    RegistryKey xx2
    = xx1.OpenSubKey("ww", true);
    xx2.SetValue(openFileDialog1.FileName, openFileDialog1.FileName, RegistryValueKind.String);
    xx.Close();
    listBox1.Items.Add(openFileDialog1.FileName);
    }

    private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
    {
    upmovie.Enabled
    = true;
    downmovie.Enabled
    = true;
    delmovie.Enabled
    = true;
    if(uu=="0")
    {
    axWindowsMediaPlayer1.URL
    = listBox1.SelectedItem.ToString();

    }
    else
    {
    uu
    = "0";
    axWindowsMediaPlayer1.URL
    = "";
    }
    axWindowsMediaPlayer1.Ctlcontrols.stop();
    }
    }
    }
  • 相关阅读:
    两个List集合过滤出不同集合
    TypeError: Failed to execute 'fetch' on 'Window': Request with GET/HEAD method cannot have body.
    sql server 查询某个表被哪些存储过程调用
    SQL server字符分割
    oracle 结果集合并
    tree与GridView交互
    oracle job相关
    ImportFileHandler 附件上传
    dt转换List CovertListHelper
    node版本管理mac版
  • 原文地址:https://www.cnblogs.com/tianjinquan/p/1860724.html
Copyright © 2011-2022 走看看