在vb.net中制作Windows窗体应用程序时,我遇到了这个错误:
System.OverflowException:'算术运算导致溢出。'
我的代码:
Imports System.Runtime.InteropServices
Public Class Form1
<DllImport("dwmapi.dll")>
Private Shared Sub DwmGetColorizationColor(ByRef ColorizationColor As UInteger, ByRef ColorizationOpaqueBlend As Boolean)
End Sub
Private Function UintToColor(ByVal argb As UInteger)
Dim a = argb >> 24
Dim r = argb >> 16
Dim g = argb >> 8
Dim b = argb >> 0
Return Color.FromArgb(a, r, g, b)
End Function
Dim windowColor
Dim windowBlend
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.Show()
DwmGetColorizationColor(windowColor, windowBlend)
Me.BackColor = UintToColor(windowColor)
End Sub
End Class
该函数返回(来自“autos”):
a:227
r:55182
g:14876783
b:3808456647
argb:3808456647
答案 0 :(得分:0)
我认为你正试图将uint拆分为Byte大小的块。
也许试试这个
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char** argv) {
char content[255];
FILE *fp1, *fp2;
fp1 = fopen("test1.mal", "r");
fp2 = fopen("output.txt", "w");
if(fp1 == NULL || fp2 == NULL){
printf("error reading file\n");
exit(0);
}
printf("files opened correctly\n");
// read from input file and write to the output file
while(fgets(content, sizeof (content), fp1) !=NULL) {
fputs(content, fp2);
}
fclose(fp1);
fclose(fp2);
printf("file created and text copied\n");
return 0;
}