嵌入VISION的cvi程序

更新时间:2023-08-14 13:13:01 阅读量: 人文社科 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

#include <windows.h>

#include <cvirte.h>

#include <userint.h>

#include <ansi_c.h>

#include "mil.h"

#include <utility.h>

#include "nivision.h"

#include "video_test.h"

#define Image_X 768

#define Image_Y 576

#define WINDOW_TO_USE 0

static int panelHandle;

static int ImaqHandle; // will contain the handle to the imaq window

static int windHandle; // will contain the handle to the CVI window

Image *image;

unsigned char myArray[Image_Y][Image_X];

int windowHandle,disp,x,y;

Point position;

MIL_ID MilApplication, /* Application identifier. */

MilSystem, /* System identifier. */

MilDisplay, /* Display identifier. */

MilDigitizer, /* Digitizer identifier. */

MilImage; /* Image buffer identifier. */

int main (int argc, char *argv[])

{

if (InitCVIRTE (0, argv, 0) == 0)

return -1; /* out of memory */

if ((panelHandle = LoadPanel (0, "video_test.uir", PANEL)) < 0)

return -1;

DisplayPanel (panelHandle); //显示面板

imaqSetupWindow(WINDOW_TO_USE,0);//设置窗口的性质;窗口号,定义窗口的行为 //imaqSetWindowPalette(WINDOW_TO_USE,2,NULL,0);

position.x=1;position.y=1;

imaqMoveWindow(WINDOW_TO_USE,position);//移动图像窗口,窗口号,窗口左上角的位置

image = imaqCreateImage (IMAQ_IMAGE_U8, 0);//创建一个图像

/*set the image window to be one part of the CVI window*/ //设置图像窗口的CVI窗口 windHandle = (int) FindWindow (NULL, "Video Test"); // get CVI window handle

ImaqHandle = (int) imaqGetSystemWindowHandle(0); //返回一个窗口句柄

} /* SetParent will set he CVI window as the parent of the imaq window. */ SetParent( (HWND) ImaqHandle, (HWND)windHandle); //改变某个子窗口的父窗口 MappAllocDefault(M_SETUP, &MilApplication, &MilSystem, M_NULL, &MilDigitizer, &MilImage); RunUserInterface (); DiscardPanel (panelHandle); return 0;

本文来源:https://www.bwwdw.com/article/wltj.html

Top