Demo (#1)
Co-authored-by: dengyucheng@finogeeks.com <ycdeng> Co-authored-by: gyt-pc-12400 <gyttyg@qq.com>master
parent
f051440bda
commit
ba721d45cf
279
README.md
279
README.md
|
@ -1,157 +1,122 @@
|
|||
<p align="center">
|
||||
<a href="https://www.finclip.com?from=github">
|
||||
<img width="auto" src="https://www.finclip.com/mop/document/images/logo.png">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<strong>FinClip Windows DEMO</strong></br>
|
||||
<p>
|
||||
<p align="center">
|
||||
Windows 小程序 DEMO
|
||||
<p>
|
||||
|
||||
<p align="center">
|
||||
👉 <a href="https://www.finclip.com?from=github">https://www.finclip.com/</a> 👈
|
||||
</p>
|
||||
|
||||
<div align="center">
|
||||
|
||||
<a href="#"><img src="https://img.shields.io/badge/%E4%B8%93%E5%B1%9E%E5%BC%80%E5%8F%91%E8%80%85-20000%2B-brightgreen"></a>
|
||||
<a href="#"><img src="https://img.shields.io/badge/%E5%B7%B2%E4%B8%8A%E6%9E%B6%E5%B0%8F%E7%A8%8B%E5%BA%8F-6000%2B-blue"></a>
|
||||
<a href="#"><img src="https://img.shields.io/badge/%E5%B7%B2%E9%9B%86%E6%88%90%E5%B0%8F%E7%A8%8B%E5%BA%8F%E5%BA%94%E7%94%A8-75%2B-yellow"></a>
|
||||
<a href="#"><img src="https://img.shields.io/badge/%E5%AE%9E%E9%99%85%E8%A6%86%E7%9B%96%E7%94%A8%E6%88%B7-2500%20%E4%B8%87%2B-orange"></a>
|
||||
|
||||
<a href="https://www.zhihu.com/org/finchat"><img src="https://img.shields.io/badge/FinClip--lightgrey?logo=zhihu&style=social"></a>
|
||||
<a href="https://www.finclip.com/blog/"><img src="https://img.shields.io/badge/FinClip%20Blog--lightgrey?logo=ghost&style=social"></a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<p align="center">
|
||||
|
||||
<div align="center">
|
||||
|
||||
[官方网站](https://www.finclip.com/) | [示例小程序](https://www.finclip.com/#/market) | [开发文档](https://www.finclip.com/mop/document/) | [部署指南](https://www.finclip.com/mop/document/introduce/quickStart/cloud-server-deployment-guide.html) | [SDK 集成指南](https://www.finclip.com/mop/document/introduce/quickStart/intergration-guide.html) | [API 列表](https://www.finclip.com/mop/document/develop/api/overview.html) | [组件列表](https://www.finclip.com/mop/document/develop/component/overview.html) | [隐私承诺](https://www.finclip.com/mop/document/operate/safety.html)
|
||||
|
||||
</div>
|
||||
|
||||
-----
|
||||
## 🤔 FinClip 是什么?
|
||||
|
||||
有没有**想过**,开发好的微信小程序能放在自己的 APP 里直接运行,只需要开发一次小程序,就能在不同的应用中打开它,是不是很不可思议?
|
||||
|
||||
有没有**试过**,在自己的 APP 中引入一个 SDK ,应用中不仅可以打开小程序,还能自定义小程序接口,修改小程序样式,是不是觉得更不可思议?
|
||||
|
||||
这就是 FinClip ,就是有这么多不可思议!
|
||||
|
||||
## 🖥 FinClip SDK 是什么?
|
||||
开发者可以使用 FinClip SDK 在宿主 APP 中快速实现小程序的能力。一般会用于以下场景:
|
||||
- 宿主 APP 构建自己的应用生态,既可以面向广泛开发者,也可以定向部分开发者;
|
||||
- 宿主 APP 通过小程序方式对模块进行解耦,让不同模块的开发团队独立发版,灵活更新;
|
||||
- 宿主 APP 中部分功能使用 FinClip 小程序实现,降低开发成本,并且提升发布效率;
|
||||
|
||||
此外,SDK 还需要配合基础库一并使用,通过基础库提供的小程序生命周期钩子、API函数,页面 DOM创建、渲染以及事件传递等能力为用户提供更加良好的体验。
|
||||
|
||||
## 🤩 效果预览
|
||||
|
||||
**本项目是 FinClip 小程序在 Win32 环境下的 DEMO 演示,您可以按照下方流程测试,验证 FinClip 小程序在 Windows 环境下的实际效果。**
|
||||
|
||||
先看一下运行效果~
|
||||
|
||||
<p align="center">
|
||||
<a href="#">
|
||||
<img width="auto" src="./doc/images/450.gif">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
> 当前 Windows 版本 SDK 还在持续研发中,我们将及时同步桌面版本小程序的研发进度,如有需要请与我们联系。
|
||||
|
||||
## 📦 安装第三方依赖
|
||||
Windows 小程序运行环境需要安装以下依赖,请提前配置环境:
|
||||
- 请下载依赖包[点我下载](https://public-1251849568.cos.ap-guangzhou.myqcloud.com/sdk/lib.zip)
|
||||
- 下载完后解压到vendor/finclip目录中
|
||||
- 建议使用 Visual Studio 2019 版本 [点我下载](https://support.microsoft.com/en-us/topic/the-latest-supported-visual-c-downloads-2647da03-1eea-4433-9aff-95f26a218cc0)
|
||||
|
||||
**注意:依赖包必须随缩主程序一同发布,并在独立目录中存放。**
|
||||
|
||||
解压后文件目录结构如下:
|
||||
|
||||
```
|
||||
vendor
|
||||
|--finclip
|
||||
| |--lib
|
||||
| |--****
|
||||
| |--****
|
||||
| |--****
|
||||
...
|
||||
```
|
||||
|
||||
|
||||
### 第一步 引入头文件
|
||||
|
||||
```c++
|
||||
#include "finclip_wrapper.h" //引入头文件
|
||||
#pragma comment(lib, "FinClipSDKWrapper.lib") //引入链接库
|
||||
```
|
||||
|
||||
### 第二步 初始化SDK
|
||||
|
||||
```c++
|
||||
FinConfig config = {
|
||||
1,
|
||||
"https://api.finclip.com",
|
||||
"/api/v1/mop",
|
||||
"这里输入SDK KEY",
|
||||
"这里输入SDK SECRET",
|
||||
"",
|
||||
1
|
||||
};
|
||||
IFinConfigPacker* configpacker = NewFinConfigPacker();
|
||||
configpacker->AddConfig(config);
|
||||
Initialize(hInstance, configpacker);
|
||||
```
|
||||
|
||||
- **SDK KEY** 和 **SDK SECRET** 可以从 [FinClip](https://finclip.com/#/home) 获取,点 [这里](https://finclip.com/#/register) 注册账号;
|
||||
- 进入平台后,在「应用管理」页面添加你自己的包名后,点击「复制」即可获得 key\secret\apisever 字段;
|
||||
- **apiServer** 和 **apiPrefix** 是固定字段,请直接参考本 DEMO ;
|
||||
- **小程序 ID** 是管理后台上架的小程序 APP ID,需要在「小程序管理」中创建并在「应用管理」中关联;
|
||||
> 小程序 ID 与 微信小程序ID 不一样哦!(这里是特指 FinClip 平台的 ID )
|
||||
|
||||
|
||||
### 第三步 打开小程序
|
||||
|
||||
```c++
|
||||
int server_type = 1;
|
||||
init_finclipsdk(server_type,wappkey, wsecret);
|
||||
IFinPacker* packer = NewFinPacker();
|
||||
packer->BeginPacker();
|
||||
packer->AddField("appId");
|
||||
packer->AddValue("appId");
|
||||
packer->EndPacker();
|
||||
StartApplet(server_type, utf8_encode(wappid).c_str(), packer, finclip_applet_callback);
|
||||
packer->Release();
|
||||
```
|
||||
|
||||
### 查看 API 文档
|
||||
您可以点击这里查看 [FinClipSDK WindowsAPI](https://docs.finogeeks.club/docs/finclip-win32/wrapper) 的开发文档
|
||||
|
||||
## 🔗 常用链接
|
||||
以下内容是您在 FinClip 进行开发与体验时,常见的问题与指引信息
|
||||
|
||||
- [FinClip 官网](https://www.finclip.com/#/home)
|
||||
- [示例小程序](https://www.finclip.com/#/market)
|
||||
- [文档中心](https://www.finclip.com/mop/document/)
|
||||
- [SDK 部署指南](https://www.finclip.com/mop/document/introduce/quickStart/intergration-guide.html)
|
||||
- [小程序代码结构](https://www.finclip.com/mop/document/develop/guide/structure.html)
|
||||
- [iOS 集成指引](https://www.finclip.com/mop/document/runtime-sdk/ios/ios-integrate.html)
|
||||
- [Android 集成指引](https://www.finclip.com/mop/document/runtime-sdk/android/android-integrate.html)
|
||||
- [Flutter 集成指引](https://www.finclip.com/mop/document/runtime-sdk/flutter/flutter-integrate.html)
|
||||
|
||||
## ☎️ 联系我们
|
||||
微信扫描下面二维码,关注官方公众号 **「凡泰极客」**,获取更多精彩内容。<br>
|
||||
<img width="150px" src="https://www.finclip.com/mop/document/images/ic_qr.svg">
|
||||
|
||||
微信扫描下面二维码,邀请进官方微信交流群(加好友备注:finclip 咨询),获取更多精彩内容。<br>
|
||||
<img width="150px" src="https://finclip-homeweb-1251849568.cos.ap-guangzhou.myqcloud.com/images/ldy111.jpg">
|
||||
<p align="center">
|
||||
<a href="https://www.finclip.com?from=github">
|
||||
<img width="auto" src="https://www.finclip.com/mop/document/images/logo.png">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<strong>FinClip Windows DEMO</strong></br>
|
||||
<p>
|
||||
<p align="center">
|
||||
Windows 小程序 DEMO
|
||||
<p>
|
||||
|
||||
<p align="center">
|
||||
👉 <a href="https://www.finclip.com?from=github">https://www.finclip.com/</a> 👈
|
||||
</p>
|
||||
|
||||
<div align="center">
|
||||
|
||||
<a href="#"><img src="https://img.shields.io/badge/%E4%B8%93%E5%B1%9E%E5%BC%80%E5%8F%91%E8%80%85-20000%2B-brightgreen"></a>
|
||||
<a href="#"><img src="https://img.shields.io/badge/%E5%B7%B2%E4%B8%8A%E6%9E%B6%E5%B0%8F%E7%A8%8B%E5%BA%8F-6000%2B-blue"></a>
|
||||
<a href="#"><img src="https://img.shields.io/badge/%E5%B7%B2%E9%9B%86%E6%88%90%E5%B0%8F%E7%A8%8B%E5%BA%8F%E5%BA%94%E7%94%A8-75%2B-yellow"></a>
|
||||
<a href="#"><img src="https://img.shields.io/badge/%E5%AE%9E%E9%99%85%E8%A6%86%E7%9B%96%E7%94%A8%E6%88%B7-2500%20%E4%B8%87%2B-orange"></a>
|
||||
|
||||
<a href="https://www.zhihu.com/org/finchat"><img src="https://img.shields.io/badge/FinClip--lightgrey?logo=zhihu&style=social"></a>
|
||||
<a href="https://www.finclip.com/blog/"><img src="https://img.shields.io/badge/FinClip%20Blog--lightgrey?logo=ghost&style=social"></a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<p align="center">
|
||||
|
||||
<div align="center">
|
||||
|
||||
[官方网站](https://www.finclip.com/) | [示例小程序](https://www.finclip.com/#/market) | [开发文档](https://www.finclip.com/mop/document/) | [部署指南](https://www.finclip.com/mop/document/introduce/quickStart/cloud-server-deployment-guide.html) | [SDK 集成指南](https://www.finclip.com/mop/document/introduce/quickStart/intergration-guide.html) | [API 列表](https://www.finclip.com/mop/document/develop/api/overview.html) | [组件列表](https://www.finclip.com/mop/document/develop/component/overview.html) | [隐私承诺](https://www.finclip.com/mop/document/operate/safety.html)
|
||||
|
||||
</div>
|
||||
|
||||
-----
|
||||
## 🤔 FinClip 是什么?
|
||||
|
||||
有没有**想过**,开发好的微信小程序能放在自己的 APP 里直接运行,只需要开发一次小程序,就能在不同的应用中打开它,是不是很不可思议?
|
||||
|
||||
有没有**试过**,在自己的 APP 中引入一个 SDK ,应用中不仅可以打开小程序,还能自定义小程序接口,修改小程序样式,是不是觉得更不可思议?
|
||||
|
||||
这就是 FinClip ,就是有这么多不可思议!
|
||||
|
||||
## 🖥 FinClip SDK 是什么?
|
||||
开发者可以使用 FinClip SDK 在宿主 APP 中快速实现小程序的能力。一般会用于以下场景:
|
||||
- 宿主 APP 构建自己的应用生态,既可以面向广泛开发者,也可以定向部分开发者;
|
||||
- 宿主 APP 通过小程序方式对模块进行解耦,让不同模块的开发团队独立发版,灵活更新;
|
||||
- 宿主 APP 中部分功能使用 FinClip 小程序实现,降低开发成本,并且提升发布效率;
|
||||
|
||||
此外,SDK 还需要配合基础库一并使用,通过基础库提供的小程序生命周期钩子、API函数,页面 DOM创建、渲染以及事件传递等能力为用户提供更加良好的体验。
|
||||
|
||||
## 🤩 效果预览
|
||||
|
||||
**本项目是 FinClip 小程序在 Win32 环境下的 DEMO 演示,您可以按照下方流程测试,验证 FinClip 小程序在 Windows 环境下的实际效果。**
|
||||
|
||||
先看一下运行效果~
|
||||
|
||||
<p align="center">
|
||||
<a href="#">
|
||||
<img width="auto" src="./doc/images/450.gif">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
> 当前 Windows 版本 SDK 还在持续研发中,我们将及时同步桌面版本小程序的研发进度,如有需要请与我们联系。
|
||||
|
||||
# sdk支持状况
|
||||
|
||||
| 语言 | GUI技术 | 状态 | 系统 | demo地址 | 语言库 |
|
||||
|---|---|---|---|---|---|
|
||||
| C++ | win32 | 测试中 | Windows | [win32](examples/win32) | 无 |
|
||||
| Python | pyqt 5 | 开发中 | Windows / Mac | [Pyqt](examples/pyqt) | |
|
||||
| JavaScript | Electron | 测试中 | Windows | [Electron](examples/electron) | |
|
||||
|
||||
# 运行demo
|
||||
|
||||
## 第一步: 下载对应的base包
|
||||
根据你的系统和 架构, 下载对应的finclip-sdk
|
||||
|
||||
假如你是 Windows 32位, 则下载finclip-sdk-win-x86-x.y.z.zip, 并解压至vendor/win/x86目录下
|
||||
|
||||
|
||||
|
||||
## 第二步: 下载语言SDK
|
||||
|
||||
部分语言, 例如python,Javascript, 我们提供了对应语言的库.
|
||||
|
||||
C / C++ 可以直接调用, 无须额外的库
|
||||
|
||||
## 第三步: 运行
|
||||
|
||||
根据demo文档, 将相应文件准备好后, 即可运行
|
||||
|
||||
# 集成
|
||||
|
||||
|
||||
|
||||
### 查看 API 文档
|
||||
您可以点击这里查看 [FinClipSDK WindowsAPI](https://docs.finogeeks.club/docs/finclip-win32/wrapper) 的开发文档
|
||||
|
||||
## 🔗 常用链接
|
||||
以下内容是您在 FinClip 进行开发与体验时,常见的问题与指引信息
|
||||
|
||||
- [FinClip 官网](https://www.finclip.com/#/home)
|
||||
- [示例小程序](https://www.finclip.com/#/market)
|
||||
- [文档中心](https://www.finclip.com/mop/document/)
|
||||
- [SDK 部署指南](https://www.finclip.com/mop/document/introduce/quickStart/intergration-guide.html)
|
||||
- [小程序代码结构](https://www.finclip.com/mop/document/develop/guide/structure.html)
|
||||
- [iOS 集成指引](https://www.finclip.com/mop/document/runtime-sdk/ios/ios-integrate.html)
|
||||
- [Android 集成指引](https://www.finclip.com/mop/document/runtime-sdk/android/android-integrate.html)
|
||||
- [Flutter 集成指引](https://www.finclip.com/mop/document/runtime-sdk/flutter/flutter-integrate.html)
|
||||
|
||||
## ☎️ 联系我们
|
||||
微信扫描下面二维码,关注官方公众号 **「凡泰极客」**,获取更多精彩内容。<br>
|
||||
<img width="150px" src="https://www.finclip.com/mop/document/images/ic_qr.svg">
|
||||
|
||||
微信扫描下面二维码,邀请进官方微信交流群(加好友备注:finclip 咨询),获取更多精彩内容。<br>
|
||||
<img width="150px" src="https://finclip-homeweb-1251849568.cos.ap-guangzhou.myqcloud.com/images/ldy111.jpg">
|
|
@ -0,0 +1,38 @@
|
|||
# Finclip SDK的总体架构
|
||||
```mermaid
|
||||
flowchart LR
|
||||
electron --> npm
|
||||
C++ --> cpp
|
||||
pyqt ---> pip
|
||||
subgraph 应用
|
||||
pyqt
|
||||
electron
|
||||
C++
|
||||
end
|
||||
pip --> cpp
|
||||
npm --> cpp
|
||||
subgraph SDK
|
||||
npm
|
||||
pip
|
||||
cpp(c api)
|
||||
end
|
||||
SDK <--> 小程序进程
|
||||
|
||||
subgraph 小程序进程
|
||||
end
|
||||
```
|
||||
|
||||
如上图所示, Finclip SDK 的核心由 C++ 实现, 对外提供 C api, 对于部分语言, 我们根据实际情况提供了额外的库, 如 pyqt, electron 等.
|
||||
对于无法直接调用C api的语言, 也可以使用dlopen等手段集成
|
||||
|
||||
# 集成步骤
|
||||
|
||||
1. 下载release包, 参考demo, 解压至相应的目录
|
||||
2. 根据实际情况下载语言库和头文件, 参考demo, 解压至相应的目录
|
||||
3. 根据demo和实际情况, 完成集成
|
||||
|
||||
# demo位置
|
||||
|
||||
参见首页表格
|
||||
|
||||
https://github.com/finogeeks/finclip-win32-demo
|
|
@ -0,0 +1,10 @@
|
|||
此处展示各种语言集成finclip的demo, 每个demo应完整的包含以下功能:
|
||||
|
||||
- 启动finclip
|
||||
- 启动参数的设置
|
||||
- 启动回调
|
||||
- 设置窗口位置
|
||||
- 自定义api
|
||||
- 宿主 -> 小程序
|
||||
- 宿主 -> h5
|
||||
- h5 -> 宿主
|
|
@ -0,0 +1,48 @@
|
|||
# finclip-electron-demo
|
||||
|
||||
## 添加二进制依赖
|
||||
|
||||
下载finclip二进制包到`vendor`的对应目录下,如`vendor/win/x64`
|
||||
|
||||
## 快速开始
|
||||
|
||||
```
|
||||
npm i
|
||||
npm run start
|
||||
```
|
||||
|
||||
## 调用finclip api
|
||||
|
||||
1. 引入finclip依赖包
|
||||
|
||||
注意,只能在electron的主进程使用
|
||||
|
||||
```
|
||||
const finclip = require('finclip');
|
||||
```
|
||||
|
||||
2. 打开finclip窗口
|
||||
|
||||
finclipPath为finclip.exe所在位置,需转换成绝对路径
|
||||
```
|
||||
finclip.start({
|
||||
handle: 0,
|
||||
finclipPath,
|
||||
});
|
||||
```
|
||||
|
||||
3. 关闭finclip窗口
|
||||
|
||||
```
|
||||
finclip.close();
|
||||
```
|
||||
|
||||
4. 设置finclip窗口的位置和大小
|
||||
|
||||
```
|
||||
finclip.setPosition({ width: 800, height: 800, left: 0, top: 0 });
|
||||
```
|
||||
|
||||
## 修改finclip依赖包
|
||||
|
||||
如果默认的finclip包无法满足需求,可以在此项目的`src/npm`下修改并编译,需要先配置C++环境
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"name": "finclip-electron-demo",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "./src/main.js",
|
||||
"scripts": {
|
||||
"start": "npx electron ./src/main.js",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"electron": "^18.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"finclip": "file:../../vendor/win/x64"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
const { app, BrowserWindow, ipcMain } = require('electron');
|
||||
const os = require('os');
|
||||
const path = require('path');
|
||||
const finclip = require('finclip');
|
||||
|
||||
const createMainWindow = () => {
|
||||
const win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, 'mainPreload.js'),
|
||||
},
|
||||
});
|
||||
win.loadFile('../view/index.html');
|
||||
};
|
||||
|
||||
const openFinClipWindow = () => {
|
||||
const finclipPath = path.resolve(__dirname, '../../../vendor/win/x64/finclip.exe');
|
||||
const result = finclip.start({
|
||||
handle: 0,
|
||||
finclipPath,
|
||||
});
|
||||
console.log(result);
|
||||
};
|
||||
|
||||
const closeFinClipWindow = () => {
|
||||
const result = finclip.close();
|
||||
console.log(result);
|
||||
};
|
||||
|
||||
ipcMain.on('OPEN_FINCLIP_WINDOW', (event, arg) => {
|
||||
openFinClipWindow();
|
||||
});
|
||||
|
||||
ipcMain.on('CLOSE_FINCLIP_WINDOW', (event, arg) => {
|
||||
closeFinClipWindow();
|
||||
});
|
||||
|
||||
ipcMain.on('SET_FINCLIP_POSITION', (event, arg) => {
|
||||
const { left, top, width, height } = arg;
|
||||
const result = finclip.setAppletPos({
|
||||
left, top,
|
||||
width, height,
|
||||
});
|
||||
console.log(result);
|
||||
});
|
||||
|
||||
app.whenReady().then(() => {
|
||||
createMainWindow();
|
||||
});
|
|
@ -0,0 +1,10 @@
|
|||
const { contextBridge, ipcRenderer } = require('electron');
|
||||
|
||||
contextBridge.exposeInMainWorld(
|
||||
'finclip',
|
||||
{
|
||||
open: () => ipcRenderer.send('OPEN_FINCLIP_WINDOW'),
|
||||
close: () => ipcRenderer.send('CLOSE_FINCLIP_WINDOW'),
|
||||
setPosition: (payload) => ipcRenderer.send('SET_FINCLIP_POSITION', payload),
|
||||
}
|
||||
)
|
|
@ -0,0 +1,15 @@
|
|||
window.openFinClipWindow = () => {
|
||||
finclip.open();
|
||||
};
|
||||
|
||||
window.closeFinClipWindow = () => {
|
||||
finclip.close();
|
||||
};
|
||||
|
||||
window.setFinClipPosition = () => {
|
||||
const left = +document.getElementById('left').value || 0;
|
||||
const top = +document.getElementById('top').value || 0;
|
||||
const width = +document.getElementById('width').value || 640;
|
||||
const height = +document.getElementById('height').value || 480;
|
||||
finclip.setPosition({ width, height, left, top });
|
||||
};
|
|
@ -0,0 +1,17 @@
|
|||
<html>
|
||||
<head></head>
|
||||
<body>
|
||||
<div>
|
||||
<button onclick="openFinClipWindow()">open</button>
|
||||
<button onclick="closeFinClipWindow()">close</button>
|
||||
</div>
|
||||
<div>
|
||||
left<input type="number" id="left" name="left" value="10">
|
||||
top<input type="number" id="top" name="top" value="10">
|
||||
width<input type="number" id="width" name="width" value="1000">
|
||||
height<input type="number" id="height" name="height" value="1000">
|
||||
<button onclick="setFinClipPosition()">set position</button>
|
||||
</div>
|
||||
</body>
|
||||
<script src="../src/mainScript.js"></script>
|
||||
</html>
|
|
@ -0,0 +1,21 @@
|
|||
set(CMAKE_C_COMPILER gcc)
|
||||
project(FinClipGTK C)
|
||||
|
||||
# Use the package PkgConfig to detect GTK+ headers/library files
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(GTK REQUIRED gtk+-3.0)
|
||||
|
||||
set(FINCLIP_GTK_DEMO "FinClipGTK")
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/$<$<CONFIG:Debug>:>)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/$<$<CONFIG:Debug>:>)
|
||||
|
||||
# Add other flags to the compiler
|
||||
add_definitions(${GTK_CFLAGS_OTHER})
|
||||
add_executable(${FINCLIP_GTK_DEMO} main.c)
|
||||
target_include_directories(${FINCLIP_GTK_DEMO} PRIVATE ${GTK_INCLUDE_DIRS})
|
||||
target_include_directories(${FINCLIP_GTK_DEMO} PRIVATE FinClipSDKWrapper)
|
||||
add_dependencies(${FINCLIP_GTK_DEMO} FinClipSDKWrapper)
|
||||
target_link_libraries(${FINCLIP_GTK_DEMO} FinClipSDKWrapper ${GTK_LIBRARIES})
|
||||
|
||||
set(OUTPUT_FILE FinClipGTK)
|
||||
copy_files("${FINCLIP_GTK_DEMO}" "${OUTPUT_FILE}" "${CMAKE_BINARY_DIR}" "${CMAKE_BINARY_DIR}/core/$<CONFIGURATION>")
|
|
@ -0,0 +1,191 @@
|
|||
/**
|
||||
* Demo GTK+ Application that illustrates data entry.
|
||||
*
|
||||
* M. Horauer
|
||||
*/
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib.h>
|
||||
#include <glib/gprintf.h>
|
||||
#include <stddef.h>
|
||||
#include "../../wrapper/src/public/finclip_wrapper.h"
|
||||
|
||||
typedef struct {
|
||||
GtkWidget *dateDate;
|
||||
GtkWidget *idNbr;
|
||||
GtkWidget *emailAddr;
|
||||
GtkWidget *gnameEntry;
|
||||
GtkWidget *fnameEntry;
|
||||
GtkWidget *streetEntry;
|
||||
GtkWidget *cityEntry;
|
||||
GtkWidget *zipEntry;
|
||||
GtkWidget *phoneEntry;
|
||||
GtkWidget *byearSpin;
|
||||
GtkWidget *bmonthSpin;
|
||||
GtkWidget *bdaySpin;
|
||||
} diaWidgets;
|
||||
|
||||
typedef struct {
|
||||
GtkApplication *app;
|
||||
GtkWidget *window;
|
||||
GtkWidget *img;
|
||||
diaWidgets *d;
|
||||
} appWidgets;
|
||||
|
||||
/***************************************************************** PROTOTYPES */
|
||||
static void activate(GtkApplication *app, gpointer user_data);
|
||||
static void cancel_callback(GtkWidget *widget, gpointer user_data);
|
||||
static void clear_callback(GtkWidget *widget, gpointer user_data);
|
||||
static void add_callback(GtkWidget *widget, gpointer user_data);
|
||||
static gint get_next_id(void);
|
||||
static gint get_next_id(void) { return 12; }
|
||||
|
||||
/************************************************************ Cancel Callback */
|
||||
static void cancel_callback(GtkWidget *widget, gpointer user_data) {}
|
||||
|
||||
/************************************************************* Clear Callback */
|
||||
static void clear_callback(GtkWidget *widget, gpointer user_data) {
|
||||
finclip_close_all_applet();
|
||||
}
|
||||
|
||||
/*************************************************************** Add Callback */
|
||||
static void add_callback(GtkWidget *widget, gpointer user_data) {
|
||||
IPackerFactory *factory = finclip_get_packer_factory();
|
||||
IFinConfigPacker *packer = finclip_packer_factory_get_config_packer(factory);
|
||||
IFinConfig *config = finclip_config_packer_new_config(packer);
|
||||
finclip_config_set_app_store(config, 1);
|
||||
finclip_config_set_app_key(config,
|
||||
"22LyZEib0gLTQdU3MUauAQVLIkNNhTSGIN42gXzlAsk=");
|
||||
finclip_config_set_secret(config, "ae55433be2f62915");
|
||||
finclip_config_set_domain(config, "https://finchat-mop-b.finogeeks.club");
|
||||
finclip_config_packer_add_config(packer, config);
|
||||
finclip_initialize(packer);
|
||||
finclip_start_applet(NULL, 1, "60e3c059949a5300014d0c07", "", NULL, "", NULL);
|
||||
}
|
||||
|
||||
/********************************************************* nameentry_callback */
|
||||
static void nameentry_callback(GtkWidget *widget, gpointer user_data) {
|
||||
gint study_prog_nr = 54;
|
||||
gchar *org = "uni";
|
||||
gchar *cnt = "net";
|
||||
gchar *gname;
|
||||
gchar *fname;
|
||||
gchar email[256];
|
||||
gchar dateStamp[256];
|
||||
gchar *year;
|
||||
gchar id[256] = "";
|
||||
appWidgets *a = (appWidgets *)user_data;
|
||||
|
||||
/* construct the eMail address */
|
||||
gname = (gchar *)gtk_entry_get_text(GTK_ENTRY(a->d->gnameEntry));
|
||||
fname = (gchar *)gtk_entry_get_text(GTK_ENTRY(a->d->fnameEntry));
|
||||
/* we update the fields on the top only when we got a family name */
|
||||
if ((g_strcmp0(gname, "") != 0) && (g_strcmp0(fname, "") != 0)) {
|
||||
g_sprintf(email, "%s.%s@%s.%s", gname, fname, org, cnt);
|
||||
gtk_label_set_label(GTK_LABEL(a->d->emailAddr), email);
|
||||
/* update date info when Family Name was entered */
|
||||
gtk_label_set_label(GTK_LABEL(a->d->dateDate), dateStamp);
|
||||
/* construct matrnum when Family Name was entered */
|
||||
year = g_strndup(dateStamp, 4);
|
||||
g_snprintf(id, 10, "%s%d%03d", year, study_prog_nr, get_next_id());
|
||||
gtk_label_set_label(GTK_LABEL(a->d->idNbr), id);
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************** ADD WINDOW */
|
||||
static void activate(GtkApplication *app, gpointer user_data) {
|
||||
GtkWidget *box;
|
||||
GtkWidget *ebox;
|
||||
GtkWidget *grid;
|
||||
GtkWidget *date_label;
|
||||
GtkWidget *id_label;
|
||||
GtkWidget *email_label;
|
||||
GtkWidget *gname_label;
|
||||
GtkWidget *fname_label;
|
||||
GtkWidget *street_label;
|
||||
GtkWidget *city_label;
|
||||
GtkWidget *zip_label;
|
||||
GtkWidget *phone_label;
|
||||
GtkWidget *birth_label;
|
||||
GtkWidget *c_button;
|
||||
GtkWidget *l_button;
|
||||
GtkWidget *a_button;
|
||||
appWidgets *a = (appWidgets *)user_data;
|
||||
|
||||
/* create a window with title, default size,and icons */
|
||||
a->window = gtk_application_window_new(a->app);
|
||||
gtk_window_set_application(GTK_WINDOW(a->window), GTK_APPLICATION(a->app));
|
||||
gtk_window_set_title(GTK_WINDOW(a->window), "Student Management Toolbox");
|
||||
gtk_window_set_default_size(GTK_WINDOW(a->window), 400, 300);
|
||||
gtk_window_set_resizable(GTK_WINDOW(a->window), FALSE);
|
||||
|
||||
box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4);
|
||||
gtk_container_add(GTK_CONTAINER(a->window), GTK_WIDGET(box));
|
||||
gtk_container_set_border_width(GTK_CONTAINER(a->window), 10);
|
||||
|
||||
/* grid: image and labels */
|
||||
grid = gtk_grid_new();
|
||||
gtk_grid_set_column_spacing(GTK_GRID(grid), 5);
|
||||
gtk_grid_set_row_spacing(GTK_GRID(grid), 5);
|
||||
gtk_widget_set_size_request(GTK_WIDGET(grid), 400, 90);
|
||||
gtk_widget_set_valign(GTK_WIDGET(grid), GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_halign(GTK_WIDGET(grid), GTK_ALIGN_CENTER);
|
||||
gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(grid), TRUE, TRUE, 0);
|
||||
|
||||
gname_label = gtk_widget_new(GTK_TYPE_LABEL, "label", "Appid", "xalign", 1.0,
|
||||
"yalign", 0.5, NULL);
|
||||
gtk_grid_attach(GTK_GRID(grid), GTK_WIDGET(gname_label), 0, 3, 1, 1);
|
||||
a->d->gnameEntry = gtk_entry_new();
|
||||
gtk_grid_attach(GTK_GRID(grid), GTK_WIDGET(a->d->gnameEntry), 1, 3, 1, 1);
|
||||
|
||||
street_label = gtk_widget_new(GTK_TYPE_LABEL, "label", "secret:", "xalign",
|
||||
1.0, "yalign", 0.5, NULL);
|
||||
gtk_grid_attach(GTK_GRID(grid), GTK_WIDGET(street_label), 0, 4, 1, 1);
|
||||
a->d->streetEntry = gtk_entry_new();
|
||||
gtk_grid_attach(GTK_GRID(grid), GTK_WIDGET(a->d->streetEntry), 1, 4, 1, 1);
|
||||
|
||||
zip_label = gtk_widget_new(GTK_TYPE_LABEL, "label", "key:", "xalign", 1.0,
|
||||
"yalign", 0.5, NULL);
|
||||
gtk_grid_attach(GTK_GRID(grid), GTK_WIDGET(zip_label), 0, 5, 1, 1);
|
||||
a->d->zipEntry = gtk_entry_new();
|
||||
gtk_grid_attach(GTK_GRID(grid), GTK_WIDGET(a->d->zipEntry), 1, 5, 1, 1);
|
||||
|
||||
phone_label = gtk_widget_new(GTK_TYPE_LABEL, "label", "domain:", "xalign",
|
||||
1.0, "yalign", 0.5, NULL);
|
||||
gtk_grid_attach(GTK_GRID(grid), GTK_WIDGET(phone_label), 2, 5, 1, 1);
|
||||
a->d->phoneEntry = gtk_entry_new();
|
||||
gtk_grid_attach(GTK_GRID(grid), GTK_WIDGET(a->d->phoneEntry), 3, 5, 1, 1);
|
||||
|
||||
/* lowerbox: buttons */
|
||||
c_button = gtk_button_new_with_mnemonic("_Cancel");
|
||||
gtk_grid_attach(GTK_GRID(grid), GTK_WIDGET(c_button), 1, 7, 1, 1);
|
||||
g_signal_connect(G_OBJECT(c_button), "clicked", G_CALLBACK(cancel_callback),
|
||||
(gpointer)a);
|
||||
l_button = gtk_button_new_with_mnemonic("C_lear");
|
||||
gtk_grid_attach(GTK_GRID(grid), GTK_WIDGET(l_button), 2, 7, 1, 1);
|
||||
g_signal_connect(G_OBJECT(l_button), "clicked", G_CALLBACK(clear_callback),
|
||||
(gpointer)a);
|
||||
a_button = gtk_button_new_with_mnemonic("_Add");
|
||||
gtk_grid_attach(GTK_GRID(grid), GTK_WIDGET(a_button), 3, 7, 1, 1);
|
||||
g_signal_connect(G_OBJECT(a_button), "clicked", G_CALLBACK(add_callback),
|
||||
(gpointer)a);
|
||||
|
||||
gtk_widget_show_all(GTK_WIDGET(a->window));
|
||||
}
|
||||
|
||||
/*********************************************************************** main */
|
||||
int main(int argc, char **argv) {
|
||||
int status;
|
||||
appWidgets *a = g_malloc(sizeof(appWidgets));
|
||||
a->d = g_malloc(sizeof(diaWidgets));
|
||||
|
||||
a->app = gtk_application_new("org.gtk.example", G_APPLICATION_FLAGS_NONE);
|
||||
g_signal_connect(G_OBJECT(a->app), "activate", G_CALLBACK(activate),
|
||||
(gpointer)a);
|
||||
status = g_application_run(G_APPLICATION(a->app), argc, argv);
|
||||
g_object_unref(a->app);
|
||||
|
||||
g_free(a->d);
|
||||
g_free(a);
|
||||
return status;
|
||||
}
|
||||
/** EOF */
|
|
@ -0,0 +1,6 @@
|
|||
# 下载base包
|
||||
|
||||
|
||||
# 下载python包
|
||||
|
||||
# demo接受
|
|
@ -0,0 +1,105 @@
|
|||
from PyQt5.QtWidgets import (QApplication, QComboBox, QDialog,
|
||||
QDialogButtonBox, QFormLayout, QGridLayout, QGroupBox, QHBoxLayout,
|
||||
QLabel, QLineEdit, QMenu, QMenuBar, QPushButton, QSpinBox, QTextEdit,
|
||||
QVBoxLayout)
|
||||
import finclip
|
||||
import sys
|
||||
import json
|
||||
|
||||
|
||||
class PythonCallback(finclip.Callback):
|
||||
|
||||
# Define Python class 'constructor'
|
||||
def __init__(self):
|
||||
# Call C++ base class constructor
|
||||
finclip.Callback.__init__(self)
|
||||
|
||||
def Run(self, event, param):
|
||||
print(event)
|
||||
print(param)
|
||||
return "{}"
|
||||
|
||||
|
||||
appid = "60e3c059949a5300014d0c07"
|
||||
|
||||
callback = PythonCallback().__disown__()
|
||||
|
||||
|
||||
def start_finclip():
|
||||
factory = finclip.finclip_get_packer_factory()
|
||||
packer = finclip.finclip_packer_factory_get_config_packer(factory)
|
||||
config = finclip.finclip_config_packer_new_config(packer)
|
||||
finclip.finclip_config_set_app_store(config, 1)
|
||||
finclip.finclip_config_set_app_key(config,
|
||||
"22LyZEib0gLTQdU3MUauAQVLIkNNhTSGIN42gXzlAsk=")
|
||||
finclip.finclip_config_set_secret(config, "ae55433be2f62915")
|
||||
finclip.finclip_config_set_domain(
|
||||
config, "https://finchat-mop-b.finogeeks.club")
|
||||
if sys.platform == 'win32':
|
||||
finclip.finclip_config_set_value(
|
||||
config, finclip.FINCLIP_CONFIG_EXE_PATH, "C:/project/finclipsdk-desktop/build/core/Debug/finclip.exe")
|
||||
finclip.finclip_config_packer_add_config(packer, config)
|
||||
# callback.thisown = 0
|
||||
finclip.finclip_register_callback_cpp(
|
||||
packer, finclip.kApplet, "test", callback)
|
||||
finclip.finclip_register_callback_cpp(
|
||||
packer, finclip.kWebView, "test_webapi", PythonCallback().__disown__())
|
||||
finclip.finclip_initialize(packer)
|
||||
finclip.finclip_start_applet(1, appid)
|
||||
print("---------------------------------" + str(callback.thisown))
|
||||
|
||||
|
||||
x = {
|
||||
"name": "John",
|
||||
"age": 30,
|
||||
"city": "New York"
|
||||
}
|
||||
|
||||
|
||||
def send_webapi():
|
||||
print(123)
|
||||
finclip.finclip_invoke_api_cpp(
|
||||
finclip.kWebView, appid, "test", json.dumps(x), PythonCallback().__disown__())
|
||||
|
||||
|
||||
class Dialog(QDialog):
|
||||
NumGridRows = 3
|
||||
NumButtons = 4
|
||||
|
||||
def __init__(self):
|
||||
super(Dialog, self).__init__()
|
||||
self.createFormGroupBox()
|
||||
|
||||
buttonBox = QDialogButtonBox(
|
||||
QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
|
||||
buttonBox.accepted.connect(self.accept)
|
||||
buttonBox.rejected.connect(self.reject)
|
||||
|
||||
mainLayout = QVBoxLayout()
|
||||
mainLayout.addWidget(self.formGroupBox)
|
||||
# mainLayout.addWidget(buttonBox)
|
||||
self.setLayout(mainLayout)
|
||||
|
||||
self.setWindowTitle("Form Layout - pythonspot.com")
|
||||
|
||||
def createFormGroupBox(self):
|
||||
startBtn = QPushButton(self)
|
||||
startBtn.setText("start finclip")
|
||||
startBtn.clicked.connect(start_finclip)
|
||||
webapiBtn = QPushButton(self)
|
||||
webapiBtn.setText("invoke webapi")
|
||||
webapiBtn.clicked.connect(send_webapi)
|
||||
self.formGroupBox = QGroupBox("Form layout")
|
||||
layout = QFormLayout()
|
||||
layout.addRow(QLabel("Name:"), QLineEdit())
|
||||
layout.addRow(QLabel("Country:"), QComboBox())
|
||||
layout.addRow(QLabel("Age:"), QSpinBox())
|
||||
layout.addWidget(startBtn)
|
||||
layout.addWidget(webapiBtn)
|
||||
self.formGroupBox.setLayout(layout)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = QApplication(sys.argv)
|
||||
dialog = Dialog()
|
||||
sys.exit(dialog.exec_())
|
|
@ -0,0 +1,65 @@
|
|||
## 📦 安装第三方依赖
|
||||
Windows 小程序运行环境需要安装以下依赖,请提前配置环境:
|
||||
- 请下载依赖包[点我下载](https://public-1251849568.cos.ap-guangzhou.myqcloud.com/sdk/lib.zip)
|
||||
- 下载完后解压到vendor/finclip目录中
|
||||
- 建议使用 Visual Studio 2019 版本 [点我下载](https://support.microsoft.com/en-us/topic/the-latest-supported-visual-c-downloads-2647da03-1eea-4433-9aff-95f26a218cc0)
|
||||
|
||||
**注意:依赖包必须随缩主程序一同发布,并在独立目录中存放。**
|
||||
|
||||
解压后文件目录结构如下:
|
||||
|
||||
```
|
||||
vendor
|
||||
|--finclip
|
||||
| |--lib
|
||||
| |--****
|
||||
| |--****
|
||||
| |--****
|
||||
...
|
||||
```
|
||||
|
||||
|
||||
### 第一步 引入头文件
|
||||
|
||||
```c++
|
||||
#include "finclip_wrapper.h" //引入头文件
|
||||
#pragma comment(lib, "FinClipSDKWrapper.lib") //引入链接库
|
||||
```
|
||||
|
||||
### 第二步 初始化SDK
|
||||
|
||||
```c++
|
||||
FinConfig config = {
|
||||
1,
|
||||
"https://api.finclip.com",
|
||||
"/api/v1/mop",
|
||||
"这里输入SDK KEY",
|
||||
"这里输入SDK SECRET",
|
||||
"",
|
||||
1
|
||||
};
|
||||
IFinConfigPacker* configpacker = NewFinConfigPacker();
|
||||
configpacker->AddConfig(config);
|
||||
Initialize(hInstance, configpacker);
|
||||
```
|
||||
|
||||
- **SDK KEY** 和 **SDK SECRET** 可以从 [FinClip](https://finclip.com/#/home) 获取,点 [这里](https://finclip.com/#/register) 注册账号;
|
||||
- 进入平台后,在「应用管理」页面添加你自己的包名后,点击「复制」即可获得 key\secret\apisever 字段;
|
||||
- **apiServer** 和 **apiPrefix** 是固定字段,请直接参考本 DEMO ;
|
||||
- **小程序 ID** 是管理后台上架的小程序 APP ID,需要在「小程序管理」中创建并在「应用管理」中关联;
|
||||
> 小程序 ID 与 微信小程序ID 不一样哦!(这里是特指 FinClip 平台的 ID )
|
||||
|
||||
|
||||
### 第三步 打开小程序
|
||||
|
||||
```c++
|
||||
int server_type = 1;
|
||||
init_finclipsdk(server_type,wappkey, wsecret);
|
||||
IFinPacker* packer = NewFinPacker();
|
||||
packer->BeginPacker();
|
||||
packer->AddField("appId");
|
||||
packer->AddValue("appId");
|
||||
packer->EndPacker();
|
||||
StartApplet(server_type, utf8_encode(wappid).c_str(), packer, finclip_applet_callback);
|
||||
packer->Release();
|
||||
```
|
|
@ -0,0 +1,466 @@
|
|||
// FinClip.cpp : Defines the entry point for the application.
|
||||
//
|
||||
#include "../../src/finclip_api.h"
|
||||
#include "resource.h"
|
||||
|
||||
// Windows Header Files
|
||||
#include <windows.h>
|
||||
// C RunTime Header Files
|
||||
#include <malloc.h>
|
||||
#include <memory.h>
|
||||
#include <tchar.h>
|
||||
#include <winuser.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include "json.hpp"
|
||||
|
||||
#pragma comment(lib, "../../vendor/win/x64/FinClipSDKWrapper.lib")
|
||||
|
||||
#define MAX_LOADSTRING 100
|
||||
|
||||
using namespace std;
|
||||
HINSTANCE hInst;
|
||||
HWND gHwnd; // current instance
|
||||
WCHAR szTitle[MAX_LOADSTRING]; // The title bar text
|
||||
WCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name
|
||||
|
||||
ATOM MyRegisterClass(HINSTANCE hInstance);
|
||||
ATOM MyRegisterClass1(HINSTANCE hInstance);
|
||||
BOOL InitInstance(HINSTANCE, int);
|
||||
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
HWND hWnd_appkey;
|
||||
HWND hWnd_secret;
|
||||
HWND hWnd_appid;
|
||||
HWND hWnd_domain;
|
||||
HWND hWnd_type;
|
||||
HWND hWnd_container;
|
||||
HWND hWnd_applet;
|
||||
BOOL is_initialized = FALSE;
|
||||
std::string offline_base_path;
|
||||
std::string offline_applet_path;
|
||||
|
||||
std::string Utf8Encode(const std::wstring& wstr, int cp = CP_UTF8) {
|
||||
if (wstr.empty()) return std::string();
|
||||
int size_needed =
|
||||
WideCharToMultiByte(cp, 0, &wstr[0], static_cast<int>(wstr.size()),
|
||||
nullptr, 0, nullptr, nullptr);
|
||||
std::string str(size_needed, 0);
|
||||
WideCharToMultiByte(cp, 0, &wstr[0], static_cast<int>(wstr.size()), &str[0],
|
||||
size_needed, nullptr, nullptr);
|
||||
return str;
|
||||
}
|
||||
|
||||
// Convert an UTF8 string to a wide Unicode String
|
||||
std::wstring Utf8Decode(const std::string& str, int cp = CP_UTF8) {
|
||||
if (str.empty()) return std::wstring();
|
||||
int size_needed = MultiByteToWideChar(
|
||||
cp, 0, &str[0], static_cast<int>(str.size()), nullptr, 0);
|
||||
std::wstring wstr(size_needed, 0);
|
||||
MultiByteToWideChar(cp, 0, &str[0], static_cast<int>(str.size()), &wstr[0],
|
||||
size_needed);
|
||||
return wstr;
|
||||
}
|
||||
|
||||
int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
_In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine,
|
||||
_In_ int nCmdShow) {
|
||||
SetProcessDPIAware();
|
||||
UNREFERENCED_PARAMETER(hPrevInstance);
|
||||
UNREFERENCED_PARAMETER(lpCmdLine);
|
||||
|
||||
LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
|
||||
LoadStringW(hInstance, IDC_FINCLIPWIN32DEMO, szWindowClass, MAX_LOADSTRING);
|
||||
|
||||
MyRegisterClass(hInstance);
|
||||
MyRegisterClass1(hInstance);
|
||||
if (InitInstance(hInstance, nCmdShow) == 0) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
HACCEL hAccelTable = LoadAccelerators(hInstance, nullptr);
|
||||
|
||||
MSG msg;
|
||||
|
||||
while (GetMessage(&msg, nullptr, 0, 0)) {
|
||||
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
|
||||
return static_cast<int>(msg.wParam);
|
||||
}
|
||||
|
||||
ATOM MyRegisterClass(HINSTANCE hInstance) {
|
||||
WNDCLASSEXW wcex;
|
||||
|
||||
wcex.cbSize = sizeof(WNDCLASSEX);
|
||||
|
||||
wcex.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wcex.lpfnWndProc = WndProc;
|
||||
wcex.cbClsExtra = 0;
|
||||
wcex.cbWndExtra = 0;
|
||||
wcex.hInstance = hInstance;
|
||||
wcex.hIcon = LoadIcon(hInstance, nullptr);
|
||||
wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
|
||||
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
||||
wcex.lpszMenuName = nullptr;
|
||||
wcex.lpszClassName = szWindowClass;
|
||||
wcex.hIconSm = LoadIcon(wcex.hInstance, nullptr);
|
||||
|
||||
return RegisterClassExW(&wcex);
|
||||
}
|
||||
|
||||
ATOM MyRegisterClass1(HINSTANCE hInstance) {
|
||||
WNDCLASSEXW wcex;
|
||||
|
||||
wcex.cbSize = sizeof(WNDCLASSEX);
|
||||
|
||||
wcex.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wcex.lpfnWndProc = WndProc;
|
||||
wcex.cbClsExtra = 0;
|
||||
wcex.cbWndExtra = 0;
|
||||
wcex.hInstance = hInstance;
|
||||
wcex.hIcon = LoadIcon(hInstance, nullptr);
|
||||
wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
|
||||
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
||||
wcex.lpszMenuName = nullptr;
|
||||
wcex.lpszClassName = L"child_finclip";
|
||||
wcex.hIconSm = LoadIcon(wcex.hInstance, nullptr);
|
||||
|
||||
return RegisterClassExW(&wcex);
|
||||
}
|
||||
|
||||
//
|
||||
// FUNCTION: InitInstance(HINSTANCE, int)
|
||||
//
|
||||
// PURPOSE: Saves instance handle and creates main window
|
||||
//
|
||||
// COMMENTS:
|
||||
//
|
||||
// In this function, we save the instance handle in a global variable and
|
||||
// create and display the main program window.
|
||||
//
|
||||
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) {
|
||||
hInst = hInstance; // Store instance handle in our global variable
|
||||
HWND hwnd =
|
||||
CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,
|
||||
0, 1000, 1200, nullptr, nullptr, hInstance, nullptr);
|
||||
HMONITOR hmon = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
|
||||
MONITORINFO mi = {sizeof(mi)};
|
||||
if (!GetMonitorInfo(hmon, &mi)) return FALSE;
|
||||
if (hwnd == nullptr) {
|
||||
return FALSE;
|
||||
}
|
||||
int width = 450;
|
||||
int height = 1000;
|
||||
SetWindowPos(hwnd, nullptr, mi.rcMonitor.left, mi.rcMonitor.top, width,
|
||||
height, SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
|
||||
gHwnd = hwnd;
|
||||
ShowWindow(hwnd, nCmdShow);
|
||||
UpdateWindow(hwnd);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CustomApi(const char* event, const char* param,
|
||||
FinclipApiCallback callback) {
|
||||
std::string data = param;
|
||||
std::string e = event;
|
||||
std::string res = R"({"data":"ok"})";
|
||||
callback(res.c_str());
|
||||
}
|
||||
|
||||
void InitFinclipsdk(int app_store, const std::wstring& wappkey,
|
||||
const std::wstring& wsecret, const std::wstring& wdomain) {
|
||||
if (is_initialized != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::string appkey = Utf8Encode(wappkey);
|
||||
std::string secret = Utf8Encode(wsecret);
|
||||
std::string domain = Utf8Encode(wdomain);
|
||||
|
||||
auto* factory = finclip_get_packer_factory();
|
||||
auto* packer = finclip_packer_factory_get_config_packer(factory);
|
||||
auto* config = finclip_config_packer_new_config(packer);
|
||||
finclip_config_packer_add_config(packer, config);
|
||||
finclip_config_set_app_store(config, app_store);
|
||||
finclip_config_set_app_key(config, appkey.c_str());
|
||||
finclip_config_set_secret(config, secret.c_str());
|
||||
finclip_config_set_domain(config, domain.c_str());
|
||||
finclip_config_set_start_flag(config, kAppletSync);
|
||||
finclip_config_set_show_loading(config, false);
|
||||
finclip_register_callback(packer, kApplet, "api", CustomApi);
|
||||
finclip_register_callback(packer, kWebView, "webapi", CustomApi);
|
||||
|
||||
finclip_initialize(packer);
|
||||
is_initialized = TRUE;
|
||||
}
|
||||
|
||||
// void FinclipAppletCallback(IEvent* event) {
|
||||
// std::string buffer = event->GetBuffer();
|
||||
// if (event->IsEmpty() == 0) {
|
||||
// const char* val = event->GetStr("hWnd");
|
||||
// std::string s(val);
|
||||
// hWnd_applet = (HWND)strtoul(s.c_str(), nullptr, 16);
|
||||
// }
|
||||
// event->Release();
|
||||
// }
|
||||
|
||||
// window procedure
|
||||
// 定义窗口的行为
|
||||
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
|
||||
LPARAM lParam) {
|
||||
switch (message) {
|
||||
case WM_COMMAND:
|
||||
if (LOWORD(wParam) == IDM_SENDMESSAGE) {
|
||||
WCHAR appid[1024];
|
||||
GetWindowText(hWnd_appid, appid, 1023);
|
||||
std::wstring wappid(appid);
|
||||
// CleanCache();
|
||||
break;
|
||||
}
|
||||
// 打开隐藏小程序进程的例子
|
||||
if (LOWORD(wParam) == IDM_SENDMESSAGE_1) {
|
||||
// 小程序启动过一次, 调用unbind后, 再次打开
|
||||
WCHAR appid[1024];
|
||||
GetWindowText(hWnd_appid, appid, 1023);
|
||||
std::wstring wappid(appid);
|
||||
// 重新显示小程序
|
||||
// StartApplet(hWnd_container, 0, Utf8Encode(wappid).c_str(), "",
|
||||
// nullptr,
|
||||
// "", nullptr);
|
||||
// 宿主处理自己的窗口
|
||||
ShowWindow(hWnd_container, SW_SHOWNORMAL);
|
||||
break;
|
||||
}
|
||||
if (LOWORD(wParam) == IDM_SENDMESSAGE_2) {
|
||||
// 关闭但不销毁(隐藏)小程序进程,
|
||||
// CloseApplet(hWnd_container, false);
|
||||
// 宿主处理自己的窗口
|
||||
ShowWindow(hWnd_container, SW_HIDE);
|
||||
break;
|
||||
}
|
||||
// open按钮处理逻辑
|
||||
if (LOWORD(wParam) == IDM_START_APPLET) {
|
||||
WCHAR key[1024];
|
||||
GetWindowText(hWnd_appkey, key, 1023);
|
||||
WCHAR secret[1024];
|
||||
GetWindowText(hWnd_secret, secret, 1023);
|
||||
WCHAR appid[1024];
|
||||
GetWindowText(hWnd_appid, appid, 1023);
|
||||
WCHAR domain[1024];
|
||||
GetWindowText(hWnd_domain, domain, 1023);
|
||||
WCHAR type[1024];
|
||||
GetWindowText(hWnd_type, type, 1023);
|
||||
std::wstring wappkey(key);
|
||||
std::wstring wsecret(secret);
|
||||
std::wstring wappid(appid);
|
||||
std::wstring wdomain(domain);
|
||||
std::wstring wtype(type);
|
||||
int appstore = 1;
|
||||
if (wappkey.length() == 0) {
|
||||
MessageBox(nullptr, L"无效的appKey", L"错误", 0);
|
||||
return 0;
|
||||
}
|
||||
if (wsecret.length() == 0) {
|
||||
MessageBox(nullptr, L"无效的Secret", L"错误", 0);
|
||||
return 0;
|
||||
}
|
||||
if (wappid.length() == 0) {
|
||||
MessageBox(nullptr, L"无效的appid", L"错误", 0);
|
||||
return 0;
|
||||
}
|
||||
if (wdomain.length() == 0) {
|
||||
MessageBox(nullptr, L"无效的domain", L"错误", 0);
|
||||
return 0;
|
||||
}
|
||||
if (wtype.length() == 0) {
|
||||
MessageBox(nullptr, L"无效的type", L"错误", 0);
|
||||
return 0;
|
||||
}
|
||||
InitFinclipsdk(appstore, wappkey, wsecret, wdomain);
|
||||
// IPackerFactory* factory = GetPackerFactory();
|
||||
// IFinConfigPacker* configpacker = factory->GetFinConfigPacker();
|
||||
// IFinConfig* config = configpacker->GetConfig(appstore);
|
||||
// config->SetAppWindowStyle(std::stol(wtype));
|
||||
// IFinPacker* packer = factory->GetFinPacker();
|
||||
// packer->BeginPacker();
|
||||
// packer->Add("appId", Utf8Encode(wappid).c_str());
|
||||
// packer->Add("query", "1");
|
||||
// packer->EndPacker();
|
||||
// int len = packer->GetBufferSize() + 1;
|
||||
// auto* ret = new unsigned char[len];
|
||||
// memset(ret, 0, len);
|
||||
// packer->Dump(ret, &len);
|
||||
// delete[] ret;
|
||||
|
||||
if (wtype == L"1") {
|
||||
// 嵌入模式, 准备一个窗口, 用于嵌入小程序
|
||||
if (hWnd_container == nullptr) {
|
||||
hWnd_container =
|
||||
CreateWindowW(L"child_finclip", L"child_finclip",
|
||||
WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0, 0, 1024, 768,
|
||||
nullptr, nullptr, hInst, nullptr);
|
||||
}
|
||||
finclip_start_applet(appstore, Utf8Encode(wappid).c_str());
|
||||
|
||||
} else {
|
||||
finclip_start_applet(appstore, Utf8Encode(wappid).c_str());
|
||||
}
|
||||
|
||||
// packer->Release();
|
||||
}
|
||||
break;
|
||||
case WM_SIZE: {
|
||||
if (hWnd_container == hWnd) {
|
||||
// 嵌入模式须重新设置窗口大小
|
||||
WCHAR type[1024];
|
||||
GetWindowText(hWnd_type, type, 1023);
|
||||
std::wstring wtype(type);
|
||||
if (wtype == L"1") {
|
||||
WCHAR appid[1024];
|
||||
GetWindowText(hWnd_appid, appid, 1023);
|
||||
RECT rect;
|
||||
GetClientRect(hWnd_container, &rect);
|
||||
// SetAppletPos(Utf8Encode(std::wstring(appid)).c_str(), 0, 0,
|
||||
// rect.right - rect.left, rect.bottom - rect.top, true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WM_DESTROY: {
|
||||
if (hWnd == hWnd_container) {
|
||||
// 收到WM_DESTROY消息, 表示容器窗口被销毁, 需要SDK的资源
|
||||
// CloseApplet(hWnd, true);
|
||||
hWnd_container = nullptr;
|
||||
return 0;
|
||||
}
|
||||
if (hWnd == gHwnd) {
|
||||
// 只有主窗口关闭时退出进程
|
||||
PostQuitMessage(0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WM_CREATE: {
|
||||
if (hWnd_appkey != nullptr)
|
||||
return DefWindowProcW(hWnd, message, wParam, lParam);
|
||||
CreateWindowW(L"static", L"AppKEY", WS_CHILD | WS_VISIBLE, 20, 20, 60, 30,
|
||||
hWnd, (HMENU)1, ((LPCREATESTRUCT)lParam)->hInstance,
|
||||
nullptr);
|
||||
|
||||
CreateWindowW(L"static", L"Secret", WS_CHILD | WS_VISIBLE, 20, 60, 60, 30,
|
||||
hWnd, (HMENU)2, ((LPCREATESTRUCT)lParam)->hInstance,
|
||||
nullptr);
|
||||
|
||||
CreateWindowW(L"static", L"appid", WS_CHILD | WS_VISIBLE, 20, 100, 60, 30,
|
||||
hWnd, (HMENU)2, ((LPCREATESTRUCT)lParam)->hInstance,
|
||||
nullptr);
|
||||
CreateWindowW(L"static", L"domain", WS_CHILD | WS_VISIBLE, 20, 140, 60,
|
||||
30, hWnd, (HMENU)2, ((LPCREATESTRUCT)lParam)->hInstance,
|
||||
nullptr);
|
||||
|
||||
CreateWindowW(L"static", L"window_type", WS_CHILD | WS_VISIBLE, 20, 180,
|
||||
60, 30, hWnd, (HMENU)2, ((LPCREATESTRUCT)lParam)->hInstance,
|
||||
nullptr);
|
||||
HMONITOR hmon = MonitorFromWindow(hWnd, MONITOR_DEFAULTTONEAREST);
|
||||
MONITORINFO mi = {sizeof(mi)};
|
||||
if (!GetMonitorInfo(hmon, &mi)) return 0;
|
||||
|
||||
wstring domain(L"https://finchat-mop-b.finogeeks.club:443");
|
||||
wstring appkey(L"22LyZEib0gLTQdU3MUauAQVLIkNNhTSGIN42gXzlAsk=");
|
||||
wstring appid(L"60e3c059949a5300014d0c07");
|
||||
wstring secret(L"ae55433be2f62915");
|
||||
|
||||
auto path = std::filesystem::current_path();
|
||||
if (std::filesystem::exists("config.json")) {
|
||||
std::ifstream t("config.json");
|
||||
std::stringstream buffer;
|
||||
buffer << t.rdbuf();
|
||||
auto obj = nlohmann::json::parse(buffer.str());
|
||||
auto field = obj.find("domain");
|
||||
if (field != obj.end() && field.value().is_string()) {
|
||||
auto s = field.value().get<std::string>();
|
||||
domain = wstring(s.begin(), s.end());
|
||||
}
|
||||
field = obj.find("appkey");
|
||||
if (field != obj.end() && field.value().is_string()) {
|
||||
auto s = field.value().get<std::string>();
|
||||
appkey = wstring(s.begin(), s.end());
|
||||
}
|
||||
field = obj.find("appid");
|
||||
if (field != obj.end() && field.value().is_string()) {
|
||||
auto s = field.value().get<std::string>();
|
||||
appid = wstring(s.begin(), s.end());
|
||||
}
|
||||
field = obj.find("secret");
|
||||
if (field != obj.end() && field.value().is_string()) {
|
||||
auto s = field.value().get<std::string>();
|
||||
secret = wstring(s.begin(), s.end());
|
||||
}
|
||||
field = obj.find("offline_applet_path");
|
||||
if (field != obj.end() && field.value().is_string()) {
|
||||
auto s = field.value().get<std::string>();
|
||||
offline_applet_path = string(s.begin(), s.end());
|
||||
}
|
||||
field = obj.find("offline_base_path");
|
||||
if (field != obj.end() && field.value().is_string()) {
|
||||
auto s = field.value().get<std::string>();
|
||||
offline_base_path = string(s.begin(), s.end());
|
||||
}
|
||||
}
|
||||
hWnd_appkey = CreateWindowW(
|
||||
L"EDIT", appkey.c_str(), WS_VISIBLE | WS_CHILD | WS_BORDER | ES_LEFT,
|
||||
100, 20, 300, 30, hWnd, (HMENU)IDM_APPLET_APPKEY,
|
||||
((LPCREATESTRUCT)lParam)->hInstance, nullptr);
|
||||
|
||||
hWnd_secret = CreateWindowW(
|
||||
L"EDIT", secret.c_str(), WS_VISIBLE | WS_CHILD | WS_BORDER | ES_LEFT,
|
||||
100, 60, 300, 30, hWnd, (HMENU)IDM_APPLET_SECRET,
|
||||
((LPCREATESTRUCT)lParam)->hInstance, nullptr);
|
||||
// 5ea0401463cb900001d73865 wxdemo
|
||||
// 5ea0412663cb900001d73867 webview
|
||||
// 5ea6d3bad262a7000141280d quote
|
||||
hWnd_appid = CreateWindowW(
|
||||
L"EDIT", appid.c_str(), WS_VISIBLE | WS_CHILD | WS_BORDER | ES_LEFT,
|
||||
100, 100, 300, 30, hWnd, (HMENU)IDM_APPLET_APPID,
|
||||
((LPCREATESTRUCT)lParam)->hInstance, nullptr);
|
||||
hWnd_domain = CreateWindowW(
|
||||
L"EDIT", domain.c_str(), WS_VISIBLE | WS_CHILD | WS_BORDER | ES_LEFT,
|
||||
100, 140, 300, 30, hWnd, (HMENU)IDM_APPLET_DOMAIN,
|
||||
((LPCREATESTRUCT)lParam)->hInstance, nullptr);
|
||||
|
||||
hWnd_type = CreateWindowW(
|
||||
L"EDIT", L"0", WS_VISIBLE | WS_CHILD | WS_BORDER | ES_LEFT, 100, 180,
|
||||
300, 30, hWnd, (HMENU)IDM_APPLET_DOMAIN,
|
||||
((LPCREATESTRUCT)lParam)->hInstance, nullptr);
|
||||
int button_y = 240;
|
||||
CreateWindowW(L"BUTTON", L"open", WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON,
|
||||
100, button_y, 200, 50, hWnd, (HMENU)IDM_START_APPLET,
|
||||
((LPCREATESTRUCT)lParam)->hInstance, nullptr);
|
||||
button_y += 60;
|
||||
CreateWindowW(L"BUTTON", L"cleancache",
|
||||
WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON, 100, button_y, 200,
|
||||
50, hWnd, (HMENU)IDM_SENDMESSAGE,
|
||||
((LPCREATESTRUCT)lParam)->hInstance, nullptr);
|
||||
button_y += 60;
|
||||
CreateWindowW(L"BUTTON", L"bind_applet",
|
||||
WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON, 100, button_y, 200,
|
||||
50, hWnd, (HMENU)IDM_SENDMESSAGE_1,
|
||||
((LPCREATESTRUCT)lParam)->hInstance, nullptr);
|
||||
button_y += 60;
|
||||
CreateWindowW(L"BUTTON", L"unbind_applet",
|
||||
WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON, 100, button_y, 200,
|
||||
50, hWnd, (HMENU)IDM_SENDMESSAGE_2,
|
||||
((LPCREATESTRUCT)lParam)->hInstance, nullptr);
|
||||
|
||||
} break;
|
||||
}
|
||||
return DefWindowProcW(hWnd, message, wParam, lParam);
|
||||
}
|
|
@ -1,3 +1,3 @@
|
|||
#pragma once
|
||||
|
||||
#include "resource.h"
|
||||
#pragma once
|
||||
|
||||
#include "resource.h"
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
|
@ -1,31 +1,31 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31727.386
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "finclip-win32-demo", "finclip-win32-demo.vcxproj", "{312EA7DE-87CA-49DD-BBFA-6DF955F5355C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{312EA7DE-87CA-49DD-BBFA-6DF955F5355C}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{312EA7DE-87CA-49DD-BBFA-6DF955F5355C}.Debug|x64.Build.0 = Debug|x64
|
||||
{312EA7DE-87CA-49DD-BBFA-6DF955F5355C}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{312EA7DE-87CA-49DD-BBFA-6DF955F5355C}.Debug|x86.Build.0 = Debug|Win32
|
||||
{312EA7DE-87CA-49DD-BBFA-6DF955F5355C}.Release|x64.ActiveCfg = Release|x64
|
||||
{312EA7DE-87CA-49DD-BBFA-6DF955F5355C}.Release|x64.Build.0 = Release|x64
|
||||
{312EA7DE-87CA-49DD-BBFA-6DF955F5355C}.Release|x86.ActiveCfg = Release|Win32
|
||||
{312EA7DE-87CA-49DD-BBFA-6DF955F5355C}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {1609F2ED-B15A-4CCE-AA3D-164B4A6EEEEE}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31727.386
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "finclip-win32-demo", "finclip-win32-demo.vcxproj", "{312EA7DE-87CA-49DD-BBFA-6DF955F5355C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{312EA7DE-87CA-49DD-BBFA-6DF955F5355C}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{312EA7DE-87CA-49DD-BBFA-6DF955F5355C}.Debug|x64.Build.0 = Debug|x64
|
||||
{312EA7DE-87CA-49DD-BBFA-6DF955F5355C}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{312EA7DE-87CA-49DD-BBFA-6DF955F5355C}.Debug|x86.Build.0 = Debug|Win32
|
||||
{312EA7DE-87CA-49DD-BBFA-6DF955F5355C}.Release|x64.ActiveCfg = Release|x64
|
||||
{312EA7DE-87CA-49DD-BBFA-6DF955F5355C}.Release|x64.Build.0 = Release|x64
|
||||
{312EA7DE-87CA-49DD-BBFA-6DF955F5355C}.Release|x86.ActiveCfg = Release|Win32
|
||||
{312EA7DE-87CA-49DD-BBFA-6DF955F5355C}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {1609F2ED-B15A-4CCE-AA3D-164B4A6EEEEE}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -1,193 +1,193 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{312ea7de-87ca-49dd-bbfa-6df955f5355c}</ProjectGuid>
|
||||
<RootNamespace>finclipwin32demo</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IncludePath>vendor\finclip\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>vendor\finclip\lib;$(LibraryPath)</LibraryPath>
|
||||
<OutDir>$(SolutionDir)build\bin\$(Platform)\$(Configuration)</OutDir>
|
||||
<IntDir>$(SolutionDir)build\obj\$(Platform)\$(Configuration)\$(ProjectName)</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>vendor\finclip\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>vendor\finclip\lib;$(LibraryPath)</LibraryPath>
|
||||
<OutDir>$(SolutionDir)build\bin\$(Platform)\$(Configuration)</OutDir>
|
||||
<IntDir>$(SolutionDir)build\obj\$(Platform)\$(Configuration)\$(ProjectName)</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IncludePath>vendor\finclip\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>vendor\finclip\lib;$(LibraryPath)</LibraryPath>
|
||||
<OutDir>$(SolutionDir)build\bin\$(Platform)\$(Configuration)</OutDir>
|
||||
<IntDir>$(SolutionDir)build\obj\$(Platform)\$(Configuration)\$(ProjectName)</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>vendor\finclip\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>vendor\finclip\lib;$(LibraryPath)</LibraryPath>
|
||||
<OutDir>$(SolutionDir)build\bin\$(Platform)\$(Configuration)</OutDir>
|
||||
<IntDir>$(SolutionDir)build\obj\$(Platform)\$(Configuration)\$(ProjectName)</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /Y/E/H/C/I $(SolutionDir)vendor\finclip\lib\* $(SolutionDir)build\bin\$(Platform)\$(Configuration)\ </Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /Y/E/H/C/I $(SolutionDir)vendor\finclip\lib\* $(SolutionDir)build\bin\$(Platform)\$(Configuration)\ </Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /Y/E/H/C/I $(SolutionDir)vendor\finclip\lib\* $(SolutionDir)build\bin\$(Platform)\$(Configuration)\ </Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /Y/E/H/C/I $(SolutionDir)vendor\finclip\lib\* $(SolutionDir)build\bin\$(Platform)\$(Configuration)\ </Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="finclip-win32-demo.h" />
|
||||
<ClInclude Include="framework.h" />
|
||||
<ClInclude Include="json.hpp" />
|
||||
<ClInclude Include="Resource.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="finclip-win32-demo.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="finclip-win32-demo.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="finclip-win32-demo.ico" />
|
||||
<Image Include="small.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{312ea7de-87ca-49dd-bbfa-6df955f5355c}</ProjectGuid>
|
||||
<RootNamespace>finclipwin32demo</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IncludePath>vendor\finclip\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>vendor\finclip\lib;$(LibraryPath)</LibraryPath>
|
||||
<OutDir>$(SolutionDir)build\bin\$(Platform)\$(Configuration)</OutDir>
|
||||
<IntDir>$(SolutionDir)build\obj\$(Platform)\$(Configuration)\$(ProjectName)</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>vendor\finclip\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>vendor\finclip\lib;$(LibraryPath)</LibraryPath>
|
||||
<OutDir>$(SolutionDir)build\bin\$(Platform)\$(Configuration)</OutDir>
|
||||
<IntDir>$(SolutionDir)build\obj\$(Platform)\$(Configuration)\$(ProjectName)</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IncludePath>vendor\finclip\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>vendor\finclip\lib;$(LibraryPath)</LibraryPath>
|
||||
<OutDir>$(SolutionDir)build\bin\$(Platform)\$(Configuration)</OutDir>
|
||||
<IntDir>$(SolutionDir)build\obj\$(Platform)\$(Configuration)\$(ProjectName)</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>vendor\finclip\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>vendor\finclip\lib;$(LibraryPath)</LibraryPath>
|
||||
<OutDir>$(SolutionDir)build\bin\$(Platform)\$(Configuration)</OutDir>
|
||||
<IntDir>$(SolutionDir)build\obj\$(Platform)\$(Configuration)\$(ProjectName)</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /Y/E/H/C/I $(SolutionDir)\..\..\vendor\win\x86\* $(SolutionDir)build\bin\$(Platform)\$(Configuration)\ </Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /Y/E/H/C/I $(SolutionDir)\..\..\vendor\win\x86\* $(SolutionDir)build\bin\$(Platform)\$(Configuration)\ </Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /Y/E/H/C/I $(SolutionDir)\..\..\vendor\win\x64\* $(SolutionDir)build\bin\$(Platform)\$(Configuration)\ </Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /Y/E/H/C/I $(SolutionDir)\..\..\vendor\win\x64\* $(SolutionDir)build\bin\$(Platform)\$(Configuration)\ </Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="finclip-win32-demo.h" />
|
||||
<ClInclude Include="framework.h" />
|
||||
<ClInclude Include="json.hpp" />
|
||||
<ClInclude Include="Resource.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="finclip-win32-demo.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="finclip-win32-demo.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="finclip-win32-demo.ico" />
|
||||
<Image Include="small.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -1,52 +1,52 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="framework.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="targetver.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="finclip-win32-demo.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="json.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="finclip-win32-demo.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="finclip-win32-demo.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="small.ico">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Image>
|
||||
<Image Include="finclip-win32-demo.ico">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="framework.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="targetver.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="finclip-win32-demo.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="json.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="finclip-win32-demo.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="finclip-win32-demo.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="small.ico">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Image>
|
||||
<Image Include="finclip-win32-demo.ico">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -1,15 +1,15 @@
|
|||
// header.h : include file for standard system include files,
|
||||
// or project specific include files
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "targetver.h"
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
// Windows Header Files
|
||||
#include <windows.h>
|
||||
// C RunTime Header Files
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include <memory.h>
|
||||
#include <tchar.h>
|
||||
// header.h : include file for standard system include files,
|
||||
// or project specific include files
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "targetver.h"
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
// Windows Header Files
|
||||
#include <windows.h>
|
||||
// C RunTime Header Files
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include <memory.h>
|
||||
#include <tchar.h>
|
|
@ -0,0 +1,36 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by finclip-win32-demo.rc
|
||||
//
|
||||
#define IDC_MYICON 2
|
||||
#define IDD_FINCLIPWIN32DEMO_DIALOG 102
|
||||
#define IDS_APP_TITLE 103
|
||||
#define IDD_ABOUTBOX 103
|
||||
#define IDM_ABOUT 104
|
||||
#define IDM_EXIT 105
|
||||
#define IDI_FINCLIPWIN32DEMO 107
|
||||
#define IDI_SMALL 108
|
||||
#define IDC_FINCLIPWIN32DEMO 109
|
||||
#define IDR_MAINFRAME 128
|
||||
#define ID_FILE_IDM 32771
|
||||
#define IDM_SENDMESSAGE 32772
|
||||
#define ID_FILE_IDM32773 32773
|
||||
#define IDM_START_APPLET 32774
|
||||
#define IDM_APPLET_APPKEY 32775
|
||||
#define IDM_APPLET_SECRET 32776
|
||||
#define IDM_APPLET_APPID 32777
|
||||
#define IDM_APPLET_DOMAIN 32778
|
||||
#define IDC_STATIC -1
|
||||
#define IDM_SENDMESSAGE_1 32784
|
||||
#define IDM_SENDMESSAGE_2 32785
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NO_MFC 1
|
||||
#define _APS_NEXT_RESOURCE_VALUE 129
|
||||
#define _APS_NEXT_COMMAND_VALUE 32779
|
||||
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||
#define _APS_NEXT_SYMED_VALUE 110
|
||||
#endif
|
||||
#endif
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
// // Including SDKDDKVer.h defines the highest available Windows platform.
|
||||
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
|
||||
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
|
||||
#include <SDKDDKVer.h>
|
||||
#pragma once
|
||||
|
||||
// // Including SDKDDKVer.h defines the highest available Windows platform.
|
||||
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
|
||||
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
|
||||
#include <SDKDDKVer.h>
|
|
@ -1,524 +0,0 @@
|
|||
// FinClip.cpp : Defines the entry point for the application.
|
||||
//
|
||||
#include "Resource.h"
|
||||
#include "vendor/finclip/include/finclip_wrapper.h"
|
||||
// Windows Header Files
|
||||
#include <windows.h>
|
||||
// C RunTime Header Files
|
||||
#include <malloc.h>
|
||||
#include <memory.h>
|
||||
#include <stdlib.h>
|
||||
#include <tchar.h>
|
||||
|
||||
#include "json.hpp"
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#pragma comment(lib, "FinClipSDKWrapper.lib")
|
||||
|
||||
#define MAX_LOADSTRING 100
|
||||
|
||||
using namespace std;
|
||||
using json = nlohmann::json;
|
||||
using namespace com::finogeeks::finclip::wrapper;
|
||||
HINSTANCE hInst;
|
||||
HWND gHwnd; // current instance
|
||||
WCHAR szTitle[MAX_LOADSTRING]; // The title bar text
|
||||
WCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name
|
||||
|
||||
ATOM MyRegisterClass(HINSTANCE hInstance);
|
||||
ATOM MyRegisterClass1(HINSTANCE hInstance);
|
||||
BOOL InitInstance(HINSTANCE, int);
|
||||
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
HWND hWnd_appkey;
|
||||
HWND hWnd_secret;
|
||||
HWND hWnd_appid;
|
||||
HWND hWnd_domain;
|
||||
HWND hWnd_type;
|
||||
HWND hWnd_container;
|
||||
HWND hWnd_applet;
|
||||
BOOL is_initialized = FALSE;
|
||||
RECT g_rect_;
|
||||
std::string offline_base_path;
|
||||
std::string offline_applet_path;
|
||||
|
||||
std::string utf8_encode(const std::wstring &wstr, int CP = CP_UTF8) {
|
||||
if (wstr.empty())
|
||||
return std::string();
|
||||
int size_needed = WideCharToMultiByte(CP, 0, &wstr[0], (int)wstr.size(), NULL,
|
||||
0, NULL, NULL);
|
||||
std::string strTo(size_needed, 0);
|
||||
WideCharToMultiByte(CP, 0, &wstr[0], (int)wstr.size(), &strTo[0], size_needed,
|
||||
NULL, NULL);
|
||||
return strTo;
|
||||
}
|
||||
|
||||
// Convert an UTF8 string to a wide Unicode String
|
||||
std::wstring utf8_decode(const std::string &str, int CP = CP_UTF8) {
|
||||
if (str.empty())
|
||||
return std::wstring();
|
||||
int size_needed =
|
||||
MultiByteToWideChar(CP, 0, &str[0], (int)str.size(), NULL, 0);
|
||||
std::wstring wstrTo(size_needed, 0);
|
||||
MultiByteToWideChar(CP, 0, &str[0], (int)str.size(), &wstrTo[0], size_needed);
|
||||
return wstrTo;
|
||||
}
|
||||
|
||||
class CustomWebApi : public IApi {
|
||||
|
||||
void invoke(const char *event, const char *param, IApiCallback *callback) {
|
||||
|
||||
std::string data = param;
|
||||
std::string e = event;
|
||||
callback->Callback("{\"data\":\"ok\"}");
|
||||
}
|
||||
|
||||
FinClipApiType GetApiType() const { return FinClipApiType::kWebView; }
|
||||
|
||||
const char *apis() { return "customWebApi"; }
|
||||
size_t size() { return 1l; }
|
||||
};
|
||||
|
||||
class CustomApi : public IApi {
|
||||
|
||||
void invoke(const char *event, const char *param, IApiCallback *callback) {
|
||||
|
||||
std::string data = param;
|
||||
std::string e = event;
|
||||
callback->Callback("{\"data\":\"ok\"}");
|
||||
}
|
||||
|
||||
FinClipApiType GetApiType() const { return FinClipApiType::kApplet; }
|
||||
|
||||
const char *apis() { return "customApi"; }
|
||||
size_t size() { return 1l; }
|
||||
};
|
||||
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
|
||||
_In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine,
|
||||
_In_ int nCmdShow) {
|
||||
SetProcessDPIAware();
|
||||
UNREFERENCED_PARAMETER(hPrevInstance);
|
||||
UNREFERENCED_PARAMETER(lpCmdLine);
|
||||
|
||||
LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
|
||||
LoadStringW(hInstance, IDC_FINCLIPWIN32DEMO, szWindowClass, MAX_LOADSTRING);
|
||||
|
||||
MyRegisterClass(hInstance);
|
||||
MyRegisterClass1(hInstance);
|
||||
if (!InitInstance(hInstance, nCmdShow)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
HACCEL hAccelTable = LoadAccelerators(hInstance, NULL);
|
||||
|
||||
MSG msg;
|
||||
|
||||
while (GetMessage(&msg, nullptr, 0, 0)) {
|
||||
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
|
||||
return (int)msg.wParam;
|
||||
}
|
||||
|
||||
ATOM MyRegisterClass(HINSTANCE hInstance) {
|
||||
WNDCLASSEXW wcex;
|
||||
|
||||
wcex.cbSize = sizeof(WNDCLASSEX);
|
||||
|
||||
wcex.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wcex.lpfnWndProc = WndProc;
|
||||
wcex.cbClsExtra = 0;
|
||||
wcex.cbWndExtra = 0;
|
||||
wcex.hInstance = hInstance;
|
||||
wcex.hIcon = LoadIcon(hInstance, NULL);
|
||||
wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
|
||||
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
||||
wcex.lpszMenuName = nullptr;
|
||||
wcex.lpszClassName = szWindowClass;
|
||||
wcex.hIconSm = LoadIcon(wcex.hInstance, NULL);
|
||||
|
||||
return RegisterClassExW(&wcex);
|
||||
}
|
||||
|
||||
ATOM MyRegisterClass1(HINSTANCE hInstance) {
|
||||
WNDCLASSEXW wcex;
|
||||
|
||||
wcex.cbSize = sizeof(WNDCLASSEX);
|
||||
|
||||
wcex.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wcex.lpfnWndProc = WndProc;
|
||||
wcex.cbClsExtra = 0;
|
||||
wcex.cbWndExtra = 0;
|
||||
wcex.hInstance = hInstance;
|
||||
wcex.hIcon = LoadIcon(hInstance, NULL);
|
||||
wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
|
||||
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
||||
wcex.lpszMenuName = nullptr;
|
||||
wcex.lpszClassName = L"child_finclip";
|
||||
wcex.hIconSm = LoadIcon(wcex.hInstance, NULL);
|
||||
|
||||
return RegisterClassExW(&wcex);
|
||||
}
|
||||
|
||||
//
|
||||
// FUNCTION: InitInstance(HINSTANCE, int)
|
||||
//
|
||||
// PURPOSE: Saves instance handle and creates main window
|
||||
//
|
||||
// COMMENTS:
|
||||
//
|
||||
// In this function, we save the instance handle in a global variable and
|
||||
// create and display the main program window.
|
||||
//
|
||||
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) {
|
||||
hInst = hInstance; // Store instance handle in our global variable
|
||||
DWORD dwStyle =
|
||||
WS_OVERLAPPEDWINDOW & ~WS_MAXIMIZEBOX & ~WS_MINIMIZEBOX; //<2F><><EFBFBD>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD>ʽ
|
||||
|
||||
HWND hWnd =
|
||||
CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,
|
||||
0, 1000, 800, nullptr, nullptr, hInstance, nullptr);
|
||||
HMONITOR hmon = MonitorFromWindow(hWnd, MONITOR_DEFAULTTONEAREST);
|
||||
MONITORINFO mi = {sizeof(mi)};
|
||||
if (!GetMonitorInfo(hmon, &mi))
|
||||
return FALSE;
|
||||
if (!hWnd) {
|
||||
return FALSE;
|
||||
}
|
||||
int width = 450;
|
||||
int height = 500;
|
||||
SetWindowPos(hWnd, NULL, mi.rcMonitor.left, mi.rcMonitor.top, width, height,
|
||||
SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
|
||||
gHwnd = hWnd;
|
||||
ShowWindow(hWnd, nCmdShow);
|
||||
UpdateWindow(hWnd);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void init_finclipsdk(int app_store, std::wstring wappkey, std::wstring wsecret,
|
||||
std::wstring wdomain) {
|
||||
if (is_initialized != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::string appkey = utf8_encode(wappkey);
|
||||
std::string secret = utf8_encode(wsecret);
|
||||
std::string domain = utf8_encode(wdomain);
|
||||
|
||||
IPackerFactory *factory = GetPackerFactory();
|
||||
IFinConfigPacker *configpacker = factory->GetFinConfigPacker();
|
||||
IFinConfig *config = configpacker->NewConfig();
|
||||
config->SetAppStore(app_store);
|
||||
config->SetApiPrefix("/api/v1/mop");
|
||||
config->SetAppKey(appkey.c_str());
|
||||
config->SetSecret(secret.c_str());
|
||||
config->SetDomain(domain.c_str());
|
||||
config->SetEncryptType(1);
|
||||
config->SetFinger("");
|
||||
config->SetAppWindowStyle(1);
|
||||
config->SetOfflineApplet(offline_applet_path.data());
|
||||
config->SetOfflineBaseLibrary(offline_base_path.data());
|
||||
config->SetStartFlag(StartFlags::kAppletSync);
|
||||
config->SetShowLoading(0);
|
||||
configpacker->AddConfig(config);
|
||||
auto *c_api = new CustomApi();
|
||||
configpacker->RegisterApi(c_api);
|
||||
auto *c_web_api = new CustomWebApi();
|
||||
configpacker->RegisterApi(c_web_api);
|
||||
Initialize(hInst, configpacker);
|
||||
is_initialized = TRUE;
|
||||
}
|
||||
|
||||
void finclip_applet_callback(IEvent *event) {
|
||||
|
||||
std::string buffer = event->GetBuffer();
|
||||
int i = 0;
|
||||
if (!event->IsEmpty()) {
|
||||
const char *val = event->GetStr("hWnd");
|
||||
std::string s(val);
|
||||
hWnd_applet = (HWND)strtoul(s.c_str(), NULL, 16);
|
||||
}
|
||||
event->Release();
|
||||
}
|
||||
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
|
||||
LPARAM lParam) {
|
||||
HWND hwndButtonCintinue;
|
||||
|
||||
switch (message) {
|
||||
|
||||
case WM_COMMAND:
|
||||
if (LOWORD(wParam) == IDM_SENDMESSAGE) {
|
||||
WCHAR appid[1024];
|
||||
GetWindowText(hWnd_appid, appid, 1023);
|
||||
std::wstring wappid(appid);
|
||||
CleanCache();
|
||||
// if (hWnd_container) {
|
||||
// DestroyWindow(hWnd_container);
|
||||
// }
|
||||
// InvokeWebApi(utf8_encode(wappid).c_str(), "test_custom_api",
|
||||
// "{params:'a'}");
|
||||
break;
|
||||
}
|
||||
if (LOWORD(wParam) == IDM_START_APPLET) {
|
||||
WCHAR key[1024];
|
||||
GetWindowText(hWnd_appkey, key, 1023);
|
||||
WCHAR secret[1024];
|
||||
GetWindowText(hWnd_secret, secret, 1023);
|
||||
WCHAR appid[1024];
|
||||
GetWindowText(hWnd_appid, appid, 1023);
|
||||
WCHAR domain[1024];
|
||||
GetWindowText(hWnd_domain, domain, 1023);
|
||||
WCHAR type[1024];
|
||||
GetWindowText(hWnd_type, type, 1023);
|
||||
std::wstring wappkey(key);
|
||||
std::wstring wsecret(secret);
|
||||
std::wstring wappid(appid);
|
||||
std::wstring wdomain(domain);
|
||||
std::wstring wtype(type);
|
||||
if (wappkey.length() == 0) {
|
||||
MessageBox(NULL, L"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>appKey", L"<EFBFBD><EFBFBD>ʾ", 0);
|
||||
return 0;
|
||||
}
|
||||
if (wsecret.length() == 0) {
|
||||
MessageBox(NULL, L"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Secret", L"<EFBFBD><EFBFBD>ʾ", 0);
|
||||
return 0;
|
||||
}
|
||||
if (wappid.length() == 0) {
|
||||
MessageBox(NULL, L"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>appid", L"<EFBFBD><EFBFBD>ʾ", 0);
|
||||
return 0;
|
||||
}
|
||||
if (wdomain.length() == 0) {
|
||||
MessageBox(NULL, L"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>domain", L"<EFBFBD><EFBFBD>ʾ", 0);
|
||||
return 0;
|
||||
}
|
||||
if (wtype.length() == 0) {
|
||||
MessageBox(NULL, L"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>type", L"<EFBFBD><EFBFBD>ʾ", 0);
|
||||
return 0;
|
||||
}
|
||||
int appstore = 1;
|
||||
IPackerFactory *factory = GetPackerFactory();
|
||||
IFinConfigPacker *configpacker = factory->GetFinConfigPacker();
|
||||
IFinConfig *config = configpacker->GetConfig(appstore);
|
||||
config->SetAppWindowStyle(std::stol(wtype));
|
||||
IFinPacker *packer = factory->GetFinPacker();
|
||||
packer->BeginPacker();
|
||||
packer->Add("appId", utf8_encode(wappid).c_str());
|
||||
packer->Add("query", "1");
|
||||
packer->EndPacker();
|
||||
int len = packer->GetBufferSize() + 1;
|
||||
auto *ret = new unsigned char[len];
|
||||
memset(ret, 0, len);
|
||||
packer->Dump(ret, &len);
|
||||
delete[] ret;
|
||||
if (hWnd_container == nullptr) {
|
||||
// hWnd_container = CreateWindowW(L"child_finclip", L"<22><><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD>",
|
||||
// WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0,
|
||||
// 0, 1920, 1080, NULL, NULL,
|
||||
// hInst, NULL);
|
||||
hWnd_container = CreateWindowW(L"child_finclip", L"<EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD>",
|
||||
WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0, 0,
|
||||
1024, 768, NULL, NULL, hInst, NULL);
|
||||
}
|
||||
HRESULT hr =
|
||||
StartApplet(hWnd_container, appstore, utf8_encode(wappid).c_str(), "",
|
||||
packer, "", finclip_applet_callback);
|
||||
|
||||
if (hr == S_OK) {
|
||||
}
|
||||
// SetWindowPos(h, NULL, 0, 300, 400, 436, 0);
|
||||
packer->Release();
|
||||
}
|
||||
break;
|
||||
case WM_CLOSE: {
|
||||
if (hWnd == hWnd_container) {
|
||||
hWnd_container = NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_SHOWWINDOW: {
|
||||
if (hWnd == hWnd_container) {
|
||||
/*RECT rc;
|
||||
GetWindowRect(hWnd, &rc);
|
||||
auto left = 0;
|
||||
auto top = 0;
|
||||
auto width = rc.right - rc.left;
|
||||
auto height = rc.bottom - rc.top;
|
||||
WCHAR appid[1024];
|
||||
GetWindowText(hWnd_appid, appid, 1023);
|
||||
SetAppletPos(utf8_encode(std::wstring(appid)).c_str(), 1, 0, top, width,
|
||||
height);
|
||||
*/
|
||||
} else {
|
||||
WCHAR key[1024];
|
||||
GetWindowText(hWnd_appkey, key, 1023);
|
||||
WCHAR secret[1024];
|
||||
GetWindowText(hWnd_secret, secret, 1023);
|
||||
WCHAR appid[1024];
|
||||
GetWindowText(hWnd_appid, appid, 1023);
|
||||
WCHAR domain[1024];
|
||||
GetWindowText(hWnd_domain, domain, 1023);
|
||||
std::wstring wappkey(key);
|
||||
std::wstring wsecret(secret);
|
||||
std::wstring wappid(appid);
|
||||
std::wstring wdomain(domain);
|
||||
init_finclipsdk(1, wappkey, wsecret, wdomain);
|
||||
}
|
||||
} break;
|
||||
case WM_SIZE: {
|
||||
WCHAR type[1024];
|
||||
GetWindowText(hWnd_type, type, 1023);
|
||||
std::wstring wtype(type);
|
||||
if (wtype == L"1") {
|
||||
UINT width = LOWORD(lParam);
|
||||
UINT height = HIWORD(lParam);
|
||||
WCHAR appid[1024];
|
||||
GetWindowText(hWnd_appid, appid, 1023);
|
||||
RECT rect;
|
||||
GetClientRect(hWnd_container, &rect);
|
||||
SetAppletPos(utf8_encode(std::wstring(appid)).c_str(), 0, 0,
|
||||
rect.right - rect.left, rect.bottom - rect.top, true);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
// case WM_PAINT:
|
||||
// {
|
||||
// // WCHAR type[1024];
|
||||
// // GetWindowText(hWnd_type, type, 1023);
|
||||
// // std::wstring wtype(type);
|
||||
// // if (wtype == L"1") {
|
||||
// // RECT rect;
|
||||
// // GetClientRect(hWnd_container, &rect);
|
||||
// // WCHAR appid[1024];
|
||||
// // GetWindowText(hWnd_appid, appid, 1023);
|
||||
// // SetAppletPos(
|
||||
// // utf8_encode(std::wstring(appid)).c_str(), 0, 0, rect.right -
|
||||
// rect.left, rect.bottom - rect.top,
|
||||
// // true);
|
||||
// // }
|
||||
// break;
|
||||
// }
|
||||
case WM_DESTROY: {
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
}
|
||||
case WM_CREATE: {
|
||||
if (hWnd_appkey)
|
||||
return DefWindowProcW(hWnd, message, wParam, lParam);
|
||||
CreateWindowW(L"static", L"AppKEY", WS_CHILD | WS_VISIBLE, 20, 20, 60, 30,
|
||||
hWnd, (HMENU)1, ((LPCREATESTRUCT)lParam)->hInstance, NULL);
|
||||
|
||||
CreateWindowW(L"static", L"Secret", WS_CHILD | WS_VISIBLE, 20, 60, 60, 30,
|
||||
hWnd, (HMENU)2, ((LPCREATESTRUCT)lParam)->hInstance, NULL);
|
||||
|
||||
CreateWindowW(L"static", L"appid", WS_CHILD | WS_VISIBLE, 20, 100, 60, 30,
|
||||
hWnd, (HMENU)2, ((LPCREATESTRUCT)lParam)->hInstance, NULL);
|
||||
CreateWindowW(L"static", L"domain", WS_CHILD | WS_VISIBLE, 20, 140, 60, 30,
|
||||
hWnd, (HMENU)2, ((LPCREATESTRUCT)lParam)->hInstance, NULL);
|
||||
|
||||
CreateWindowW(L"static", L"window_type", WS_CHILD | WS_VISIBLE, 20, 180, 60,
|
||||
30, hWnd, (HMENU)2, ((LPCREATESTRUCT)lParam)->hInstance,
|
||||
NULL);
|
||||
HMONITOR hmon = MonitorFromWindow(hWnd, MONITOR_DEFAULTTONEAREST);
|
||||
MONITORINFO mi = {sizeof(mi)};
|
||||
if (!GetMonitorInfo(hmon, &mi))
|
||||
return false;
|
||||
auto left = mi.rcMonitor.left;
|
||||
auto top = mi.rcMonitor.top;
|
||||
auto width = mi.rcMonitor.right - mi.rcMonitor.left;
|
||||
auto height = mi.rcMonitor.bottom - mi.rcMonitor.top;
|
||||
// hWnd_container = CreateWindowW(L"static", L"", WS_CHILD | WS_VISIBLE,
|
||||
// left,
|
||||
// top, width, height, hWnd, (HMENU)2,
|
||||
// ((LPCREATESTRUCT)lParam)->hInstance, NULL);
|
||||
|
||||
wstring domain(L"https://finchat-mop-b.finogeeks.club");
|
||||
wstring appkey(L"22LyZEib0gLTQdU3MUauAQVLIkNNhTSGIN42gXzlAsk=");
|
||||
wstring appid(L"60e3c059949a5300014d0c07");
|
||||
wstring secret(L"ae55433be2f62915");
|
||||
|
||||
// <20><>exe<78><65><EFBFBD><EFBFBD>, config.json<6F><6E><EFBFBD><EFBFBD>exeͬһĿ¼
|
||||
// <20><>vs<76><73><EFBFBD><EFBFBD>, config.json<6F><6E><EFBFBD><EFBFBD>Finclip/
|
||||
auto path = std::filesystem::current_path();
|
||||
if (std::filesystem::exists("config.json")) {
|
||||
std::ifstream t("config.json");
|
||||
std::stringstream buffer;
|
||||
buffer << t.rdbuf();
|
||||
auto obj = json::parse(buffer.str());
|
||||
auto field = obj.find("domain");
|
||||
if (field != obj.end() && field.value().is_string()) {
|
||||
auto s = field.value().get<std::string>();
|
||||
domain = wstring(s.begin(), s.end());
|
||||
}
|
||||
field = obj.find("appkey");
|
||||
if (field != obj.end() && field.value().is_string()) {
|
||||
auto s = field.value().get<std::string>();
|
||||
appkey = wstring(s.begin(), s.end());
|
||||
}
|
||||
field = obj.find("appid");
|
||||
if (field != obj.end() && field.value().is_string()) {
|
||||
auto s = field.value().get<std::string>();
|
||||
appid = wstring(s.begin(), s.end());
|
||||
}
|
||||
field = obj.find("secret");
|
||||
if (field != obj.end() && field.value().is_string()) {
|
||||
auto s = field.value().get<std::string>();
|
||||
secret = wstring(s.begin(), s.end());
|
||||
}
|
||||
field = obj.find("offline_applet_path");
|
||||
if (field != obj.end() && field.value().is_string()) {
|
||||
auto s = field.value().get<std::string>();
|
||||
offline_applet_path = string(s.begin(), s.end());
|
||||
}
|
||||
field = obj.find("offline_base_path");
|
||||
if (field != obj.end() && field.value().is_string()) {
|
||||
auto s = field.value().get<std::string>();
|
||||
offline_base_path = string(s.begin(), s.end());
|
||||
}
|
||||
}
|
||||
hWnd_appkey = CreateWindowW(
|
||||
L"EDIT", appkey.c_str(), WS_VISIBLE | WS_CHILD | WS_BORDER | ES_LEFT,
|
||||
100, 20, 300, 30, hWnd, (HMENU)IDM_APPLET_APPKEY,
|
||||
((LPCREATESTRUCT)lParam)->hInstance, NULL);
|
||||
|
||||
hWnd_secret = CreateWindowW(
|
||||
L"EDIT", secret.c_str(), WS_VISIBLE | WS_CHILD | WS_BORDER | ES_LEFT,
|
||||
100, 60, 300, 30, hWnd, (HMENU)IDM_APPLET_SECRET,
|
||||
((LPCREATESTRUCT)lParam)->hInstance, NULL);
|
||||
// 5ea0401463cb900001d73865 wxdemo
|
||||
// 5ea0412663cb900001d73867 webview
|
||||
// 5ea6d3bad262a7000141280d quote
|
||||
hWnd_appid = CreateWindowW(L"EDIT", appid.c_str(),
|
||||
WS_VISIBLE | WS_CHILD | WS_BORDER | ES_LEFT, 100,
|
||||
100, 300, 30, hWnd, (HMENU)IDM_APPLET_APPID,
|
||||
((LPCREATESTRUCT)lParam)->hInstance, NULL);
|
||||
hWnd_domain = CreateWindowW(
|
||||
L"EDIT", domain.c_str(), WS_VISIBLE | WS_CHILD | WS_BORDER | ES_LEFT,
|
||||
100, 140, 300, 30, hWnd, (HMENU)IDM_APPLET_DOMAIN,
|
||||
((LPCREATESTRUCT)lParam)->hInstance, NULL);
|
||||
|
||||
hWnd_type = CreateWindowW(L"EDIT", L"0",
|
||||
WS_VISIBLE | WS_CHILD | WS_BORDER | ES_LEFT, 100,
|
||||
180, 300, 30, hWnd, (HMENU)IDM_APPLET_DOMAIN,
|
||||
((LPCREATESTRUCT)lParam)->hInstance, NULL);
|
||||
|
||||
HWND hwndButton =
|
||||
CreateWindowW(L"BUTTON", L"open", WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON,
|
||||
100, 250, 200, 50, hWnd, (HMENU)IDM_START_APPLET,
|
||||
((LPCREATESTRUCT)lParam)->hInstance, NULL);
|
||||
CreateWindowW(L"BUTTON", L"InvokeWebApi",
|
||||
WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON, 100, 350, 200, 50,
|
||||
hWnd, (HMENU)IDM_SENDMESSAGE,
|
||||
((LPCREATESTRUCT)lParam)->hInstance, NULL);
|
||||
|
||||
} break;
|
||||
}
|
||||
return DefWindowProcW(hWnd, message, wParam, lParam);
|
||||
}
|
|
@ -0,0 +1,174 @@
|
|||
#ifndef WRAPPER_SRC_PUBLIC_FINCLIP_API_H_
|
||||
#define WRAPPER_SRC_PUBLIC_FINCLIP_API_H_
|
||||
|
||||
#include "finclip_api_const.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <cstddef>
|
||||
#else
|
||||
#include <stdbool.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct IKnown IKnown;
|
||||
typedef struct IResultSet IResultSet;
|
||||
typedef struct IEvent IEvent;
|
||||
typedef struct IFinPacker IFinPacker;
|
||||
typedef struct IFinConfig IFinConfig;
|
||||
typedef struct IFinConfigPacker IFinConfigPacker;
|
||||
typedef struct IPackerFactory IPackerFactory;
|
||||
typedef struct Callback Callback;
|
||||
typedef void (*FinClipSDKCallback)(IEvent*);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
DLL_EXPORT int FINSTDMETHODCALLTYPE
|
||||
finclip_initialize(IFinConfigPacker* configpacker);
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
DLL_EXPORT IPackerFactory* FINSTDMETHODCALLTYPE finclip_get_packer_factory();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
DLL_EXPORT int FINSTDMETHODCALLTYPE finclip_start_applet(int appstore,
|
||||
const char* appid);
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
DLL_EXPORT int FINSTDMETHODCALLTYPE finclip_close_all_applet();
|
||||
|
||||
/**
|
||||
* @brief 根据appid关闭小程序
|
||||
*/
|
||||
DLL_EXPORT int FINSTDMETHODCALLTYPE finclip_close_applet(const char* appid);
|
||||
|
||||
/**
|
||||
* @brief 设置小程序主程序位置
|
||||
* 需要设置
|
||||
*
|
||||
*/
|
||||
DLL_EXPORT void FINSTDMETHODCALLTYPE finclip_set_position(const char* appid,
|
||||
int left, int top,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
DLL_EXPORT IFinConfigPacker* FINSTDMETHODCALLTYPE
|
||||
finclip_packer_factory_get_config_packer(IPackerFactory* factory);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
DLL_EXPORT IFinConfig* FINSTDMETHODCALLTYPE
|
||||
finclip_config_packer_new_config(IFinConfigPacker* packer);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
DLL_EXPORT IFinConfig* FINSTDMETHODCALLTYPE
|
||||
finclip_config_packer_get_config(IFinConfigPacker* packer, int appstore);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
DLL_EXPORT int FINSTDMETHODCALLTYPE
|
||||
finclip_config_packer_add_config(IFinConfigPacker* packer, IFinConfig* config);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
DLL_EXPORT void FINSTDMETHODCALLTYPE
|
||||
finclip_register_callback(IFinConfigPacker* packer, FinClipApiType type,
|
||||
const char* apis, FinclipApiHandle handle);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
DLL_EXPORT void FINSTDMETHODCALLTYPE
|
||||
finclip_config_set_app_store(IFinConfig* config, int app_store);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
DLL_EXPORT void FINSTDMETHODCALLTYPE
|
||||
finclip_config_set_app_key(IFinConfig* config, const char* app_key);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
DLL_EXPORT void FINSTDMETHODCALLTYPE
|
||||
finclip_config_set_secret(IFinConfig* config, const char* secret);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
DLL_EXPORT void FINSTDMETHODCALLTYPE
|
||||
finclip_config_set_domain(IFinConfig* config, const char* domain);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
DLL_EXPORT void FINSTDMETHODCALLTYPE
|
||||
finclip_config_set_app_window_style(IFinConfig* config, int type);
|
||||
|
||||
/**
|
||||
* @brief 设置启动模式, 参见: StartFlags
|
||||
* 全同步模式: kBaseLibrarySync | kAppletSync
|
||||
*/
|
||||
DLL_EXPORT void FINSTDMETHODCALLTYPE
|
||||
finclip_config_set_start_flag(IFinConfig* config, int flag);
|
||||
|
||||
/**
|
||||
* @brief 是否展示loading动画
|
||||
*/
|
||||
DLL_EXPORT void FINSTDMETHODCALLTYPE
|
||||
finclip_config_set_show_loading(IFinConfig* config, bool show_loading);
|
||||
|
||||
/**
|
||||
* @brief 设置小程序主程序执行文件的位置, 当宿主程序和exe不在同一目录时,
|
||||
* 需要设置
|
||||
*
|
||||
*/
|
||||
DLL_EXPORT void FINSTDMETHODCALLTYPE
|
||||
finclip_config_set_exe_path(IFinConfig* config, const char* exe_path);
|
||||
|
||||
#ifdef _WIN32
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
DLL_EXPORT int FINSTDMETHODCALLTYPE
|
||||
finclip_start_applet_embed(int appstore, const char* appid, HWND container);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
DLL_EXPORT void FINSTDMETHODCALLTYPE
|
||||
finclip_register_callback_cpp(IFinConfigPacker* packer, FinClipApiType type,
|
||||
const char* apis, Callback* callback);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
DLL_EXPORT int FINSTDMETHODCALLTYPE finclip_invoke_api_cpp(FinClipApiType type,
|
||||
const char* app_id,
|
||||
const char* api_name,
|
||||
const char* params,
|
||||
Callback* callback);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* WRAPPER_SRC_PUBLIC_FINCLIP_API_H_ */
|
|
@ -0,0 +1,69 @@
|
|||
#ifndef SRC_FINCLIP_API_CONST_H_
|
||||
#define SRC_FINCLIP_API_CONST_H_
|
||||
#ifndef WRAPPER_SRC_PUBLIC_FINCLIP_API_CONST_H_
|
||||
#define WRAPPER_SRC_PUBLIC_FINCLIP_API_CONST_H_
|
||||
|
||||
#define FIN_SID const char*
|
||||
#define FIN_OK 0
|
||||
#define FIN_FAIL 1
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#define FINCLIP_WINDOW_HANDLE HWND
|
||||
#elif defined __linux__
|
||||
#include <gtk/gtk.h>
|
||||
#define FINCLIP_WINDOW_HANDLE GtkWindow*
|
||||
#elif defined __APPLE__
|
||||
typedef struct objc_object* FINCLIP_WINDOW_HANDLE;
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifndef FINSTDMETHODCALLTYPE
|
||||
#define FINSTDMETHODCALLTYPE __stdcall
|
||||
#define DLL_EXPORT _declspec(dllexport)
|
||||
#endif
|
||||
#else
|
||||
#define FINSTDMETHODCALLTYPE
|
||||
#define DLL_EXPORT
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief 启动机制设置
|
||||
* kAsync: 异步启动
|
||||
* kBaseLibrarySync: 基础库同步加载
|
||||
* kAppletSync: 小程序同步加载
|
||||
*/
|
||||
enum StartFlags {
|
||||
kAsync = 0,
|
||||
kBaseLibrarySync = 1 << 0,
|
||||
kAppletSync = 1 << 1,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief 自定义API类型,分别用于小程序和jssdk
|
||||
*
|
||||
*/
|
||||
typedef enum { kApplet, kWebView } FinClipApiType;
|
||||
|
||||
/**
|
||||
* @brief 自定义api返回值回调
|
||||
*
|
||||
*/
|
||||
typedef void (*FinclipApiCallback)(const char* res);
|
||||
|
||||
/**
|
||||
* @brief 自定义api
|
||||
*
|
||||
*/
|
||||
typedef void (*FinclipApiHandle)(const char* event, const char* param,
|
||||
FinclipApiCallback callback);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* WRAPPER_SRC_PUBLIC_FINCLIP_API_CONST_H_ */
|
||||
|
||||
#endif /* SRC_FINCLIP_API_CONST_H_ */
|
|
@ -0,0 +1 @@
|
|||
build/
|
|
@ -0,0 +1,8 @@
|
|||
### 编译
|
||||
|
||||
1. npm run configure
|
||||
2. npm run build
|
||||
|
||||
### 运行
|
||||
|
||||
node index.js
|
|
@ -0,0 +1,55 @@
|
|||
{
|
||||
"targets": [
|
||||
{
|
||||
"target_name": "_finclip",
|
||||
"win_delay_load_hook": "true",
|
||||
"sources": [
|
||||
"finclip.cpp"
|
||||
],
|
||||
"cflags_cc": [
|
||||
"-std=c++17"
|
||||
],
|
||||
'include_dirs': ["<!@(node -p \"require('node-addon-api').include\")"],
|
||||
'dependencies': ["<!(node -p \"require('node-addon-api').gyp\")"],
|
||||
"libraries": [
|
||||
"../../../vendor/win/x64/FinClipSDKWrapper.lib",
|
||||
],
|
||||
"defines": ["_UNICODE", "UNICODE", "NAPI_DISABLE_CPP_EXCEPTIONS"],
|
||||
"copies": [
|
||||
{
|
||||
"destination": "<(module_root_dir)/build/Release/",
|
||||
"files": [
|
||||
"../../vendor/win/x64/FinClipSDKWrapper.lib",
|
||||
"../../vendor/win/x64/FinClipSDKWrapper.dll",
|
||||
"../../vendor/win/x64/finclip.exe",
|
||||
"../../vendor/win/x64/finclip.exp",
|
||||
"../../vendor/win/x64/finclip.lib",
|
||||
"package.json"
|
||||
]
|
||||
},
|
||||
],
|
||||
"conditions": [
|
||||
['OS=="mac"', {
|
||||
"xcode_settings": {
|
||||
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
|
||||
"CLANG_CXX_LIBRARY": "libc++",
|
||||
"CLANG_CXX_LANGUAGE_STANDARD": "c++17",
|
||||
'MACOSX_DEPLOYMENT_TARGET': '10.14'
|
||||
}
|
||||
}],
|
||||
['OS=="win"', {
|
||||
"msvs_settings": {
|
||||
"VCCLCompilerTool": {
|
||||
"AdditionalOptions": ["-std:c++17", ],
|
||||
},
|
||||
},
|
||||
}]
|
||||
]
|
||||
}
|
||||
],
|
||||
"msbuild_settings": {
|
||||
"ClCompile": {
|
||||
"LanguageStandard": "stdcpp17"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,145 @@
|
|||
#include "../finclip_api.h"
|
||||
#include "resource.h"
|
||||
// Windows Header Files
|
||||
#include <windows.h>
|
||||
// #include <node_api.h>
|
||||
#include <napi.h>
|
||||
// C RunTime Header Files
|
||||
#include <malloc.h>
|
||||
#include <memory.h>
|
||||
#include <tchar.h>
|
||||
#include <winuser.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
|
||||
#include "json.hpp"
|
||||
|
||||
#pragma comment(lib, "FinClipSDKWrapper.lib")
|
||||
|
||||
#define MAX_LOADSTRING 100
|
||||
#define IDM_SENDMESSAGE_1 32784
|
||||
#define IDM_SENDMESSAGE_2 32785
|
||||
#define IDC_FINCLIP 109
|
||||
|
||||
using namespace std;
|
||||
using json = nlohmann::json;
|
||||
|
||||
std::string Utf8Encode(const std::wstring& wstr, int cp = CP_UTF8) {
|
||||
if (wstr.empty()) return std::string();
|
||||
int size_needed =
|
||||
WideCharToMultiByte(cp, 0, &wstr[0], static_cast<int>(wstr.size()),
|
||||
nullptr, 0, nullptr, nullptr);
|
||||
std::string str(size_needed, 0);
|
||||
WideCharToMultiByte(cp, 0, &wstr[0], static_cast<int>(wstr.size()), &str[0],
|
||||
size_needed, nullptr, nullptr);
|
||||
return str;
|
||||
}
|
||||
|
||||
// Convert an UTF8 string to a wide Unicode String
|
||||
std::wstring Utf8Decode(const std::string& str, int cp = CP_UTF8) {
|
||||
if (str.empty()) return std::wstring();
|
||||
int size_needed = MultiByteToWideChar(
|
||||
cp, 0, &str[0], static_cast<int>(str.size()), nullptr, 0);
|
||||
std::wstring wstr(size_needed, 0);
|
||||
MultiByteToWideChar(cp, 0, &str[0], static_cast<int>(str.size()), &wstr[0],
|
||||
size_needed);
|
||||
return wstr;
|
||||
}
|
||||
|
||||
void CustomApi(const char* event, const char* param,
|
||||
FinclipApiCallback callback) {
|
||||
std::string data = param;
|
||||
std::string e = event;
|
||||
std::string res = R"({"data":"ok"})";
|
||||
callback(res.c_str());
|
||||
}
|
||||
|
||||
namespace NodeFinClip {
|
||||
using namespace Napi;
|
||||
std::string current_appid;
|
||||
|
||||
Napi::String start(const Napi::CallbackInfo& info) {
|
||||
Napi::Env env = info.Env();
|
||||
Napi::Object args = info[0].ToObject();
|
||||
int handle = args.Get("handle").ToNumber().Int32Value();
|
||||
int appstore = 1;
|
||||
string domain("https://finchat-mop-b.finogeeks.club");
|
||||
string appkey("22LyZEib0gLTQdU3MUauAQVLIkNNhTSGIN42gXzlAsk=");
|
||||
string appid("60e3c059949a5300014d0c07");
|
||||
string secret("ae55433be2f62915");
|
||||
string type("1");
|
||||
std::string path = args.Get("finclipPath").ToString();
|
||||
auto* factory = finclip_get_packer_factory();
|
||||
auto* packer = finclip_packer_factory_get_config_packer(factory);
|
||||
auto* config = finclip_config_packer_new_config(packer);
|
||||
finclip_config_packer_add_config(packer, config);
|
||||
finclip_config_set_app_store(config, appstore);
|
||||
finclip_config_set_app_key(config, appkey.c_str());
|
||||
finclip_config_set_secret(config, secret.c_str());
|
||||
finclip_config_set_domain(config, domain.c_str());
|
||||
finclip_config_set_start_flag(config, kAppletSync);
|
||||
finclip_config_set_show_loading(config, false);
|
||||
finclip_config_set_exe_path(config, path.c_str());
|
||||
finclip_register_callback(packer, kApplet, "api", CustomApi);
|
||||
finclip_register_callback(packer, kWebView, "webapi", CustomApi);
|
||||
finclip_initialize(packer);
|
||||
finclip_start_applet(appstore, appid.c_str());
|
||||
|
||||
// hWnd_container = GetForegroundWindow();
|
||||
// SetWindowPos(hWnd_container, HWND_TOP, 0, 0, 1024, 768,
|
||||
// SWP_ASYNCWINDOWPOS);
|
||||
// // hWnd_container = (HWND) handle;
|
||||
// // hWnd_container = GetFocus();
|
||||
// HRESULT hr = StartApplet(
|
||||
// hWnd_container, appstore, Utf8Encode(wappid).c_str(), "", packer,
|
||||
// args.Get("finclipPath").ToString().Utf8Value().c_str(),
|
||||
// FinclipAppletCallback);
|
||||
current_appid = appid;
|
||||
finclip_set_position(current_appid.c_str(), 1000, 300, 540, 960);
|
||||
// SetAppletPos(Utf8Encode(wappid).c_str(), 0, 30, 540, 960, true);
|
||||
// packer->Release();
|
||||
return Napi::String::New(env, path);
|
||||
}
|
||||
|
||||
Napi::String close(const Napi::CallbackInfo& info) {
|
||||
Napi::Env env = info.Env();
|
||||
finclip_close_all_applet();
|
||||
return Napi::String::New(env, "success");
|
||||
}
|
||||
|
||||
Napi::String setAppletPos(const Napi::CallbackInfo& info) {
|
||||
Napi::Env env = info.Env();
|
||||
Napi::Object args = info[0].ToObject();
|
||||
int left = args.Get("left").ToNumber().Int32Value();
|
||||
int top = args.Get("top").ToNumber().Int32Value();
|
||||
int width = args.Get("width").ToNumber().Int32Value();
|
||||
int height = args.Get("height").ToNumber().Int32Value();
|
||||
finclip_set_position(current_appid.c_str(), left, top, width, height);
|
||||
return Napi::String::New(env, "success");
|
||||
}
|
||||
|
||||
Napi::String createWindow(const Napi::CallbackInfo& info) {
|
||||
Napi::Env env = info.Env();
|
||||
Napi::Object args = info[0].ToObject();
|
||||
CreateWindowW(L"child_finclip", L"test", WS_VISIBLE, 0, 0, 1024, 768, nullptr,
|
||||
nullptr, nullptr, nullptr);
|
||||
return Napi::String::New(env, "success");
|
||||
}
|
||||
|
||||
Napi::Object Init(Napi::Env env, Napi::Object exports) {
|
||||
exports.Set(Napi::String::New(env, "start"), Napi::Function::New(env, start));
|
||||
exports.Set(Napi::String::New(env, "close"), Napi::Function::New(env, close));
|
||||
exports.Set(Napi::String::New(env, "setAppletPos"),
|
||||
Napi::Function::New(env, setAppletPos));
|
||||
exports.Set(Napi::String::New(env, "createWindow"),
|
||||
Napi::Function::New(env, createWindow));
|
||||
return exports;
|
||||
}
|
||||
|
||||
NODE_API_MODULE(addon, Init)
|
||||
} // namespace NodeFinClip
|
|
@ -0,0 +1,3 @@
|
|||
#pragma once
|
||||
|
||||
#include "resource.h"
|
|
@ -0,0 +1,32 @@
|
|||
|
||||
// setTimeout(() => {
|
||||
const hw = require('./build/Release/_finclip.node');
|
||||
hw.createWindow({});
|
||||
console.log('gg')
|
||||
// console.log(hw.start({
|
||||
// handle: 41419442,
|
||||
// finclipPath: `C:\\Users\\gyt\\Code\\FinChat\\local-module\\fincliplib\\finclip.exe`
|
||||
// }))
|
||||
// }, 1000 * 6);
|
||||
|
||||
|
||||
// const { Worker } = require('worker_threads');
|
||||
|
||||
// const worker = new Worker(`
|
||||
// const hw = require('./build/Release/_finclip.node');
|
||||
// setTimeout(() => {
|
||||
// console.log(hw.start({
|
||||
// handle: 41419442,
|
||||
// finclipPath: 'C:\\\\Users\\\\gyt\\\\Code\\\\FinChat\\\\local-module\\\\fincliplib\\\\finclip.exe'
|
||||
// }))
|
||||
// }, 1000 * 6);
|
||||
// setTimeout(() => {
|
||||
|
||||
// }, 1000 * 60 * 60);
|
||||
// `, { eval: true });
|
||||
// worker.on('message', message => console.log(message));
|
||||
// worker.postMessage('ping');
|
||||
|
||||
setTimeout(() => {
|
||||
|
||||
}, 1000 * 60 * 60);
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"name": "finclip",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "./_finclip.node",
|
||||
"scripts": {
|
||||
"configure": "node-gyp configure",
|
||||
"build": "node-gyp build",
|
||||
"rebuild": "node-gyp rebuild",
|
||||
"erebuild": "electron-rebuild -v 13.6.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"electron-rebuild": "^3.2.7",
|
||||
"node-addon-api": "^1.7.2"
|
||||
},
|
||||
"gypfile": true
|
||||
}
|
|
@ -1,35 +1,35 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by finclip-win32-demo.rc
|
||||
//
|
||||
#define IDC_MYICON 2
|
||||
#define IDD_FINCLIPWIN32DEMO_DIALOG 102
|
||||
#define IDS_APP_TITLE 103
|
||||
#define IDD_ABOUTBOX 103
|
||||
#define IDM_ABOUT 104
|
||||
#define IDM_EXIT 105
|
||||
#define IDI_FINCLIPWIN32DEMO 107
|
||||
#define IDI_SMALL 108
|
||||
#define IDC_FINCLIPWIN32DEMO 109
|
||||
#define IDR_MAINFRAME 128
|
||||
#define ID_FILE_IDM 32771
|
||||
#define IDM_SENDMESSAGE 32772
|
||||
#define ID_FILE_IDM32773 32773
|
||||
#define IDM_START_APPLET 32774
|
||||
#define IDM_APPLET_APPKEY 32775
|
||||
#define IDM_APPLET_SECRET 32776
|
||||
#define IDM_APPLET_APPID 32777
|
||||
#define IDM_APPLET_DOMAIN 32778
|
||||
#define IDC_STATIC -1
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NO_MFC 1
|
||||
#define _APS_NEXT_RESOURCE_VALUE 129
|
||||
#define _APS_NEXT_COMMAND_VALUE 32779
|
||||
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||
#define _APS_NEXT_SYMED_VALUE 110
|
||||
#endif
|
||||
#endif
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by finclip-win32-demo.rc
|
||||
//
|
||||
#define IDC_MYICON 2
|
||||
#define IDD_FINCLIPWIN32DEMO_DIALOG 102
|
||||
#define IDS_APP_TITLE 103
|
||||
#define IDD_ABOUTBOX 103
|
||||
#define IDM_ABOUT 104
|
||||
#define IDM_EXIT 105
|
||||
#define IDI_FINCLIPWIN32DEMO 107
|
||||
#define IDI_SMALL 108
|
||||
#define IDC_FINCLIPWIN32DEMO 109
|
||||
#define IDR_MAINFRAME 128
|
||||
#define ID_FILE_IDM 32771
|
||||
#define IDM_SENDMESSAGE 32772
|
||||
#define ID_FILE_IDM32773 32773
|
||||
#define IDM_START_APPLET 32774
|
||||
#define IDM_APPLET_APPKEY 32775
|
||||
#define IDM_APPLET_SECRET 32776
|
||||
#define IDM_APPLET_APPID 32777
|
||||
#define IDM_APPLET_DOMAIN 32778
|
||||
#define IDC_STATIC -1
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NO_MFC 1
|
||||
#define _APS_NEXT_RESOURCE_VALUE 129
|
||||
#define _APS_NEXT_COMMAND_VALUE 32779
|
||||
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||
#define _APS_NEXT_SYMED_VALUE 110
|
||||
#endif
|
||||
#endif
|
|
@ -1,3 +0,0 @@
|
|||
*.zip
|
||||
/lib
|
||||
*.bz2
|
|
@ -1,394 +0,0 @@
|
|||
#ifndef __H_FINCLIP_WRAPPER_API_H__
|
||||
#define __H_FINCLIP_WRAPPER_API_H__
|
||||
#ifdef _WIN32
|
||||
# ifndef FINSTDMETHODCALLTYPE
|
||||
# define FINSTDMETHODCALLTYPE __stdcall
|
||||
# define DLL_EXPORT _declspec(dllexport)
|
||||
# endif
|
||||
#else
|
||||
# define FINSTDMETHODCALLTYPE
|
||||
# define DLL_EXPORT
|
||||
#endif
|
||||
|
||||
#define FIN_SID const char*
|
||||
#define FIN_OK 0
|
||||
#define FIN_FAIL 1
|
||||
#include <windows.h>
|
||||
namespace com::finogeeks::finclip::wrapper {
|
||||
|
||||
/**
|
||||
* @brief 启动机制设置
|
||||
* kAsync: 异步启动
|
||||
* kBaseLibrarySync: 基础库同步加载
|
||||
* kAppletSync: 小程序同步加载
|
||||
*/
|
||||
enum StartFlags
|
||||
{
|
||||
kAsync = 0,
|
||||
kBaseLibrarySync = 1 << 0,
|
||||
kAppletSync = 1 << 1,
|
||||
};
|
||||
/**
|
||||
* @brief 自定义API类型,分别用于小程序和jssdk
|
||||
*
|
||||
*/
|
||||
enum class FinClipApiType
|
||||
{
|
||||
kApplet,
|
||||
kWebView
|
||||
};
|
||||
/**
|
||||
* @brief 接口基类
|
||||
*
|
||||
*/
|
||||
struct IKnown
|
||||
{};
|
||||
|
||||
/// SDK统一事件接口
|
||||
|
||||
/**
|
||||
* @brief API返回结果
|
||||
{
|
||||
"size": 100,
|
||||
"data": [[{},{}...],[{},{}...]]
|
||||
}
|
||||
|
||||
*/
|
||||
struct IResultSet : public IKnown
|
||||
{
|
||||
public:
|
||||
///取字段数
|
||||
/**@return 返回字段数.
|
||||
*/
|
||||
virtual int GetColCount() = 0;
|
||||
|
||||
///取字段名
|
||||
/** @param column:字段序号(以0为基数)
|
||||
* @return 返回字段名 下标越界 返回NULL
|
||||
*/
|
||||
virtual const char* GetColName(int column) = 0;
|
||||
|
||||
//按字段名,取字段值(字符串)
|
||||
/**@param columnName: 字段名
|
||||
*@return 字符串型字段值,不存在返回NULL
|
||||
*/
|
||||
virtual const char* GetStr(const char* columnName) = 0;
|
||||
|
||||
///取字段名对应的字段序号
|
||||
/**@param columnName: 字段名
|
||||
*@return 返回字段序号. 不存在返回-1
|
||||
*/
|
||||
virtual int FindColIndex(const char* columnName) = 0;
|
||||
|
||||
//
|
||||
//按字段序号(以0为基数),取字段值(字符串)
|
||||
/**@param column:字段序号(以0为基数)
|
||||
*@return 字符串型字段值,下标越界返回NULL
|
||||
*/
|
||||
virtual const char* GetStrByIndex(int column) = 0;
|
||||
|
||||
///按字段序号获得字段值,二进制数据
|
||||
/**@param column: 字段序号(以0为基数)
|
||||
*@param lpRawLen: [out]数据长度
|
||||
*@return : 数据首地址
|
||||
*/
|
||||
virtual void* GetRawByIndex(int column, int* lpRawLen) = 0;
|
||||
|
||||
///按字段名,取字段值
|
||||
/**@param columnName:字段名
|
||||
*@param lpRawLen: [out]数据长度
|
||||
*@return : 数据首地址
|
||||
*/
|
||||
virtual void* GetRaw(const char* columnName, int* lpRawLen) = 0;
|
||||
|
||||
///最后一次取的字段值是否为NULL
|
||||
/**@return 0 是, 1不是
|
||||
*/
|
||||
virtual int WasNull() = 0;
|
||||
|
||||
///取下一条记录
|
||||
virtual void Next() = 0;
|
||||
|
||||
///判断是否为结尾
|
||||
/**@return 1 是,0 不是;
|
||||
*/
|
||||
virtual int IsEOF() = 0;
|
||||
|
||||
///判断是否为空
|
||||
/**@return 1 是,0 不是;
|
||||
*/
|
||||
virtual int IsEmpty() = 0;
|
||||
|
||||
virtual void* Destroy() = 0;
|
||||
};
|
||||
/**
|
||||
* @brief SDK返回数据
|
||||
*
|
||||
*/
|
||||
struct IEvent : public IResultSet
|
||||
{
|
||||
|
||||
///取结果集个数
|
||||
virtual int GetDatasetCount() = 0;
|
||||
|
||||
///设置当前结果集
|
||||
/**
|
||||
*@param int nIndex 结果集编号
|
||||
*@return int 非0 表示成功,否则为失败
|
||||
*/
|
||||
virtual int SetCurrentDatasetByIndex(int nIndex) = 0;
|
||||
|
||||
///结果集行记录游标接口:取结果集的首条记录
|
||||
virtual void First() = 0;
|
||||
|
||||
///结果集行记录游标接口:取结果集的最后一条记录
|
||||
virtual void Last() = 0;
|
||||
|
||||
///结果集行记录游标接口:取结果集的第n条记录,取值范围[1, GetRowCount()]
|
||||
virtual void Go(int nRow) = 0;
|
||||
|
||||
virtual const char* GetBuffer() = 0;
|
||||
|
||||
virtual void Release() = 0;
|
||||
};
|
||||
|
||||
struct IApiCallback
|
||||
{
|
||||
|
||||
public:
|
||||
virtual void Callback(const char* event) = 0;
|
||||
};
|
||||
//函数指针回调
|
||||
/**
|
||||
* @params ret 调用结果 0成功,1失败
|
||||
* @params event 返回结果 IEvent对像
|
||||
* 如下格式
|
||||
*
|
||||
*/
|
||||
typedef void (*FinClipSDKCallback)(IEvent*);
|
||||
|
||||
///数据打包器接口
|
||||
struct IFinPacker : public IKnown
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief 打包准备
|
||||
*/
|
||||
virtual void BeginPacker() = 0;
|
||||
/**
|
||||
* @brief 往数据包增加内容
|
||||
* @detail 分别为KEY,VALUE
|
||||
*
|
||||
* @param field 数据字段
|
||||
* @param value 数据值
|
||||
* @return 0成功,1失败
|
||||
*/
|
||||
virtual void Add(const char* field, const char* value) = 0;
|
||||
/**
|
||||
* @brief 结束打包
|
||||
*/
|
||||
virtual void EndPacker() = 0;
|
||||
|
||||
/**
|
||||
* @brief 释放打包器
|
||||
*/
|
||||
virtual void Release() = 0;
|
||||
|
||||
/**
|
||||
* @brief 取数据缓冲大小
|
||||
* @return 返回数据缓冲大小
|
||||
*/
|
||||
virtual int GetBufferSize() = 0;
|
||||
|
||||
/**
|
||||
* @brief 导出数据缓冲
|
||||
* @param buffer 存放数据缓冲,由调用方预申请空间
|
||||
* @param size 存放数据缓冲长度
|
||||
* @return 0成功,1失败
|
||||
*/
|
||||
virtual int Dump(unsigned char* buffer, int* size) = 0;
|
||||
};
|
||||
|
||||
///配置信息接口
|
||||
struct IFinConfig
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* 功能:设置应用市场
|
||||
* SDK支持多应用市场,可以打开不同应用市场的小程序;
|
||||
* 不同的应用市场对应不同的domain;
|
||||
* 打开小程序时需要指定应用市场
|
||||
*@param app_store:应用市场类型,由开发者自主设置
|
||||
*@return void
|
||||
*/
|
||||
virtual void SetAppStore(int app_store) = 0;
|
||||
/**
|
||||
* @brief 设置加密类型
|
||||
* @param encrypt_type 0:标准加密 1:国密
|
||||
* @return void
|
||||
*/
|
||||
virtual void SetEncryptType(int encrypt_type) = 0;
|
||||
/**
|
||||
* @brief 设置应用市场域名
|
||||
* @param domain 形如: https://api.finogeeks.com
|
||||
* @return void
|
||||
*/
|
||||
virtual void SetDomain(const char* domain) = 0;
|
||||
/**
|
||||
* @brief 设置Api前辍
|
||||
* @param apiprefix /api/v1/mop
|
||||
* @return void
|
||||
*/
|
||||
virtual void SetApiPrefix(const char* apiprefix) = 0;
|
||||
/**
|
||||
* @brief 设置SDK的秘钥
|
||||
* @param appkey
|
||||
* @return void
|
||||
*/
|
||||
virtual void SetAppKey(const char* appkey) = 0;
|
||||
/**
|
||||
* @brief 设置SDK的私钥
|
||||
* @param secret
|
||||
* @return void
|
||||
*/
|
||||
virtual void SetSecret(const char* secret) = 0;
|
||||
/**
|
||||
* @brief 设置SDK的指纹
|
||||
* @param finger
|
||||
* @return void
|
||||
*/
|
||||
virtual void SetFinger(const char* finger) = 0;
|
||||
/**
|
||||
* @brief 设置小程序窗口类型
|
||||
* @param type 0:独立窗口,1:子窗口
|
||||
* @return void
|
||||
*/
|
||||
virtual void SetAppWindowStyle(int type) = 0;
|
||||
/**
|
||||
* @brief 离线基础库zip包路径
|
||||
* @param path
|
||||
* @return void
|
||||
*/
|
||||
virtual void SetOfflineBaseLibrary(const char* path) = 0;
|
||||
/**
|
||||
* @brief 离线小程序zip包路径
|
||||
* @param path
|
||||
* @return void
|
||||
*/
|
||||
virtual void SetOfflineApplet(const char* path) = 0;
|
||||
/**
|
||||
* @brief 设置小程序窗口类型
|
||||
* @param type 0:独立窗口,1:子窗口
|
||||
* @return void
|
||||
*/
|
||||
virtual void SetShowLoading(int type) = 0;
|
||||
/**
|
||||
* @brief 设置启动机制
|
||||
* @param flag: StartFlags
|
||||
* @return void
|
||||
*/
|
||||
virtual void SetStartFlag(int flag) = 0;
|
||||
};
|
||||
/*
|
||||
* 接口注入api
|
||||
*/
|
||||
struct IApi
|
||||
{
|
||||
/**
|
||||
* @brief 执行回调
|
||||
*
|
||||
* @param event 事件名
|
||||
* @param param 参数
|
||||
* @param callback 结果回调返回
|
||||
*/
|
||||
virtual void invoke(const char* event, const char* param, IApiCallback* callback) = 0;
|
||||
|
||||
/**
|
||||
* @brief Api类型,分为小程序api和webview api
|
||||
*
|
||||
* @return FinClipApiType Api类型
|
||||
*/
|
||||
virtual FinClipApiType GetApiType() const = 0;
|
||||
|
||||
/**
|
||||
* @brief 注入的Api名称
|
||||
*
|
||||
* @return char** 字符串数组
|
||||
*/
|
||||
virtual const char* apis() = 0;
|
||||
/**
|
||||
* @brief 注入的Api数量
|
||||
*
|
||||
* @return size_t 数量
|
||||
*/
|
||||
virtual size_t size() = 0;
|
||||
};
|
||||
|
||||
///配置打包器接口
|
||||
struct IFinConfigPacker : public IKnown
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief 获取配置信息实例
|
||||
* @return 返回配置信息实例
|
||||
*/
|
||||
virtual IFinConfig* NewConfig() = 0;
|
||||
|
||||
/**
|
||||
* @brief 增加配置信息
|
||||
* @return 负数表示失败,0表示成功
|
||||
*/
|
||||
virtual int AddConfig(IFinConfig* config) = 0;
|
||||
/**
|
||||
* @brief 增加供小程序使用的自定义api
|
||||
* @return 负数表示失败,0表示成功
|
||||
*/
|
||||
virtual int RegisterApi(IApi* config) = 0;
|
||||
/**
|
||||
* @brief 获取配置信息
|
||||
* @return 返回配置信息
|
||||
*/
|
||||
virtual IFinConfig* GetConfig(int type) = 0;
|
||||
/**
|
||||
* @brief 获取配置信息个数
|
||||
* @return 返回配置信息个数
|
||||
*/
|
||||
virtual int GetConfigSize() = 0;
|
||||
/**
|
||||
* @brief 通过索引获取配置信息
|
||||
* @return 返回配置信息
|
||||
*/
|
||||
virtual IFinConfig* GetConfigByIndex(int index) = 0;
|
||||
/**
|
||||
* @brief 获取供小程序使用的自定义api个数
|
||||
* @return 返回供小程序使用的自定义api个数
|
||||
*/
|
||||
virtual int GetApiSize() = 0;
|
||||
/**
|
||||
* @brief 通过索引获取获取供小程序使用的自定义api
|
||||
* @return 返回供小程序使用的自定义api
|
||||
*/
|
||||
virtual IApi* GetApiByIndex(int index) = 0;
|
||||
};
|
||||
|
||||
struct IPackerFactory : public IKnown
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief 获取配置打包器
|
||||
* @detail 获取配置打包器实例
|
||||
*
|
||||
* @return 返回配置打包器实例
|
||||
*/
|
||||
virtual IFinConfigPacker* GetFinConfigPacker() = 0;
|
||||
|
||||
/**
|
||||
* @brief 获取数据打包器
|
||||
* @detail 获取数据打包器实例
|
||||
*
|
||||
* @return 返回数据打包器实例
|
||||
*/
|
||||
virtual IFinPacker* GetFinPacker() = 0;
|
||||
};
|
||||
} // namespace com::finogeeks::finclip::wrapper
|
||||
#endif // !__H_FINCLIPAPI_H__
|
|
@ -1,104 +0,0 @@
|
|||
#ifndef __H_FINCLIP_WRAPPER_H__
|
||||
#define __H_FINCLIP_WRAPPER_H__
|
||||
#include "finclip_api.h"
|
||||
#include <windows.h>
|
||||
namespace com::finogeeks::finclip::wrapper {
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/**
|
||||
* @brief 初始化SDI信息
|
||||
* @detail 只需要初始化一次
|
||||
*
|
||||
* @param hinstance 应用实例句柄
|
||||
* @param configpacker 配置打包器
|
||||
* @return 0成功,1失败
|
||||
*/
|
||||
DLL_EXPORT int FINSTDMETHODCALLTYPE Initialize(HINSTANCE hinstance, IFinConfigPacker* configpacker);
|
||||
|
||||
/**
|
||||
* @brief 函数简介
|
||||
* @detail 详细说明
|
||||
*
|
||||
* @param 形参 参数说明
|
||||
* @param 形参 参数说明
|
||||
* @return 返回说明
|
||||
* @retval 返回值说明
|
||||
* @note 注解
|
||||
* @attention 注意
|
||||
* @warning 警告
|
||||
* @exception 异常
|
||||
*/
|
||||
DLL_EXPORT IPackerFactory* FINSTDMETHODCALLTYPE GetPackerFactory();
|
||||
|
||||
/**
|
||||
* @brief 函数简介
|
||||
* @detail 详细说明
|
||||
*
|
||||
* @param 形参 参数说明
|
||||
* @param 形参 参数说明
|
||||
* @return 返回说明
|
||||
* @retval 返回值说明
|
||||
* @note 注解
|
||||
* @attention 注意
|
||||
* @warning 警告
|
||||
* @exception 异常
|
||||
*/
|
||||
DLL_EXPORT int FINSTDMETHODCALLTYPE CloseAllApplet();
|
||||
|
||||
/**
|
||||
* @brief 函数简介
|
||||
* @detail 详细说明
|
||||
*
|
||||
* @param 形参 参数说明
|
||||
* @param 形参 参数说明
|
||||
* @return 返回说明
|
||||
* @retval 返回值说明
|
||||
* @note 注解
|
||||
* @attention 注意
|
||||
* @warning 警告
|
||||
* @exception 异常
|
||||
*/
|
||||
DLL_EXPORT int FINSTDMETHODCALLTYPE CleanCache();
|
||||
|
||||
///小程序Api
|
||||
/**打开小程序
|
||||
*
|
||||
* @param appstore 应用市场类型,需要与配置信息里面设置的应用市场一致
|
||||
* @param appId 小程序appId
|
||||
* @param param 打开参数
|
||||
* @param callback 打开小程序回调
|
||||
* @param exe_path 空: 当前目录的finclip.exe,否则:指定路径, 例如d:\finclip.exe
|
||||
* @return 0表示成功,1表示失败
|
||||
*/
|
||||
DLL_EXPORT int FINSTDMETHODCALLTYPE StartApplet(HWND hWnd, int appstore, const char* appid, const char* page_path,
|
||||
IFinPacker* params, const char* exe_path, FinClipSDKCallback callback);
|
||||
/**
|
||||
* @brief Set the Applet Pos object
|
||||
*
|
||||
* @param appid
|
||||
* @param appstore
|
||||
* @param left
|
||||
* @param top
|
||||
* @param width
|
||||
* @param height
|
||||
* @return DLL_EXPORT
|
||||
*/
|
||||
DLL_EXPORT void FINSTDMETHODCALLTYPE SetAppletPos(const char* appid, int left, int top, int width, int height,
|
||||
bool repaint);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @return DLL_EXPORT
|
||||
*/
|
||||
DLL_EXPORT int FINSTDMETHODCALLTYPE FinClipShutdown();
|
||||
|
||||
DLL_EXPORT int FINSTDMETHODCALLTYPE InvokeWebApi(const char* app_id, const char* api_name, const char* params);
|
||||
|
||||
DLL_EXPORT int FINSTDMETHODCALLTYPE CloseApplet(const char* appid);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
} // namespace com::finogeeks::finclip::wrapper
|
||||
#endif
|
|
@ -0,0 +1,2 @@
|
|||
x86/
|
||||
x64/
|
Loading…
Reference in New Issue