Get_ClipboardText, Get_Info, Get_InfoStr, Get_Language, Get_Size, Get_UserTime
Description
Get_ClipboardText(
char Buffer
);This function allows to retrieve contents of the clipboard.
When calling with NULL pointer, the function returns size of the text string in the clipboard, or -1 if it fails. When calling with no NULL pointer, it retrieves contents of the clipboard.
Parameters
char buffer[100000];
char w_buffer[100000];
int buffer_size;
buffer_size = Get_ClipboardText(NULL);
if (buffer_size != -1)
{
if (buffer_size < 100000)
{
Get_ClipboardText(buffer);
MultiByteToWideChar(w_buffer, buffer);
Int_CreateWindow(1, "Clipboard", WP_TOPLEFT, 0, 0, 800, 400, w_buffer, 1, 1, 0, 1, 1, 1, "Courier,,10");
}
else
WaitText(0, "Not enough space allocated.");
}
else
WaitText(0, "Clipboard does not contain text."); Description
Get_Info(
int what
);This function gives the basic information about the system.
Parameters
what Type of system information.
This function returns the acquisition time of the current image. | |
The function returns TRUE, if the current binary image is empty(==all pixels are equal to zero). | |
The function returns TRUE, if the connected XY stage is initialized. | |
The function returns TRUE, if there is an XY stage connected. | |
The function returns TRUE, if the current Z stage is calibrated. | |
The function returns TRUE, if the connected Z stage is initialized. | |
The function returns TRUE, if there is a Z stage connected. | |
The function returns the number of procedures which is possible to define. | |
The function returns the number of variables which is possible to define. | |
The function returns TRUE, if it is full version. For light version, the return value is FALSE. | |
The function returns TRUE, if the system is active (with grabbing card) on the contrary to passive (==VGA) system without ability to grab images. | |
The function returns TRUE, if the current camera is monochromatic (or emulated mono). | |
If the function returns TRUE, if there is the logical device “Light” connected. | |
The function returns TRUE, if the system enables live overlay. | |
If the function returns TRUE, live picture is on, else the picture is frozen. | |
The function returns TRUE, if the mask image is empty (==all pixels are equal to zero). | |
The function returns TRUE, if the mask is on (if the MaskOn item in the Measure menu has been checked). | |
The Hicolor system returns PT_COL16, true color system returns PT_COL24 and 8-bit gray system returns PT_GRAY8. | |
The function returns TRUE, if the shading image has been defined. | |
The function returns TRUE, if the toolbar window is shown, FALSE if it is hidden and 2 if it is fixed. | |
The function returns VIEW_BINARY if you are in binary view mode, VIEW_FULL if you are in the color or gray view mode, VIEW_OVERLAY for overlay mode, VIEW_USER for user view mode and VIEW_SUPPRESSED in the case of suppressing display. | |
The function returns TRUE, if the zoom is frozen. | |
The function returns TRUE, if the zoom window is shown. |
//Get_Info example - writes current information about system to the window.
char buf[200];
dword dim, xs, ys;
int res, levels;
double cal, aspect;
int unit;
char objective[100];
char units[10][10];
char filename[144];
char title[20];
char caption[200];
strcpy(caption, "API Example - Get_Info, Get_Calibration, Get_Filename functions");
Int_CreateTextWindow(caption,0,RGB(0,0,128),RGB_WHITE,100);
strcpy(units,"um");
strcpy(units+10,"#1");
strcpy(units+20,"#2");
strcpy(units+30,"mm");
strcpy(units+40,"cm");
strcpy(units+50,"m");
strcpy(units+60,"pixels");
xs=LOWORD(Get_Size(SIZE_MAINWND,NULL,NULL,NULL,NULL));
xs=(xs-450)/2;
Get_Size(SIZE_PICWND,NULL,&ys,NULL,NULL);
Int_CreateWindow(1,"General Information Window",0,xs,ys,450,560,"",
1,1,0.00000,1,1,1,"Arial,B,8");
res=Get_Info(INFO_LIVEOVERLAY);
if(res) sprintf(buf,"Live Overlay Enabled\n","");
else sprintf(buf,"Live Overlay Disabled\n","");
Int_SetWindowText(1,buf,0);
res=Get_Info(INFO_FREEVARS);
sprintf(buf,"Free Variables: %i\n","res");
Int_SetWindowText(1,buf,1);
res=Get_Info(INFO_FREEPROCS);
sprintf(buf,"Free Procedures: %i\n","res");
Int_SetWindowText(1,buf,1);
res=Get_Info(INFO_GRABBING);
if(res) sprintf(buf,"Grabbing Enabled\n","");
else sprintf(buf,"Grabbing Disabled\n","");
Int_SetWindowText(1,buf,1);
res=Get_Info(INFO_LIVESTATUS);
if(res) sprintf(buf,"Live Image on the Screen\n","");
else sprintf(buf,"Frozen Image on the Screen\n","");
Int_SetWindowText(1,buf,1);
res=Get_Info(INFO_PICTURETYPE);
if(res==PT_COL16) sprintf(buf,"Picture Type is Color 16-bits\n","");
if(res==PT_GRAY8) sprintf(buf,"Picture Type is Gray 8-bits\n","");
if(res==PT_COL24) sprintf(buf,"Picture Type is Color 24-bits\n","");
Int_SetWindowText(1,buf,1);
res=Get_Info(INFO_FULLVERSION);
if(res) sprintf(buf,"Running System is NIS-Elements\n","");
else sprintf(buf,"Running System is Screen Measurement\n","");
Int_SetWindowText(1,buf,1);
res=Get_Info(INFO_MASKON);
if(res) sprintf(buf,"Mask is ON\n","");
else sprintf(buf,"Mask is OFF\n","");
Int_SetWindowText(1,buf,1);
res=Get_Info(INFO_MASKEMPTY);
if(res) sprintf(buf,"Mask Image is Empty\n","");
else sprintf(buf,"Mask Image is Not Empty\n","");
Int_SetWindowText(1,buf,1);
res=Get_Info(INFO_BINARYEMPTY);
if(res) sprintf(buf,"Binary Image is Empty\n","");
else sprintf(buf,"Binary Image is Not Empty\n","");
Int_SetWindowText(1,buf,1);
res=Get_Info(INFO_SHADING);
if(res) sprintf(buf,"Shading Image Exists\n","");
else sprintf(buf,"No Shading Image\n","");
Int_SetWindowText(1,buf,1);
res=Get_Info(INFO_ZOOMIN);
if(res) sprintf(buf,"Zoom is ON\n","");
else sprintf(buf,"Zoom is OFF\n","");
Int_SetWindowText(1,buf,1);
res=Get_Info(INFO_ZOOMFROZEN);
if(res) sprintf(buf,"Zoom is Frozen\n","");
else sprintf(buf,"Zoom is N O T Frozen\n","");
Int_SetWindowText(1,buf,1);
res=Get_Info(INFO_TOOLBAR);
if(res==0) sprintf(buf,"Floating Toolbar is OFF\n","");
if(res==1) sprintf(buf,"Floating Toolbar is ON\n","");
if(res==2) sprintf(buf,"You have Fixed Toolbar\n","");
Int_SetWindowText(1,buf,1);
res=Get_Info(INFO_STAGEPRESENT);
if(res) sprintf(buf,"Stage Driver is loaded\n","");
else sprintf(buf,"Stage Driver is NOT loaded\n","");
Int_SetWindowText(1,buf,1);
res=Get_Info(INFO_STAGEINIT);
if(res) sprintf(buf,"Stage Driver is initiated\n","");
else sprintf(buf,"Stage Driver is NOT initiated\n","");
Int_SetWindowText(1,buf,1);
res=Get_Info(INFO_LIGHTPRESENT);
if(res) sprintf(buf,"LightDriver is loaded\n","");
else sprintf(buf,"Light Driver is NOT loaded\n","");
Int_SetWindowText(1,buf,1);
if(res)
{
levels = GetLightLevels();
sprintf(buf,"Light Levels is %i\n","levels");
Int_SetWindowText(1,buf,1);
}
res=Get_Info(INFO_VIEW);
if(res==VIEW_BINARY) sprintf(buf,"Binary Mode\n","");
if(res==VIEW_FULL) sprintf(buf,"Color/Gray Mode\n","");
if(res==VIEW_OVERLAY) sprintf(buf,"Overlay Mode\n","");
if(res==VIEW_USER) sprintf(buf,"User Mode\n","");
if(res==VIEW_SUPPRESSED) sprintf(buf,"Suppressed Mode\n","");
Int_SetWindowText(1,buf,1);
res=Get_Info(INFO_SHADINGMODE);
if(res) sprintf(buf,"Shading is Multiplicative\n","");
else sprintf(buf,"Shading is Subtractive\n","");
Int_SetWindowText(1,buf,1);
Get_Calibration(objective, &cal, &aspect, &unit);
sprintf(buf, "Objective=%s\nCalibration=%6.3f\nAspect=%4.2f\nUnit=%s\n",
"objective,cal,aspect,units+((unit+6)*10)");
Int_SetWindowText(1,buf,1);
Get_Filename(FILE_OBJECTDATA,filename);
Get_FileTitle(title,filename);
sprintf(buf,"Object Data File = %s(%s)\n", "filename,title");
Int_SetWindowText(1,buf,1);
Get_Filename(FILE_FIELDDATA,filename);
Get_FileTitle(title,filename);
sprintf(buf,"Field Data File = %s(%s)\n", "filename,title");
Int_SetWindowText(1,buf,1);
Get_Filename(FILE_LENGTHDATA,filename);
Get_FileTitle(title,filename);
sprintf(buf,"Length Data File = %s(%s)\n", "filename,title");
Int_SetWindowText(1,buf,1);
Get_Filename(FILE_ANGLEDATA,filename);
Get_FileTitle(title,filename);
sprintf(buf,"Angle Data File = %s(%s)\n", "filename,title");
Int_SetWindowText(1,buf,1);
Get_Filename(FILE_IMAGE,filename);
Get_FileTitle(title,filename);
sprintf(buf,"Last Opened Image = %s(%s)\n", "filename,title");
Int_SetWindowText(1,buf,1);
Get_Filename(FILE_SEQIMAGE,filename);
Get_FileTitle(title,filename);
sprintf(buf,"Current Image in Sequences = %s(%s)\n", "filename,title");
Int_SetWindowText(1,buf,1);
Get_Filename(FILE_MACRO,filename);
Get_FileTitle(title,filename);
sprintf(buf,"Current Macro = %s(%s)\n", "filename,title");
Int_SetWindowText(1,buf,1);
Get_Filename(FILE_CONFIG,filename);
Get_FileTitle(title,filename);
sprintf(buf,"Configuration File = %s(%s)\n", "filename,title");
Int_SetWindowText(1,buf,1);
Get_Filename(FILE_EXECUTABLE,filename);
Get_FileTitle(title,filename);
sprintf(buf,"Executable File = %s(%s)\n", "filename,title");
Int_SetWindowText(1,buf,1);
Get_Filename(FILE_WINDIR,filename);
sprintf(buf,"Windows Directory = %s", "filename");
Int_SetWindowText(1,buf,1);
Wait(4);
Int_CloseTextWindow();
See Also
Get_Filename, Get_FileTitle, Get_Calibration
Description
Get_InfoStr( intwhat, char *infostr);
This function fills the infostr parameter by requested string. This requested string is specified by the what.Get_InfoStr parameter.
Parameters
what Type of information that is represented by a string.
Windows version. | |
NIS-Elements version. | |
Grabber. | |
Name of the first item in image description. | |
Name of the second item in image description. | |
Name of the third item in image description. | |
Name of the fourth item in image description. | |
Name of the log file with full path. | |
NIS-Elements package (AR, BR, D). | |
User name. |
Return Values
// Get_InfoStr example - retrieves information about versions, grabber and archive items. char buf[200]; char buf1[200]; dword dim, xs, ys; int res, levels; double cal, aspect; xs=LOWORD(Get_Size(SIZE_MAINWND,NULL,NULL,NULL,NULL)); xs=(xs-450)/2; Get_Size(SIZE_PICWND,NULL,&ys,NULL,NULL); Int_CreateWindow(1,"Info String Information",0,xs,ys,450,360,"Last Opened Image\tx= 0\ty= 0\twidth= 0\theight= 0\n",1,1,0.00000,1,1,1,"Arial,B,8"); Get_InfoStr(INFOSTR_BOARD, buf1); sprintf(buf,"Board: %s\n","buf1"); Int_SetWindowText(1,buf,0); Get_InfoStr(INFOSTR_LUCVER, buf1); sprintf(buf,"Version: %s\n","buf1"); Int_SetWindowText(1,buf,1); Get_InfoStr(INFOSTR_WINVER, buf1); sprintf(buf,"Windows Version: %s\n","buf1"); Int_SetWindowText(1,buf,1); Get_InfoStr(INFOSTR_SUBJECT, buf1); sprintf(buf,"Subject Subst: %s\n","buf1"); Int_SetWindowText(1,buf,1); Get_InfoStr(INFOSTR_SAMPLE, buf1); sprintf(buf,"Sample Subst: %s\n","buf1"); Int_SetWindowText(1,buf,1); Get_InfoStr(INFOSTR_AUTHOR, buf1); sprintf(buf,"Author Subst: %s\n","buf1"); Int_SetWindowText(1,buf,1); Get_InfoStr(INFOSTR_COMMENT, buf1); sprintf(buf,"Comment Subst: %s\n","buf1"); Int_SetWindowText(1,buf,1);
See Also
Get_Info
Description
BYTE Get_Language();
This function returns language currently used by the application.
**sample code**
Note
If you want to convert the result to 'macro defined constants' use Convert_Language_Const function.
Description
Get_Size( intWhat, int *LpXs, int *LpYs, int *LpWidth, int *LpHeight);
This function retrieves the coordinates and dimensions from the main window, picture window, measurement frame etc.
Parameters
What Object type.
Main window. | |
Picture window. | |
Measurement frame. | |
The most recent rectangle copied to the clipboard. | |
Rectangle of the last saved image. (Not full image). | |
Rectangle of the current document (0,0,DocWidth,DocHeight). | |
Rectangle of the current view of the current picture. If the picture is in the fit to screen mode, equals SIZE_PICTURE. |
LpXs Pointer to the x - coordinate of the rectangle. If what==SIZE_MAINWND (0) or what==SIZE_PICWND (1), it is screen coordinate. Otherwise it is picture coordinate.
//Get_Size example - draws 5x5 rectangles on the screen according to the picture window size.
int xs,ys,width,height;
int i1,i2,x1,y1,w1,h1;
int p_w,p_h;
Int_CreateTextWindow("API Example - Get_Size function.",0,RGB(0,0,128),RGB_WHITE,100);
SetCommandText("Working...");
Get_Size(SIZE_PICWND,&xs,&ys,&width,&height);
p_w = width / 5;
p_h = height / 5;
w1 = p_w-20;
h1 = p_h-20;
for(i1=0;i1<5;i1=i1+1)
{
for(i2=0;i2<5;i2=i2+1)
{
x1 = 10 + (p_w * i2);
y1 = 10 + (p_h * i1);
InsertRectangle(x1,y1,w1,h1,0,MODE_OR, 0);
}
}
Int_CloseTextWindow();See Also
Get_Info, Get_InfoStr
Description
int Get_UserTime( char *Caption, dwordinit_time);
This function displays the dialog with the specified caption. In this dialog you can select the time.
See Also
Convert_ms_To_Time