1
0
Fork 0

initail commit

master
developer 2021-11-18 22:25:15 +08:00
commit 3378807021
19 changed files with 28454 additions and 0 deletions

358
.gitignore vendored 100644
View File

@ -0,0 +1,358 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
/dist
/build
.DS_Store
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
#*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
/FinClipSDK/res/返回标注切图.zip
.vscode/

149
README.md 100644
View File

@ -0,0 +1,149 @@
<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 小程序运行环境需要安装以下依赖,请提前配置环境:
- 需要安装 Microsoft WebView2 支持 [点我下载](https://developer.microsoft.com/zh-cn/microsoft-edge/webview2/#download-section)
- 建议使用 Visual Studio 2019 版本 [点我下载](https://support.microsoft.com/en-us/topic/the-latest-supported-visual-c-downloads-2647da03-1eea-4433-9aff-95f26a218cc0)
## 💿 集成SDK
Windows 版本 FinClip 运行时一共有 4 个文件:
1. finclip-api.hAPI 定义文件
2. finclip-sdk.h接口定义文件
3. FinClipSDK.lib链接库文件(x86/x64)
4. FinClipSDK.dll动态链接库(x86/x64)
### 第一步 引入头文件
```c++
#include "finclip-sdk.h"
#pragma comment(lib, "FinClipSDK.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/) 的开发文档
## 🔗 常用链接
以下内容是您在 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">

BIN
doc/images/450.gif 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

View File

@ -0,0 +1,422 @@
// FinClip.cpp : Defines the entry point for the application.
//
#include "Resource.h"
#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;
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);
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 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 CustomApi : public IApi {
void invoke(const char *event, const char *param,
FinClipSDKCallback callback) {
std::string data = param;
std::string e = event;
MessageBox(NULL, utf8_decode(e).c_str(), utf8_decode(data).c_str(), 0);
}
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) {
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadStringW(hInstance, IDC_FINCLIPWIN32DEMO, szWindowClass, MAX_LOADSTRING);
MyRegisterClass(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; //设置窗体样式
HWND hWnd =
CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,
0, 1000, 800, nullptr, nullptr, hInstance, nullptr);
if (!hWnd) {
return FALSE;
}
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) {
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);
configpacker->AddConfig(config);
CustomApi *c_api = new CustomApi();
configpacker->RegisterApi(c_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);
/* ::SetParent(hWnd, gHwnd);
::SetWindowPos(hWnd, NULL, 0, 0, 414, 736, 0);
::ShowWindow(hWnd, SW_SHOWNORMAL);*/
}
event->Release();
// HWND hWnd = event->GetHandle();
// //::PostMessage(hWnd, WM_SYSCOMMAND, SW_MAXIMIZE, 0);
// //::PostMessage(hWnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0);
// COPYDATASTRUCT CopyData;
// char szSendBuf[100];
// time_t timenow;
// time(&timenow);
// sprintf(szSendBuf, "%s", ctime(&timenow));
// //注意ctime()返回的字符串后面带了'\n' CopyData.dwData = 0;
// CopyData.cbData = strlen(szSendBuf);
// szSendBuf[CopyData.cbData - 1] = '\0';
// CopyData.lpData = szSendBuf;
// ::SendMessage(hWnd, WM_COPYDATA, (WPARAM)gHwnd, (LPARAM)&CopyData);
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
LPARAM lParam) {
HWND hwndButtonCintinue;
switch (message) {
case WM_COMMAND:
if (LOWORD(wParam) == IDM_SENDMESSAGE) {
}
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"请输入appKey", L"提示", 0);
return 0;
}
if (wsecret.length() == 0) {
MessageBox(NULL, L"请输入Secret", L"提示", 0);
return 0;
}
if (wappid.length() == 0) {
MessageBox(NULL, L"请输入appid", L"提示", 0);
return 0;
}
if (wdomain.length() == 0) {
MessageBox(NULL, L"请输入domain", L"提示", 0);
return 0;
}
if (wtype.length() == 0) {
MessageBox(NULL, L"请输入type", L"提示", 0);
return 0;
}
int appstore = 1;
IPackerFactory *factory = GetPackerFactory();
IFinConfigPacker *configpacker = factory->GetFinConfigPacker();
IFinConfig *config = configpacker->GetConfig(appstore);
config->SetAppWindowStyle(std::stol(wtype));
//->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;
unsigned char *ret = new unsigned char[len];
memset(ret, 0, len);
packer->Dump(ret, &len);
delete[] ret;
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_SHOWWINDOW: {
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_SYSCOMMAND: {
int i = 0;
int j = 0;
::SetWindowPos(hWnd_container, NULL, 450, 10, 450, 750, 0);
break;
}
case WM_DESTROY: {
FinClipShutdown();
PostQuitMessage(0);
break;
}
case WM_CREATE: {
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);
hWnd_container = CreateWindowW(L"static", L"", WS_CHILD | WS_VISIBLE, 450,
10, 450, 750, 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");
// 从exe启动, config.json放在exe同一目录
// 从vs启动, config.json放在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());
}
t.close();
}
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"sendmessage",
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);
}

View File

@ -0,0 +1,3 @@
#pragma once
#include "resource.h"

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

View File

@ -0,0 +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

View File

@ -0,0 +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>
</Project>

View File

@ -0,0 +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>
</Project>

15
framework.h 100644
View File

@ -0,0 +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>

26753
json.hpp 100644

File diff suppressed because it is too large Load Diff

35
resource.h 100644
View File

@ -0,0 +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

BIN
small.ico 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

6
targetver.h 100644
View File

@ -0,0 +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>

2
vendor/finclip/.gitignore vendored 100644
View File

@ -0,0 +1,2 @@
/lib
*.bz2

View File

@ -0,0 +1,352 @@
#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>
/**
* @brief APIjssdk
*
*/
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;
};
//函数指针回调
/**
* @params ret 0,1
* @params event IEvent
*
*
*/
typedef void (*FinClipSDKCallback)(IEvent* event);
///数据打包器接口
struct IFinPacker : public IKnown
{
public:
/**
* @brief
*/
virtual void BeginPacker() = 0;
/**
* @brief
* @detail KEY,VALUE
*
* @param field
* @param value
* @return 01
*/
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 01
*/
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;
};
/*
* api
*/
struct IApi
{
/**
* @brief
*
* @param event
* @param param
* @param callback
*/
virtual void invoke(const char* event, const char* param, FinClipSDKCallback callback) = 0;
/**
* @brief Apiapiwebview 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;
};
#endif // !__H_FINCLIPAPI_H__

View File

@ -0,0 +1,83 @@
#ifndef __H_FINCLIP_WRAPPER_H__
#define __H_FINCLIP_WRAPPER_H__
#include "finclip_api.h"
#include <windows.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief SDI
* @detail
*
* @param hinstance
* @param configpacker
* @return 01
*/
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 HRESULT FINSTDMETHODCALLTYPE CloseAllApplet();
/**
* @brief
* @detail
*
* @param
* @param
* @return
* @retval
* @note
* @attention
* @warning
* @exception
*/
DLL_EXPORT HRESULT FINSTDMETHODCALLTYPE CleanCache();
///小程序Api
/**打开小程序
*
* @param appstore
* @param appId appId
* @param param
* @param callback
* @return 01
*/
DLL_EXPORT HRESULT FINSTDMETHODCALLTYPE StartApplet(HWND hWnd, int apptype, const char* appid, const char* page_path,
IFinPacker* params, FinClipSDKCallback callback);
DLL_EXPORT HWND FINSTDMETHODCALLTYPE SetAppletPos(const char* appid, int appstore, int left, int top, int width,
int height);
DLL_EXPORT HRESULT FINSTDMETHODCALLTYPE FinClipShutdown();
#ifdef __cplusplus
}
#endif
#endif