找到原因了,POPUP_x1,POPUP_y1,POPUP_y1,POPUP_y2为窗口的四个角坐标
1、原来定义为int size;
size = (POPUP_x2 - POPUP_x1 + 1 ) * (POPUP_y2 - POPUP_y1 +1 ) / 1024 + 1;
XMS_Alloc(size);//调用子程序分配XMS空间(以KB为单位)
2、现在更改为
int size;
long long_size;
long_size = ((long)POPUP_x2-(long)POPUP_x1+1)*((long)POPUP_y2-(long)POPUP_y1+1);
long_size = long_size/1024+1;
size = long_size;
XMS_Alloc(size);//调用子程序分配XMS空间(以KB为单位)
但是现在还有1个问题:
窗口最后一列无法恢复。源程序如下:
char XMSBuffer[800];
/*-----------------------------------------------------------
//保存窗口映像到XMS
-----------------------------------------------------------*/
void _Cdecl Save_Image_XMS(void)
{
int i,j;
unsigned int size;
long long_size;
unsigned long offset = 0;
char *pp;
long_size = ((long)POPUP_x2-(long)POPUP_x1+1)*
((long)POPUP_y2-(long)POPUP_y1+1);
long_size = long_size/1024+1;
size = long_size;
if (XMS_Size() > size)
{
if ((xms_window_handle = XMS_Alloc(size)) != 0)
{
size = POPUP_x2 - POPUP_x1;
for (i = POPUP_y1 ; i <= POPUP_y2 ; i++)
{
pp = XMSBuffer;
for (j = POPUP_x1 ; j <= POPUP_x2 ; j++)
*pp++ = getpixel(j,i);
Write_To_XMS(XMSBuffer,size,xms_window_handle,offset);
offset += size;
}
}
else
puts("XMS handle Error...\n");
}
else
puts("not enough XMS...\n");
}
/*-----------------------------------------------------------
//恢复窗口映像从XMS
-----------------------------------------------------------*/
void _Cdecl Restore_Image_XMS(void)
{
int i,j;
unsigned short size;
unsigned long offset = 0;
char *pp;
for (i = POPUP_y1 ; i <= POPUP_y2 ; i++)
{
size = POPUP_x2 - POPUP_x1;
Read_From_XMS(XMSBuffer,size,xms_window_handle,offset);
offset += size;
pp = XMSBuffer;
for (j = POPUP_x1 ; j <= POPUP_x2 ; j++)
putpixel(j,i,*pp++);
}
XMS_Free(xms_window_handle);
}
现在还有1个问题: 窗口最后一列无法恢复,为什么?
多年以来还在MSDOS、单片机下搞嵌入式编程,对WINDOWS编程一窍不通,很想了解WINDOWS下病毒编程技术。