using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using SensorTechnology;

namespace SamplePreview
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private System.IntPtr m_hCamera;

        private void Form1_Load(object sender, EventArgs e)
        {
            m_hCamera = StCam.Open(0);
        }

        private void Form1_FormClosed(object sender, FormClosedEventArgs e)
        {
            if (m_hCamera != System.IntPtr.Zero)
                StCam.Close(m_hCamera);
        }

        private void btnPreview_Click(object sender, EventArgs e)
        {

            StCam.CreatePreviewWindow(
                m_hCamera,
                "Preview",
                StCam.WS_OVERLAPPEDWINDOW | StCam.WS_VISIBLE,
                0, 0, 0, 0, System.IntPtr.Zero, System.IntPtr.Zero, false);
            StCam.StartTransfer(m_hCamera);	
        }
    }
}