There is a function in the dll file ,which capture a screen and convert captured image to hex without making image file
I wanted to call this fucntion by means of DllCall but i failed. so i inluded CLR.ahk in my script
this is my script in autohotkey
Code: Select all
#include C:\Users\me\Desktop\CLR.ahk
f1::
hex=
(
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Windows.Forms;
namespace hex
{
public class Hex1
{
public string HexFunct()
{
Size size = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
Bitmap bmp = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
Graphics g = Graphics.FromImage(bmp);
g.CopyFromScreen(0, 0, 0, 0, size);
MemoryStream mem = new MemoryStream();
Image scrs = bmp;
scrs.Save(mem, System.Drawing.Imaging.ImageFormat.Bmp);
var c = mem.ToArray();
var hexstring = BitConverter.ToString(mem.ToArray()).Replace("-", "");
mem.Dispose();
return hexstring;
}
}
}
)
asm := CLR_CompileC#(hex)
obj := CLR_CreateObject(asm, "Hex1")
msgbox % obj.HexFunct()
return
f2::
exitapp
If running this, get an error like below
Error CS0234 : There is not 'Linq' type or namespace in 'System' namespcae. Make sure that there is a assembly reference.
Error CS0234 : There is not 'Drawing' type or namespace in 'System' namespcae. Make sure that there is a assembly reference.
Error CS0234 : There is not 'WIndows' type or namespace in 'System' namespcae. Make sure that there is a assembly reference.
I desperately want to solve it.
I sincerely hope that you will help me.