上位机开发笔记
» 搜索 » user:admin post:true
串口库sio的一些研究和扩展
利用sio库写了一个完整的串口助手:
import win.ui; /*DSG{{*/ mainForm = win.form(text="串口调试助手(aardio版本)";right=731;bottom=342;border="dialog frame") mainForm.add( AsciiButton={cls="radiobutton";text="AscII";left=165;top=235;right=223;bottom=260;checked=1;font=LOGFONT(h=-16)串口库sio的一些研究和扩展
扩展1: 获取电脑上有的那些串口端口号
有两种方式:
方式一,通过方程获取为列表,直接传递给items
var comReadFuc = function(){ import win.reg; var tab = {}; //获取串口号 var reg = win.regReader("HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM\"); if( reg ){ for(name,value,t in我电脑里有一个通讯端口COM3 现在我用工具已经打开了这个串口,我想在aardio里在操作串口之前先检查一下这个COM端口的状态 想知道是否可用
import console;
import fsys.file;
import win
var file = fsys.file("COM1")
io.open()
io.print(file)
if( file ){
console.log("COM1未打开")
}
if(file === null){
console.log("COM1是打开的")
}
console.pause(true);
admin •
2018-01-02 • 最后回复来自 admin
com如果是已经打开了的,那么就会返回null
如果没打开过,那么
aardio中用如下代码启动electron并注入DLL钩子
code = /**
#include <windows.h>
typedef HWND WINAPI (*CreateWindowExPtr)(
DWORD dwExStyle,
LPCWSTR lpClassName,
LPCWSTR lpWindowName,
DWORD dwStyle,
int x,
int y,
int nWidth,
int nHeight,
admin •
2017-12-30 • 最后回复来自 admin
利用C语言编译器生成dll供其他软件调用
code = /**
#include <windows.h>
typedef HWND WINAPI (*CreateWindowExPtr)(
DWORD dwExStyle,
LPCWSTR lpClassName,
LPCWSTR lpWindowName,
DWORD dwStyle,
int x,
int y,
int nWidth,
int nHeight,
admin •
2017-12-30 • 最后回复来自 admin
aardio中用如下代码启动electron并注入DLL钩子
以下摘选自 aardio官方公众号
调用百度api车牌识别本地图片中的号码
以上代码经xauto提点,可以精简
调用百度api车牌识别本地图片中的号码
如果要识别图片中有好几个车牌号,那么增加一个属性即可.
但,切记两个属性的话用{}括起来才可以.
//调用ocr var result = ocr.license_plate({ image = inet.url.encodeUri(string.base64.encode(string.load(filePath))); multi_detect = true; } )
metaProperty属性的使用
//先导入
import util.metaProperty;
// 画笔
pen = class {
ctor (...) {
this = ..win.graphics.object();
this.init = function (style = 0x0/*_PS_SOLID*/, width = 1, color = 0) {
this.destroy();
if (type(style) != type.number)
error("(1) style 参数错误", 2)
admin •
2017-12-26
解析DXF文件代码为G代码
下半部分:
解析DXF文件代码为G代码
为了解析dxf代码,去网上下载了好多知网啊豆丁里面的文档,发现都是个坑.....
这些文档大部分都是只讲了dxf文档结构和解析的好处...然后,一笔带过怎么解析...
晕了...
这玩意解析其实也没那么难,敝帚自珍真的是够了..
怪不得国内开源的少的很,看看国外,唉......
整理内存,释放内存,避免内存狂涨...
emptyMem = function(){
import process;
import raw;
EmptyWorkingSet := ::Psapi.api("EmptyWorkingSet","bool(pointer hanld)")
empty=function(){
var hanld = process.OpenProcess(0x1f0fff,false,process.getId())
EmptyWorkingSet(hanld)
admin •
2017-12-10
文件路径拆分(分解)
import console;
path = io.splitpath("z:\编辑部\==连版==\已经照排过的版面\old\9-6-51.ps")
io.open()
io.print("驱动器",path.drive)
io.print("目录",path.dir)
io.print("文件名",path.name)
io.print("后缀名",path.ext)
io.print("文件名+后缀名",path.file);
console.pause(true);
admin •
2017-12-10 • 最后回复来自 admin
最小化到托盘和托盘点击事件
mainForm.wndproc = function(hwnd,message,wparam,lparam){
select(message) {
//最小化到托盘
case( 0x112/*_WM_SYSCOMMAND*/ ){ //系统命令消息
if( wparam == 0xF020/*_SC_MINIMIZE*/ ){ //用户点击了最小化按钮
import win.util.tray
admin •
2017-12-10