基线 SVN r240

SVN-Revision: r240
This commit is contained in:
cyf
2025-02-06 06:46:06 +00:00
commit ab56a9bcf7
5317 changed files with 902274 additions and 0 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

+55
View File
@@ -0,0 +1,55 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
1. You must give any other recipients of the Work or Derivative Works a copy of this License; and
2. You must cause any modified files to carry prominent notices stating that You changed the files; and
3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>
@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using DevExpress.UserSkins;
using DevExpress.Skins;
using DevExpress.LookAndFeel;
using Lskj.Util;
using Lskj.Model;
using Lskj.Business;
using Lskj.MiniBlink;
namespace Lskj.MiniBlink
{
/// <summary>
/// c#库被调用统一接口类
/// </summary>
public sealed class DllBaseClass : IForm
{
public DllBaseClass()
{
}
public DllBaseClass(string[] obj)
{
try
{
DynamicPubNewBrowerModel moduleModel = new DynamicPubNewBrowerModel(obj);
FormMain main = new FormMain();
this.SubForm = main;
main.PubBrowerModel = moduleModel;
}
catch (Exception ex)
{
LogUtil.WriteError("Lskj.PubBrower.dll--参数错误-->" + obj.ToString(), ex);
}
}
/// <summary>
/// 窗口
/// </summary>
public Form SubForm { get; set; }
}
}
+56
View File
@@ -0,0 +1,56 @@
using Lskj.MiniBlink;
namespace Lskj.MiniBlink
{
partial class FormMain
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMain));
this.SuspendLayout();
//
// FormMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(895, 511);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "FormMain";
this.Opacity = 0D;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "浏览器壳子";
this.Load += new System.EventHandler(this.Form1_Load);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyDown);
this.ResumeLayout(false);
}
#endregion
}
}
@@ -0,0 +1,363 @@
using MiniBlinkPinvoke;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using Lskj.Control.Model;
using Lskj.Model;
using Lskj.Business.Impl;
using Lskj.Util;
using System.Web;
using Lskj.Business;
using Lskj.Control;
namespace Lskj.MiniBlink
{
public partial class FormMain : Form
{
public DynamicPubNewBrowerModel PubBrowerModel;
BlinkBrowser blinkBrowser1 = null;
static BlinkBrowser mb = null;
public string url = string.Empty;
/// <summary>
/// 下载验证
/// </summary>
public bool IsDownVerify = false;
public FormMain()
{
InitializeComponent();
}
//System.Windows.Forms.Timer queryTimer = new System.Windows.Forms.Timer();
private IntPtr taskPtr;
XL.DownTaskInfo taskInfo = new XL.DownTaskInfo();
[JSFunctin]
public void Console_WriteLine(string msg)
{
MessageBox.Show("Console_WriteLine " + msg);
}
/// <summary>
/// 浏览器初始化
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Form1_Load(object sender, EventArgs e)
{
WaitForm.ShowForm();
try
{
if (PubBrowerModel.isCalSize)
{
this.Height = Convert.ToInt32(Lskj.Main.Model.Manager.frmHeight * PubBrowerModel.PerHeight);
this.Width = Convert.ToInt32(Screen.PrimaryScreen.WorkingArea.Width * PubBrowerModel.PerWidth);
this.Location = new Point((Screen.PrimaryScreen.WorkingArea.Width - this.Width) / 2,
(Lskj.Main.Model.Manager.frmHeight - this.Height) / 2);
}
this.PubBrowerModel.Privilege = PubBrowerModel.ModuleId > 0 ? BaseImpl.GetUserPurviewsByMenuId(PubBrowerModel.ModuleId + "") + "" : BaseImpl.GetUserPurviewsByMenuCode(PubBrowerModel.ModuleCode) + "";
string urlEnd = string.IsNullOrEmpty(PubBrowerModel.UrlParame) ? ReplaceHelper.ReplaceUserInfo(PubBrowerModel.ModuleCode) : PubBrowerModel.UrlParame.StartsWith("http") ? ReplaceHelper.ReplaceUserInfo(PubBrowerModel.UrlParame) : HttpUtility.UrlEncode(PubBrowerModel.UrlParame);
url = PubBrowerModel.BetweenDLLCoid != null && PubBrowerModel.BetweenDLLCoid.StartsWith("http") ? PubBrowerModel.BetweenDLLCoid + urlEnd : urlEnd.StartsWith("http") ? PubBrowerModel.BetweenDLLCoid + urlEnd : SystemInfo.Instance.OAUrl + PubBrowerModel.BetweenDLLCoid + urlEnd;
bool downLoadFlag = this.PubBrowerModel.downLoadFlag == 1;
int RightKeyFlag = this.PubBrowerModel.RightKeyFlag;
if (downLoadFlag)
{
this.Close();
url = url.Replace("%2f", "/");
WebBrowser browserNew = new WebBrowser();//点击下载的页面
browserNew.Navigate(url);
}
else
{
this.Opacity = 100D;
blinkBrowser1 = new BlinkBrowser();
blinkBrowser1.GlobalObjectJs = this;
mb = blinkBrowser1;
blinkBrowser1.Dock = DockStyle.Fill;
Neghte(url);
this.Controls.Add(blinkBrowser1);
}
}
catch (Exception ex)
{
LogHelper.Instance.WriteError(ex, "浏览器dll");
//MessageUtil.Show(ex.Message + "\r\n" + ex.StackTrace);
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message, ex.Message);
}
finally
{
Lskj.Control.Model.AutoSizeChange.ControllInitializeSize(this);
}
WaitForm.HideForm();
}
public void Neghte(string url)
{
//BlinkBrowserPInvoke.wkeSetHandle(blinkBrowser1.handle, this.Handle);
//BlinkBrowserPInvoke.wkeSetHandleOffset(blinkBrowser1.handle, blinkBrowser1.Location.X-2,0);
blinkBrowser1.OnUrlChange2Call += BlinkBrowser1_OnUrlChange2Call;
blinkBrowser1.OnTitleChangeCall += BlinkBrowser1_OnTitleChangeCall;
blinkBrowser1.DocumentReadyCallback += BlinkBrowser1_DocumentReadyCallback;
blinkBrowser1.OnDownloadFile += BlinkBrowser1_OnDownloadFile;
this.url = url;
blinkBrowser1.Url = url;
// blinkBrowser1.Focus();
}
/// <summary>
/// winform键盘事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
try
{
//截屏
if (e.Control && e.Shift && e.KeyCode == Keys.C)
{
IntPtr mainFrameId = BlinkBrowserPInvoke.wkeWebFrameGetMainFrame(blinkBrowser1.handle);
int width = BlinkBrowserPInvoke.wkeGetContentWidth(blinkBrowser1.handle);
int height = BlinkBrowserPInvoke.wkeGetContentHeight(blinkBrowser1.handle);
wkeScreenshotSettings settings = new wkeScreenshotSettings
{
height = height,
width = width
};
settings.structSize = System.Runtime.InteropServices.Marshal.SizeOf(settings);
var bf = BlinkBrowserPInvoke.wkePrintToBitmap(blinkBrowser1.handle, mainFrameId, settings);
if (bf != IntPtr.Zero)
{
var data = (wkeMemBuf)Marshal.PtrToStructure(bf, typeof(wkeMemBuf));
if (data.data != IntPtr.Zero && data.length != 0)
{
byte[] ys = new byte[data.length];
Marshal.Copy(data.data, ys, 0, ys.Length);
string fileName = Guid.NewGuid().ToString("n") + ".bmp";
System.IO.File.WriteAllBytes(fileName, ys);
MessageBox.Show("截图保存成功,图片地址为:" + Application.StartupPath + "\\" + fileName);
}
else
{
MessageBox.Show("截图失败,数据解析失败。");
}
}
else
{
MessageBox.Show("截图失败,返回空。");
}
}
// 打开调试工具
if (e.KeyCode == Keys.F12)
{
blinkBrowser1.ShowDevtools(Application.StartupPath + @"\front_end\inspector.html");
}
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message, ex.Message);
}
}
/// <summary>
/// 下载文件
/// </summary>
/// <param name="url"></param>
private void BlinkBrowser1_OnDownloadFile(string url)
{
//只是简单实现下载,可以模仿其他下载界面,先弹出一个窗体,让用户选择保存路径文件名什么的。
//使用前先拷贝 libs/XL 目录中文件到软件运行目录。
if (File.Exists("xldl.dll"))
{
var initSuccess = XL.XL_Init();
if (initSuccess)
{
XL.DownTaskParam p = new XL.DownTaskParam()
{
IsResume = 0,
szTaskUrl = url,
szFilename = url.Substring(url.LastIndexOf('/') + 1),//简单处理文件名,实际中还需要单独处理,这里有BUG
szSavePath = AppDomain.CurrentDomain.BaseDirectory
};
string SzFileName = HttpUtility.UrlDecode(p.szFilename);
string[] szName = SzFileName.Split('/');
taskPtr = XL.XL_CreateTask(p);
var startSuccess = XL.XL_StartTask(taskPtr);
if (startSuccess)
{
string fileTitle = szName[szName.Length - 1];
DataRow rowItem = AttachImpl.GetTempletFile(fileTitle);
if (IsDownVerify)
{
if (rowItem != null)
{
Download(p.szTaskUrl, fileTitle);
}
else
{
MessageBox.Show("未找到下载项");
}
}
else
{
Download(p.szTaskUrl, fileTitle);
}
}
}
else
{
MessageBox.Show("XL_Init初始化失败");
}
}
else
{
MessageBox.Show("请先将 libs/XL 目录中文件到软件运行目录。");
}
}
/// <summary>
/// <para>说明:定义服务器文件地址,含文件名。客户端接收地址及文件名由客户端自行定义</para>
/// <para>创建人:王一帆</para>
/// <para>创建日期: </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="URL">The URL.</param>
/// <param name="FileName">Name of the file.</param>
public static void Download(string URL, string FileName)
{
FrmSelectDownload frmSelectDownload = new FrmSelectDownload();
frmSelectDownload.URL = URL;
frmSelectDownload.FileName = FileName;
frmSelectDownload.Show();
//SaveFileDialog saveFileDialog = new SaveFileDialog();
//saveFileDialog.FileName = FileName;
//saveFileDialog.Title = "下载模板文件到";
//saveFileDialog.RestoreDirectory = true;
////点了保存按钮进入
//if (saveFileDialog.ShowDialog() == DialogResult.OK)
//{
// string localFilePath = System.IO.Path.GetFullPath(saveFileDialog.FileName);//获得文件路径,含文件名
// string fileNameExt = localFilePath.Substring(localFilePath.LastIndexOf("\\") + 1);//获取文件名,不带路径
// string FilePath = localFilePath.Substring(0, localFilePath.LastIndexOf("\\"));//获取文件路径,不带文件名
// FrmDownload frm = new FrmDownload(URL, FileName, localFilePath);
// frm.Show();
//}
}
//[JSFunctin]
//public static async void DOTaskWithAsync(string str)
//{
// await Task.Run(() =>
// {
// Dotaskfunction(str);
// });
//}
public static void Dotaskfunction(string s)
{
Thread.Sleep(1000 * 5);
if (mb != null)
{
mb.Invoke(new Action<string>(
(sx) =>
{
string _str = "ceshi" + sx;
_str = System.Web.HttpUtility.UrlEncode(_str);
string invokeJSStr = "asyncTest('" + _str + "')";
mb.InvokeJS(invokeJSStr);
}
), s);
}
}
private void BlinkBrowser1_DocumentReadyCallback()
{
}
private void BlinkBrowser1_OnTitleChangeCall(string title)
{
Text = title;
}
private void BlinkBrowser1_OnUrlChange2Call(string url)
{
this.url = url;
}
private void button2_Click(object sender, EventArgs e)
{
try
{
blinkBrowser1.ShowDevtools(Application.StartupPath + @"\front_end\inspector.html");
//MiniBlinkPinvoke.BlinkBrowserPInvoke.wkeSetDebugConfig(blinkBrowser1.handle, "showDevTools", Application.StartupPath + @"\front_end\inspector.html");
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message, ex.Message);
}
}
private void button3_Click(object sender, EventArgs e)
{
try
{
IntPtr mainFrameId = BlinkBrowserPInvoke.wkeWebFrameGetMainFrame(blinkBrowser1.handle);
int width = BlinkBrowserPInvoke.wkeGetContentWidth(blinkBrowser1.handle);
int height = BlinkBrowserPInvoke.wkeGetContentHeight(blinkBrowser1.handle);
wkeScreenshotSettings settings = new wkeScreenshotSettings
{
height = height,
width = width
};
settings.structSize = System.Runtime.InteropServices.Marshal.SizeOf(settings);
var bf = BlinkBrowserPInvoke.wkePrintToBitmap(blinkBrowser1.handle, mainFrameId, settings);
if (bf != IntPtr.Zero)
{
var data = (wkeMemBuf)Marshal.PtrToStructure(bf, typeof(wkeMemBuf));
if (data.data != IntPtr.Zero && data.length != 0)
{
byte[] ys = new byte[data.length];
Marshal.Copy(data.data, ys, 0, ys.Length);
string fileName = Guid.NewGuid().ToString("n") + ".bmp";
System.IO.File.WriteAllBytes(fileName, ys);
MessageBox.Show("截图保存成功,图片地址为:" + Application.StartupPath + "\\" + fileName);
}
else
{
MessageBox.Show("截图失败,数据解析失败。");
}
}
else
{
MessageBox.Show("截图失败,返回空。");
}
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message, ex.Message);
}
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{FF9F4C6E-B7BA-498A-9F3F-49F27CE9AF1A}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MiniBlink</RootNamespace>
<AssemblyName>MiniBlink</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\Debug\Lib\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Prefer32Bit>false</Prefer32Bit>
<DocumentationFile>..\..\..\Debug\AllMethodXml\MiniBlink.XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="DevExpress.Data.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Printing.v15.2.Core, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Sparkline.v15.2.Core, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Utils.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraEditors.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Data.Linq" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DllBaseClass.cs" />
<Compile Include="FormMain.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FormMain.Designer.cs">
<DependentUpon>FormMain.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="FormMain.resx">
<DependentUpon>FormMain.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Content Include="index.html" />
<Content Include="libs\XL\download\atl71.dll" />
<Content Include="libs\XL\download\dl_peer_id.dll" />
<Content Include="libs\XL\download\download_engine.dll" />
<Content Include="libs\XL\download\MiniThunderPlatform.exe" />
<Content Include="libs\XL\download\minizip.dll" />
<Content Include="libs\XL\download\msvcp71.dll" />
<Content Include="libs\XL\download\msvcr71.dll" />
<Content Include="libs\XL\download\XLBugHandler.dll" />
<Content Include="libs\XL\download\XLBugReport.exe" />
<Content Include="libs\XL\download\zlib1.dll" />
<Content Include="libs\XL\xldl.dll" />
<Content Include="wkedefine.h" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="libs\XL\download\id.dat" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Lskj.AutoUpdate\Lskj.AutoUpdate.csproj">
<Project>{7FDD63DA-78E2-4093-B51E-060491DDFD5A}</Project>
<Name>Lskj.AutoUpdate</Name>
</ProjectReference>
<ProjectReference Include="..\..\Lskj.Business\Lskj.Business.csproj">
<Project>{7EAFCCC2-A18F-49E9-85C6-A984966CFD01}</Project>
<Name>Lskj.Business</Name>
</ProjectReference>
<ProjectReference Include="..\..\Lskj.Control\Lskj.Control.csproj">
<Project>{447CDC40-659F-4CCA-9ED6-8E818B4CF8BF}</Project>
<Name>Lskj.Control</Name>
</ProjectReference>
<ProjectReference Include="..\..\Lskj.Main\Lskj.Main.csproj">
<Project>{bca1e2b3-c4ab-4d2c-b519-3dcfdb5b83d6}</Project>
<Name>Lskj.Main</Name>
</ProjectReference>
<ProjectReference Include="..\..\Lskj.Model\Lskj.Model.csproj">
<Project>{52BC40E0-C0C6-4F78-996B-CAE028D209CA}</Project>
<Name>Lskj.Model</Name>
</ProjectReference>
<ProjectReference Include="..\..\Lskj.Util\Lskj.Util.csproj">
<Project>{A51BF642-6543-4DE3-8948-83F558B72BD4}</Project>
<Name>Lskj.Util</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("MiniBlink QQ:370588543")]
[assembly: AssemblyDescription("调用MB QQ:370588543")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("QQ:370588543 https://www.hejialong.com/")]
[assembly: AssemblyProduct("MiniBlink QQ:370588543 https://www.hejialong.com/")]
[assembly: AssemblyCopyright("Copyright © QQ:370588543 https://www.hejialong.com/ 2017")]
[assembly: AssemblyTrademark("QQ:370588543 https://www.hejialong.com/")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("ff9f4c6e-b7ba-498a-9f3f-49f27ce9af1a")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="NPOI" publicKeyToken="0df73ec7942b34e1" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.3.1" newVersion="2.1.3.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.10.0" newVersion="2.6.10.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.10.0" newVersion="2.6.10.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Spire.XLS" publicKeyToken="663f351905198cb3" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.3.8.0" newVersion="10.3.8.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Spire.Presentation" publicKeyToken="663f351905198cb3" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.3.6.0" newVersion="5.3.6.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Spire.Doc" publicKeyToken="663f351905198cb3" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.3.15.0" newVersion="8.3.15.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
@@ -0,0 +1,72 @@
<html>
<head>
<meta charset="GBK">
<title>
测试页面
</title>
<script>
Console_WriteLine("测试调用后台方法" + Date.parse(new Date()))
alert("hhaxx是");
//var testJson = '{ "name": "he" }';
function testInt() {
return 1213;
}
function testBool() {
return true;
}
function testString() {
return "123";
}
var res = jsReturnValueTest("2017");
//var xc =JsGetValue;
Console_WriteLine(res);
//Console_WriteLine2(1231511, "第二个参数");
setTimeout(function () {
//testJson.name = "C#";
testJson = '{ "name": "he11111111111111111111111" }';
console.log("testJson:" + testJson);
}, 2000);
var sleep = function (time) {
return new Promise(function (resolve, reject) {
setTimeout(function () {
resolve();
}, time);
})
};
//异步调用测试,由于工程还原成2.0了所以这个方法没意义了。
/*
function asyncTest(str) {
Console_WriteLine("async down ########" +unescape(str));
}
var start = async function () {
// 在这里使用起来就像同步代码那样直观
console.log('start');
alert(1);
DOTaskWithAsync("前台传值到后台");
alert(2);
console.log('end');
};
*/
start();
</script>
</head>
<!--设置margin才能显示阴影-->
<body style="margin:8px;">
documen
<div>
<a>迅雷下载说明:</a>
<p>1,拷贝 libs/XL 目录中文件到软件运行目录。</p>
<p>2,地址栏输入如:https://download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64.exe</p>
<p>3,点击加载URL按钮</p>
<a href="https://www.baidu.com/" target="_self">百度一下</a>
</div>
</body>
</html>
@@ -0,0 +1,3 @@
[partner]
id=80000054
ver = 3.2.1.36
Binary file not shown.
@@ -0,0 +1,898 @@
/*
*
* wolar@qq.com
* http://miniblink.net
* https://github.com/weolar/miniblink49
* licence MIT
*
*/
#ifndef WKE_DEFINE_H
#define WKE_DEFINE_H
#include <windows.h>
//////////////////////////////////////////////////////////////////////////
typedef struct {
int x;
int y;
int w;
int h;
} wkeRect;
typedef enum {
WKE_LBUTTON = 0x01,
WKE_RBUTTON = 0x02,
WKE_SHIFT = 0x04,
WKE_CONTROL = 0x08,
WKE_MBUTTON = 0x10,
} wkeMouseFlags;
typedef enum {
WKE_EXTENDED = 0x0100,
WKE_REPEAT = 0x4000,
} wkeKeyFlags;
typedef enum {
WKE_MSG_MOUSEMOVE = 0x0200,
WKE_MSG_LBUTTONDOWN = 0x0201,
WKE_MSG_LBUTTONUP = 0x0202,
WKE_MSG_LBUTTONDBLCLK = 0x0203,
WKE_MSG_RBUTTONDOWN = 0x0204,
WKE_MSG_RBUTTONUP = 0x0205,
WKE_MSG_RBUTTONDBLCLK = 0x0206,
WKE_MSG_MBUTTONDOWN = 0x0207,
WKE_MSG_MBUTTONUP = 0x0208,
WKE_MSG_MBUTTONDBLCLK = 0x0209,
WKE_MSG_MOUSEWHEEL = 0x020A,
} wkeMouseMsg;
#if !defined(__cplusplus)
#ifndef HAVE_WCHAR_T
typedef unsigned short wchar_t;
#endif
#ifndef HAVE_BOOL
typedef unsigned char bool;
#define true 1
#define false 0
#endif
#endif
typedef char utf8;
#if !defined(__cplusplus)
typedef void* jsExecState;
#else
struct JsExecStateInfo;
typedef JsExecStateInfo* jsExecState;
#endif
typedef __int64 jsValue;
#if defined(__cplusplus)
namespace wke { class CWebView; };
typedef wke::CWebView* wkeWebView;
namespace wke { class CString; };
typedef wke::CString* wkeString;
#else
struct _tagWkeWebView;
typedef struct _tagWkeWebView* wkeWebView;
struct _tagWkeString;
typedef struct _tagWkeString* wkeString;
#endif
typedef enum {
WKE_PROXY_NONE,
WKE_PROXY_HTTP,
WKE_PROXY_SOCKS4,
WKE_PROXY_SOCKS4A,
WKE_PROXY_SOCKS5,
WKE_PROXY_SOCKS5HOSTNAME
} wkeProxyType;
typedef struct {
wkeProxyType type;
char hostname[100];
unsigned short port;
char username[50];
char password[50];
} wkeProxy;
enum wkeSettingMask {
WKE_SETTING_PROXY = 1,
WKE_SETTING_PAINTCALLBACK_IN_OTHER_THREAD = 1 << 2,
};
typedef struct {
wkeProxy proxy;
unsigned int mask;
} wkeSettings;
typedef void* wkeWebFrameHandle;
typedef void* (*FILE_OPEN_) (const char* path);
typedef void(*FILE_CLOSE_) (void* handle);
typedef size_t(*FILE_SIZE) (void* handle);
typedef int(*FILE_READ) (void* handle, void* buffer, size_t size);
typedef int(*FILE_SEEK) (void* handle, int offset, int origin);
typedef FILE_OPEN_ WKE_FILE_OPEN;
typedef FILE_CLOSE_ WKE_FILE_CLOSE;
typedef FILE_SIZE WKE_FILE_SIZE;
typedef FILE_READ WKE_FILE_READ;
typedef FILE_SEEK WKE_FILE_SEEK;
typedef bool(*WKE_EXISTS_FILE)(const char * path);
typedef void(*ON_TITLE_CHANGED) (const struct _wkeClientHandler* clientHandler, const wkeString title);
typedef void(*ON_URL_CHANGED) (const struct _wkeClientHandler* clientHandler, const wkeString url);
typedef struct _wkeClientHandler {
ON_TITLE_CHANGED onTitleChanged;
ON_URL_CHANGED onURLChanged;
} wkeClientHandler;
typedef bool(*wkeCookieVisitor)(
void* params,
const char* name,
const char* value,
const char* domain,
const char* path, // If |path| is non-empty only URLs at or below the path will get the cookie value.
int secure, // If |secure| is true the cookie will only be sent for HTTPS requests.
int httpOnly, // If |httponly| is true the cookie will only be sent for HTTP requests.
int* expires // The cookie expiration date is only valid if |has_expires| is true.
);
enum wkeCookieCommand {
wkeCookieCommandClearAllCookies,
wkeCookieCommandClearSessionCookies,
wkeCookieCommandFlushCookiesToFile,
wkeCookieCommandReloadCookiesFromFile,
};
typedef enum {
WKE_NAVIGATION_TYPE_LINKCLICK,
WKE_NAVIGATION_TYPE_FORMSUBMITTE,
WKE_NAVIGATION_TYPE_BACKFORWARD,
WKE_NAVIGATION_TYPE_RELOAD,
WKE_NAVIGATION_TYPE_FORMRESUBMITT,
WKE_NAVIGATION_TYPE_OTHER
} wkeNavigationType;
enum WkeCursorInfoType {
WkeCursorInfoPointer,
WkeCursorInfoCross,
WkeCursorInfoHand,
WkeCursorInfoIBeam,
WkeCursorInfoWait,
WkeCursorInfoHelp,
WkeCursorInfoEastResize,
WkeCursorInfoNorthResize,
WkeCursorInfoNorthEastResize,
WkeCursorInfoNorthWestResize,
WkeCursorInfoSouthResize,
WkeCursorInfoSouthEastResize,
WkeCursorInfoSouthWestResize,
WkeCursorInfoWestResize,
WkeCursorInfoNorthSouthResize,
WkeCursorInfoEastWestResize,
WkeCursorInfoNorthEastSouthWestResize,
WkeCursorInfoNorthWestSouthEastResize,
WkeCursorInfoColumnResize,
WkeCursorInfoRowResize,
WkeCursorInfoMiddlePanning,
WkeCursorInfoEastPanning,
WkeCursorInfoNorthPanning,
WkeCursorInfoNorthEastPanning,
WkeCursorInfoNorthWestPanning,
WkeCursorInfoSouthPanning,
WkeCursorInfoSouthEastPanning,
WkeCursorInfoSouthWestPanning,
WkeCursorInfoWestPanning,
WkeCursorInfoMove,
WkeCursorInfoVerticalText,
WkeCursorInfoCell,
WkeCursorInfoContextMenu,
WkeCursorInfoAlias,
WkeCursorInfoProgress,
WkeCursorInfoNoDrop,
WkeCursorInfoCopy,
WkeCursorInfoNone,
WkeCursorInfoNotAllowed,
WkeCursorInfoZoomIn,
WkeCursorInfoZoomOut,
WkeCursorInfoGrab,
WkeCursorInfoGrabbing,
WkeCursorInfoCustom
};
typedef struct {
int x;
int y;
int width;
int height;
bool menuBarVisible;
bool statusBarVisible;
bool toolBarVisible;
bool locationBarVisible;
bool scrollbarsVisible;
bool resizable;
bool fullscreen;
} wkeWindowFeatures;
typedef void(*wkeTitleChangedCallback)(wkeWebView webView, void* param, const wkeString title);
typedef void(*wkeURLChangedCallback)(wkeWebView webView, void* param, const wkeString url);
typedef void(*wkeURLChangedCallback2)(wkeWebView webView, void* param, wkeWebFrameHandle frameId, const wkeString url);
typedef void(*wkePaintUpdatedCallback)(wkeWebView webView, void* param, const HDC hdc, int x, int y, int cx, int cy);
typedef void(*wkeAlertBoxCallback)(wkeWebView webView, void* param, const wkeString msg);
typedef bool(*wkeConfirmBoxCallback)(wkeWebView webView, void* param, const wkeString msg);
typedef bool(*wkePromptBoxCallback)(wkeWebView webView, void* param, const wkeString msg, const wkeString defaultResult, wkeString result);
typedef bool(*wkeNavigationCallback)(wkeWebView webView, void* param, wkeNavigationType navigationType, const wkeString url);
typedef wkeWebView(*wkeCreateViewCallback)(wkeWebView webView, void* param, wkeNavigationType navigationType, const wkeString url, const wkeWindowFeatures* windowFeatures);
typedef void(*wkeDocumentReadyCallback)(wkeWebView webView, void* param);
typedef void(*wkeDocumentReady2Callback)(wkeWebView webView, void* param, wkeWebFrameHandle frameId);
typedef wkeWebView(*wkeCreateViewCallback)(wkeWebView webView, void* param, wkeNavigationType navigationType, const wkeString url, const wkeWindowFeatures* windowFeatures);
typedef void(*wkeDocumentReadyCallback)(wkeWebView webView, void* param);
typedef void(*wkeDocumentReady2Callback)(wkeWebView webView, void* param, wkeWebFrameHandle frameId);
typedef enum {
WKE_LOADING_SUCCEEDED,
WKE_LOADING_FAILED,
WKE_LOADING_CANCELED
} wkeLoadingResult;
typedef void(*wkeLoadingFinishCallback)(wkeWebView webView, void* param, const wkeString url, wkeLoadingResult result, const wkeString failedReason);
typedef bool(*wkeDownloadCallback)(wkeWebView webView, void* param, const char* url);
typedef enum {
wkeLevelDebug = 4,
wkeLevelLog = 1,
wkeLevelInfo = 5,
wkeLevelWarning = 2,
wkeLevelError = 3,
wkeLevelRevokedError = 6,
wkeLevelLast = wkeLevelInfo
} wkeConsoleLevel;
typedef void(*wkeConsoleCallback)(wkeWebView webView, void* param, wkeConsoleLevel level, const wkeString message, const wkeString sourceName, unsigned sourceLine, const wkeString stackTrace);
typedef void(*wkeOnCallUiThread)(wkeWebView webView, void* paramOnInThread);
typedef void(*wkeCallUiThread)(wkeWebView webView, wkeOnCallUiThread func, void* param);
//wkeNet--------------------------------------------------------------------------------------
typedef bool(*wkeLoadUrlBeginCallback)(wkeWebView webView, void* param, const char *url, void *job);
typedef void(*wkeLoadUrlEndCallback)(wkeWebView webView, void* param, const char *url, void *job, void* buf, int len);
typedef void(*wkeDidCreateScriptContextCallback)(wkeWebView webView, void* param, wkeWebFrameHandle frameId, void* context, int extensionGroup, int worldId);
typedef void(*wkeWillReleaseScriptContextCallback)(wkeWebView webView, void* param, wkeWebFrameHandle frameId, void* context, int worldId);
typedef bool(*wkeNetResponseCallback)(wkeWebView webView, void* param, const char* url, void* job);
typedef void* v8ContextPtr;
typedef void* v8Isolate;
//wkewindow-----------------------------------------------------------------------------------
typedef enum {
WKE_WINDOW_TYPE_POPUP,
WKE_WINDOW_TYPE_TRANSPARENT,
WKE_WINDOW_TYPE_CONTROL
} wkeWindowType;
typedef bool(*wkeWindowClosingCallback)(wkeWebView webWindow, void* param);
typedef void(*wkeWindowDestroyCallback)(wkeWebView webWindow, void* param);
//JavaScript Bind-----------------------------------------------------------------------------------
#define JS_CALL __fastcall
typedef jsValue(JS_CALL* jsNativeFunction) (jsExecState es);
typedef jsValue(*wkeJsNativeFunction) (jsExecState es, void* param);
typedef enum {
JSTYPE_NUMBER,
JSTYPE_STRING,
JSTYPE_BOOLEAN,
JSTYPE_OBJECT,
JSTYPE_FUNCTION,
JSTYPE_UNDEFINED,
JSTYPE_ARRAY,
} jsType;
// cexer JS对象、函数绑定支持
typedef jsValue(*jsGetPropertyCallback)(jsExecState es, jsValue object, const char* propertyName);
typedef bool(*jsSetPropertyCallback)(jsExecState es, jsValue object, const char* propertyName, jsValue value);
typedef jsValue(*jsCallAsFunctionCallback)(jsExecState es, jsValue object, jsValue* args, int argCount);
typedef void(*jsFinalizeCallback)(struct tagjsData* data);
typedef struct tagjsData {
char typeName[100];
jsGetPropertyCallback propertyGet;
jsSetPropertyCallback propertySet;
jsFinalizeCallback finalize;
jsCallAsFunctionCallback callAsFunction;
} jsData;
namespace wke {
class IWebView {
public:
virtual void destroy() = 0;
virtual const char* name() const = 0;
virtual void setName(const char* name) = 0;
virtual bool isTransparent() const = 0;
virtual void setTransparent(bool transparent) = 0;
virtual void loadURL(const utf8* url) = 0;
virtual void loadURL(const wchar_t* url) = 0;
virtual void loadHTML(const utf8* html) = 0;
virtual void loadHTML(const wchar_t* html) = 0;
virtual void loadFile(const utf8* filename) = 0;
virtual void loadFile(const wchar_t* filename) = 0;
virtual const utf8* url() const = 0;
virtual bool isLoading() const = 0; /*document load sucessed*/
virtual bool isLoadingFailed() const = 0; /*document load failed*/
virtual bool isLoadingSucceeded() const = 0; /*document load complete*/
virtual bool isDocumentReady() const = 0; /*document ready*/
virtual void stopLoading() = 0;
virtual void reload() = 0;
virtual const utf8* title() = 0;
virtual const wchar_t* titleW() = 0;
virtual void resize(int w, int h) = 0;
virtual int width() const = 0; /*viewport width*/
virtual int height() const = 0; /*viewport height*/
virtual int contentsWidth() const = 0; /*contents width*/
virtual int contentsHeight() const = 0; /*contents height*/
virtual void setDirty(bool dirty) = 0;
virtual bool isDirty() const = 0;
virtual void addDirtyArea(int x, int y, int w, int h) = 0;
virtual void layoutIfNeeded() = 0;
virtual void paint(void* bits, int pitch) = 0;
virtual bool canGoBack() const = 0;
virtual bool goBack() = 0;
virtual bool canGoForward() const = 0;
virtual bool goForward() = 0;
virtual void editorSelectAll() = 0;
virtual void editorUnSelect() = 0;
virtual void editorCopy() = 0;
virtual void editorCut() = 0;
virtual void editorPaste() = 0;
virtual void editorDelete() = 0;
virtual void editorUndo() = 0;
virtual void editorRedo() = 0;
virtual void setCookieEnabled(bool enable) = 0;
virtual bool isCookieEnabled() const = 0;
virtual void setMediaVolume(float volume) = 0;
virtual float mediaVolume() const = 0;
virtual bool fireMouseEvent(unsigned int message, int x, int y, unsigned int flags) = 0;
virtual bool fireContextMenuEvent(int x, int y, unsigned int flags) = 0;
virtual bool fireMouseWheelEvent(int x, int y, int delta, unsigned int flags) = 0;
virtual bool fireKeyUpEvent(unsigned int virtualKeyCode, unsigned int flags, bool systemKey) = 0;
virtual bool fireKeyDownEvent(unsigned int virtualKeyCode, unsigned int flags, bool systemKey) = 0;
virtual bool fireKeyPressEvent(unsigned int virtualKeyCode, unsigned int flags, bool systemKey) = 0;
virtual void setFocus() = 0;
virtual void killFocus() = 0;
virtual wkeRect getCaret() = 0;
virtual jsValue runJS(const utf8* script) = 0;
virtual jsValue runJS(const wchar_t* script) = 0;
virtual jsExecState globalExec() = 0;
virtual void sleep() = 0; //moveOffscreen
virtual void wake() = 0; //moveOnscreen
virtual bool isAwake() const = 0;
virtual void setZoomFactor(float factor) = 0;
virtual float zoomFactor() const = 0;
virtual void setEditable(bool editable) = 0;
virtual void setClientHandler(const wkeClientHandler* handler) = 0;
virtual const wkeClientHandler* getClientHandler() const = 0;
};
}
//////////////////////////////////////////////////////////////////////////
#define WKE_CALL_TYPE __cdecl
#define WKE_DEFINE_ITERATOR0(returnVal, name, description) \
typedef returnVal(WKE_CALL_TYPE* FN_##name)(); \
__declspec(selectany) FN_##name name;
#define WKE_DEFINE_ITERATOR1(returnVal, name, p1, description) \
typedef returnVal(WKE_CALL_TYPE* FN_##name)(p1); \
__declspec(selectany) FN_##name name;
#define WKE_DEFINE_ITERATOR2(returnVal, name, p1, p2, description) \
typedef returnVal(WKE_CALL_TYPE* FN_##name)(p1, p2); \
__declspec(selectany) FN_##name name;
#define WKE_DEFINE_ITERATOR3(returnVal, name, p1, p2, p3, description) \
typedef returnVal(WKE_CALL_TYPE* FN_##name)(p1, p2, p3); \
__declspec(selectany) FN_##name name;
#define WKE_DEFINE_ITERATOR4(returnVal, name, p1, p2, p3, p4, description) \
typedef returnVal(WKE_CALL_TYPE* FN_##name)(p1, p2, p3, p4); \
__declspec(selectany) FN_##name name;
#define WKE_DEFINE_ITERATOR5(returnVal, name, p1, p2, p3, p4, p5, description) \
typedef returnVal(WKE_CALL_TYPE* FN_##name)(p1, p2, p3, p4, p5); \
__declspec(selectany) FN_##name name;
#define WKE_DEFINE_ITERATOR6(returnVal, name, p1, p2, p3, p4, p5, p6, description) \
typedef returnVal(WKE_CALL_TYPE* FN_##name)(p1, p2, p3, p4, p5, p6); \
__declspec(selectany) FN_##name name;
#define WKE_DEFINE_ITERATOR11(returnVal, name, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, description) \
typedef returnVal(WKE_CALL_TYPE* FN_##name)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); \
__declspec(selectany) FN_##name name;
// ---
#define WKE_DECLARE_ITERATOR0(returnVal, name, description) \
extern "C" __declspec(dllexport) returnVal WKE_CALL_TYPE name();
#define WKE_DECLARE_ITERATOR1(returnVal, name, p1, description) \
extern "C" __declspec(dllexport) returnVal WKE_CALL_TYPE name(p1);
#define WKE_DECLARE_ITERATOR2(returnVal, name, p1, p2, description) \
extern "C" __declspec(dllexport) returnVal WKE_CALL_TYPE name(p1, p2);
#define WKE_DECLARE_ITERATOR3(returnVal, name, p1, p2, p3, description) \
extern "C" __declspec(dllexport) returnVal WKE_CALL_TYPE name(p1, p2, p3);
#define WKE_DECLARE_ITERATOR4(returnVal, name, p1, p2, p3, p4, description) \
extern "C" __declspec(dllexport) returnVal WKE_CALL_TYPE name(p1, p2, p3, p4);
#define WKE_DECLARE_ITERATOR5(returnVal, name, p1, p2, p3, p4, p5, description) \
extern "C" __declspec(dllexport) returnVal WKE_CALL_TYPE name(p1, p2, p3, p4, p5);
#define WKE_DECLARE_ITERATOR6(returnVal, name, p1, p2, p3, p4, p5, p6, description) \
extern "C" __declspec(dllexport) returnVal WKE_CALL_TYPE name(p1, p2, p3, p4, p5, p6);
#define WKE_DECLARE_ITERATOR11(returnVal, name, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, description) \
extern "C" __declspec(dllexport) returnVal WKE_CALL_TYPE name(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11);
// ---
#define WKE_GET_PTR_ITERATOR(name) \
name = (FN_##name)::GetProcAddress(hMod, #name); \
if (!name) \
MessageBoxA(nullptr, "wke api not found", #name, 0);
#define WKE_GET_PTR_ITERATOR0(returnVal, name, description) \
WKE_GET_PTR_ITERATOR(name);
#define WKE_GET_PTR_ITERATOR1(returnVal, name, p1, description) \
WKE_GET_PTR_ITERATOR(name);
#define WKE_GET_PTR_ITERATOR2(returnVal, name, p1, p2, description) \
WKE_GET_PTR_ITERATOR(name);
#define WKE_GET_PTR_ITERATOR3(returnVal, name, p1, p2, p3, description) \
WKE_GET_PTR_ITERATOR(name);
#define WKE_GET_PTR_ITERATOR4(returnVal, name, p1, p2, p3, p4, description) \
WKE_GET_PTR_ITERATOR(name);
#define WKE_GET_PTR_ITERATOR5(returnVal, name, p1, p2, p3, p4, p5, description) \
WKE_GET_PTR_ITERATOR(name);
#define WKE_GET_PTR_ITERATOR6(returnVal, name, p1, p2, p3, p4, p5, p6, description) \
WKE_GET_PTR_ITERATOR(name);
#define WKE_GET_PTR_ITERATOR11(returnVal, name, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, description) \
WKE_GET_PTR_ITERATOR(name);
// 以下是wke的导出函数。格式按照【返回类型】【函数名】【参数】来排列
#define WKE_FOR_EACH_DEFINE_FUNCTION(ITERATOR0, ITERATOR1, ITERATOR2, ITERATOR3, ITERATOR4, ITERATOR5, ITERATOR6, ITERATOR11) \
ITERATOR0(void, wkeShutdown, "") \
\
ITERATOR0(unsigned int, wkeVersion, "") \
ITERATOR0(const utf8*, wkeVersionString, "") \
ITERATOR2(void, wkeGC, wkeWebView webView, long delayMs, "") \
ITERATOR5(void, wkeSetFileSystem, WKE_FILE_OPEN pfnOpen, WKE_FILE_CLOSE pfnClose, WKE_FILE_SIZE pfnSize, WKE_FILE_READ pfnRead, WKE_FILE_SEEK pfnSeek, "") \
\
ITERATOR1(const char*, wkeWebViewName, wkeWebView webView, "") \
ITERATOR2(void, wkeSetWebViewName, wkeWebView webView, const char* name, "") \
\
ITERATOR1(bool, wkeIsLoaded, wkeWebView webView, "") \
ITERATOR1(bool, wkeIsLoadFailed, wkeWebView webView, "") \
ITERATOR1(bool, wkeIsLoadComplete, wkeWebView webView, "") \
\
ITERATOR1(const utf8*, wkeGetSource, wkeWebView webView, "") \
ITERATOR1(const utf8*, wkeTitle, wkeWebView webView, "") \
ITERATOR1(const wchar_t*, wkeTitleW, wkeWebView webView, "") \
ITERATOR1(int, wkeWidth, wkeWebView webView, "") \
ITERATOR1(int, wkeHeight, wkeWebView webView, "") \
ITERATOR1(int, wkeContentsWidth, wkeWebView webView, "") \
ITERATOR1(int, wkeContentsHeight, wkeWebView webView, "") \
\
ITERATOR1(void, wkeSelectAll, wkeWebView webView, "") \
ITERATOR1(void, wkeCopy, wkeWebView webView, "") \
ITERATOR1(void, wkeCut, wkeWebView webView, "") \
ITERATOR1(void, wkePaste, wkeWebView webView, "") \
ITERATOR1(void, wkeDelete, wkeWebView webView, "") \
\
ITERATOR1(bool, wkeCookieEnabled, wkeWebView webView, "") \
ITERATOR1(float, wkeMediaVolume, wkeWebView webView, "") \
\
ITERATOR5(bool, wkeMouseEvent, wkeWebView webView, unsigned int message, int x, int y, unsigned int flags, "") \
ITERATOR4(bool, wkeContextMenuEvent, wkeWebView webView, int x, int y, unsigned int flags, "") \
ITERATOR5(bool, wkeMouseWheel, wkeWebView webView, int x, int y, int delta, unsigned int flags, "") \
ITERATOR4(bool, wkeKeyUp, wkeWebView webView, unsigned int virtualKeyCode, unsigned int flags, bool systemKey, "") \
ITERATOR4(bool, wkeKeyDown, wkeWebView webView, unsigned int virtualKeyCode, unsigned int flags, bool systemKey, "") \
ITERATOR4(bool, wkeKeyPress, wkeWebView webView, unsigned int virtualKeyCode, unsigned int flags, bool systemKey, "") \
\
ITERATOR1(void, wkeFocus, wkeWebView webView, "") \
ITERATOR1(void, wkeUnfocus, wkeWebView webView, "") \
\
ITERATOR1(wkeRect, wkeGetCaret, wkeWebView webView, "") \
\
ITERATOR1(void, wkeAwaken, wkeWebView webView, "") \
\
ITERATOR1(float, wkeZoomFactor, wkeWebView webView, "") \
\
ITERATOR2(void, wkeSetClientHandler, wkeWebView webView, const wkeClientHandler* handler, "") \
ITERATOR1(const wkeClientHandler*, wkeGetClientHandler, wkeWebView webView, "") \
\
ITERATOR1(const utf8*, wkeToString, const wkeString string, "") \
ITERATOR1(const wchar_t*, wkeToStringW, const wkeString string, "") \
\
ITERATOR2(const utf8*, jsToString, jsExecState es, jsValue v, "") \
ITERATOR2(const wchar_t*, jsToStringW, jsExecState es, jsValue v, "") \
\
ITERATOR1(void, wkeConfigure, const wkeSettings* settings, "") \
ITERATOR0(bool, wkeIsInitialize, "") \
\
ITERATOR2(void, wkeSetDebugConfig, wkeWebView webView, const char* debugString, "") \
\
ITERATOR0(void, wkeFinalize, "") \
ITERATOR0(void, wkeUpdate, "") \
ITERATOR0(unsigned int, wkeGetVersion, "") \
ITERATOR0(const utf8*, wkeGetVersionString, "") \
\
ITERATOR0(wkeWebView, wkeCreateWebView, "") \
ITERATOR1(void, wkeDestroyWebView, wkeWebView webView, "") \
\
ITERATOR2(void, wkeSetMemoryCacheEnable, wkeWebView webView, bool b, "") \
ITERATOR2(void, wkeSetTouchEnabled, wkeWebView webView, bool b, "") \
ITERATOR2(void, wkeSetNavigationToNewWindowEnable, wkeWebView webView, bool b, "") \
ITERATOR2(void, wkeSetCspCheckEnable, wkeWebView webView, bool b, "") \
ITERATOR2(void, wkeSetNpapiPluginsEnabled, wkeWebView webView, bool b, "") \
ITERATOR2(void, wkeSetHeadlessEnabled, wkeWebView webView, bool b, "可以关闭渲染") \
ITERATOR2(void, wkeSetViewNetInterface, wkeWebView webView, const char* netInterface, "") \
\
ITERATOR1(void, wkeSetProxy, const wkeProxy* proxy, "") \
ITERATOR2(void, wkeSetViewProxy, wkeWebView webView, wkeProxy *proxy, "") \
\
ITERATOR1(const char*, wkeGetName, wkeWebView webView, "") \
ITERATOR2(void, wkeSetName, wkeWebView webView, const char* name, "") \
\
ITERATOR2(void, wkeSetHandle, wkeWebView webView, HWND wnd, "") \
ITERATOR3(void, wkeSetHandleOffset, wkeWebView webView, int x, int y, "") \
\
ITERATOR1(bool, wkeIsTransparent, wkeWebView webView, "") \
ITERATOR2(void, wkeSetTransparent, wkeWebView webView, bool transparent, "") \
\
ITERATOR2(void, wkeSetUserAgent, wkeWebView webView, const utf8* userAgent, "") \
ITERATOR2(void, wkeSetUserAgentW, wkeWebView webView, const wchar_t* userAgent, "") \
\
ITERATOR2(void, wkeLoadW, wkeWebView webView, const wchar_t* url, "") \
ITERATOR2(void, wkeLoadURL, wkeWebView webView, const utf8* url, "") \
ITERATOR2(void, wkeLoadURLW, wkeWebView webView, const wchar_t* url, "") \
ITERATOR4(void, wkePostURL, wkeWebView wkeView, const utf8* url, const char* postData, int postLen, "") \
ITERATOR4(void, wkePostURLW, wkeWebView wkeView, const wchar_t* url, const char* postData, int postLen, "") \
\
ITERATOR2(void, wkeLoadHTML, wkeWebView webView, const utf8* html, "") \
ITERATOR2(void, wkeLoadHTMLW, wkeWebView webView, const wchar_t* html, "") \
\
ITERATOR2(void, wkeLoadFile, wkeWebView webView, const utf8* filename, "") \
ITERATOR2(void, wkeLoadFileW, wkeWebView webView, const wchar_t* filename, "") \
\
ITERATOR1(const utf8*, wkeGetURL, wkeWebView webView, "") \
\
ITERATOR1(bool, wkeIsLoading, wkeWebView webView, "") \
ITERATOR1(bool, wkeIsLoadingSucceeded, wkeWebView webView, "") \
ITERATOR1(bool, wkeIsLoadingFailed, wkeWebView webView, "") \
ITERATOR1(bool, wkeIsLoadingCompleted, wkeWebView webView, "") \
ITERATOR1(bool, wkeIsDocumentReady, wkeWebView webView, "") \
ITERATOR1(void, wkeStopLoading, wkeWebView webView, "") \
ITERATOR1(void, wkeReload, wkeWebView webView, "") \
\
ITERATOR1(const utf8*, wkeGetTitle, wkeWebView webView, "") \
ITERATOR1(const wchar_t*, wkeGetTitleW, wkeWebView webView, "") \
\
ITERATOR3(void, wkeResize, wkeWebView webView, int w, int h, "") \
ITERATOR1(int, wkeGetWidth, wkeWebView webView, "") \
ITERATOR1(int, wkeGetHeight, wkeWebView webView, "") \
ITERATOR1(int, wkeGetContentWidth, wkeWebView webView, "") \
ITERATOR1(int, wkeGetContentHeight, wkeWebView webView, "") \
\
ITERATOR2(void, wkeSetDirty, wkeWebView webView, bool dirty, "") \
ITERATOR1(bool, wkeIsDirty, wkeWebView webView, "") \
ITERATOR5(void, wkeAddDirtyArea, wkeWebView webView, int x, int y, int w, int h, "") \
ITERATOR1(void, wkeLayoutIfNeeded, wkeWebView webView, "") \
ITERATOR11(void, wkePaint2, wkeWebView webView, void* bits, int bufWid, int bufHei, int xDst, int yDst, int w, int h, int xSrc, int ySrc, bool bCopyAlpha, "") \
ITERATOR3(void, wkePaint, wkeWebView webView, void* bits, int pitch, "") \
ITERATOR1(void, wkeRepaintIfNeeded, wkeWebView webView, "") \
ITERATOR1(HDC, wkeGetViewDC, wkeWebView webView, "") \
ITERATOR1(HWND, wkeGetHostHWND, wkeWebView webView, "") \
\
ITERATOR1(bool, wkeCanGoBack, wkeWebView webView, "") \
ITERATOR1(bool, wkeGoBack, wkeWebView webView, "") \
ITERATOR1(bool, wkeCanGoForward, wkeWebView webView, "") \
ITERATOR1(bool, wkeGoForward, wkeWebView webView, "") \
\
ITERATOR1(void, wkeEditorSelectAll, wkeWebView webView, "") \
ITERATOR1(void, wkeEditorUnSelect, wkeWebView webView, "") \
ITERATOR1(void, wkeEditorCopy, wkeWebView webView, "") \
ITERATOR1(void, wkeEditorCut, wkeWebView webView, "") \
ITERATOR1(void, wkeEditorPaste, wkeWebView webView, "") \
ITERATOR1(void, wkeEditorDelete, wkeWebView webView, "") \
ITERATOR1(void, wkeEditorUndo, wkeWebView webView, "") \
ITERATOR1(void, wkeEditorRedo, wkeWebView webView, "") \
\
ITERATOR1(const wchar_t*, wkeGetCookieW, wkeWebView webView, "") \
ITERATOR1(const utf8*, wkeGetCookie, wkeWebView webView, "") \
ITERATOR3(void, wkeSetCookie, wkeWebView webView, const utf8* url, const utf8* cookie, "cookie格式必须是:Set-cookie: PRODUCTINFO=webxpress; domain=.fidelity.com; path=/; secure") \
ITERATOR2(void, wkeVisitAllCookie, void* params, wkeCookieVisitor visitor, "") \
ITERATOR1(void, wkePerformCookieCommand, wkeCookieCommand command, "") \
ITERATOR2(void, wkeSetCookieEnabled, wkeWebView webView, bool enable, "") \
ITERATOR1(bool, wkeIsCookieEnabled, wkeWebView webView, "") \
ITERATOR2(void, wkeSetCookieJarPath, wkeWebView webView, const WCHAR* path, "") \
ITERATOR2(void, wkeSetCookieJarFullPath, wkeWebView webView, const WCHAR* path, "") \
ITERATOR2(void, wkeSetLocalStorageFullPath, wkeWebView webView, const WCHAR* path, "") \
\
ITERATOR2(void, wkeSetMediaVolume, wkeWebView webView, float volume, "") \
ITERATOR1(float, wkeGetMediaVolume, wkeWebView webView, "") \
\
ITERATOR5(bool, wkeFireMouseEvent, wkeWebView webView, unsigned int message, int x, int y, unsigned int flags, "") \
ITERATOR4(bool, wkeFireContextMenuEvent, wkeWebView webView, int x, int y, unsigned int flags, "") \
ITERATOR5(bool, wkeFireMouseWheelEvent, wkeWebView webView, int x, int y, int delta, unsigned int flags, "") \
ITERATOR4(bool, wkeFireKeyUpEvent, wkeWebView webView, unsigned int virtualKeyCode, unsigned int flags, bool systemKey, "") \
ITERATOR4(bool, wkeFireKeyDownEvent, wkeWebView webView, unsigned int virtualKeyCode, unsigned int flags, bool systemKey, "") \
ITERATOR4(bool, wkeFireKeyPressEvent, wkeWebView webView, unsigned int charCode, unsigned int flags, bool systemKey, "") \
ITERATOR6(bool, wkeFireWindowsMessage, wkeWebView webView, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT* result, "") \
\
ITERATOR1(void, wkeSetFocus, wkeWebView webView, "") \
ITERATOR1(void, wkeKillFocus, wkeWebView webView, "") \
\
ITERATOR1(wkeRect, wkeGetCaretRect, wkeWebView webView, "") \
\
ITERATOR2(jsValue, wkeRunJS, wkeWebView webView, const utf8* script, "") \
ITERATOR2(jsValue, wkeRunJSW, wkeWebView webView, const wchar_t* script, "") \
\
ITERATOR1(jsExecState, wkeGlobalExec, wkeWebView webView, "") \
\
ITERATOR1(void, wkeSleep, wkeWebView webView, "") \
ITERATOR1(void, wkeWake, wkeWebView webView, "") \
ITERATOR1(bool, wkeIsAwake, wkeWebView webView, "") \
\
ITERATOR2(void, wkeSetZoomFactor, wkeWebView webView, float factor, "") \
ITERATOR1(float, wkeGetZoomFactor, wkeWebView webView, "") \
\
ITERATOR2(void, wkeSetEditable, wkeWebView webView, bool editable, "") \
\
ITERATOR1(const utf8*, wkeGetString, const wkeString string, "") \
ITERATOR1(const wchar_t*, wkeGetStringW, const wkeString string, "") \
\
ITERATOR3(void, wkeSetString, wkeString string, const utf8* str, size_t len, "") \
ITERATOR3(void, wkeSetStringW, wkeString string, const wchar_t* str, size_t len, "") \
\
ITERATOR2(wkeString, wkeCreateStringW, const wchar_t* str, size_t len, "") \
ITERATOR1(void, wkeDeleteString, wkeString str, "") \
\
ITERATOR0(wkeWebView, wkeGetWebViewForCurrentContext, "") \
ITERATOR3(void, wkeSetUserKeyValue, wkeWebView webView, const char* key, void* value, "") \
ITERATOR2(void*, wkeGetUserKeyValue, wkeWebView webView, const char* key, "") \
\
ITERATOR1(int, wkeGetCursorInfoType, wkeWebView webView, "") \
ITERATOR5(void, wkeSetDragFiles, wkeWebView webView, const POINT* clintPos, const POINT* screenPos, wkeString files[], int filesCount, "") \
\
ITERATOR3(void, wkeOnMouseOverUrlChanged, wkeWebView webView, wkeTitleChangedCallback callback, void* callbackParam, "") \
ITERATOR3(void, wkeOnTitleChanged, wkeWebView webView, wkeTitleChangedCallback callback, void* callbackParam, "") \
ITERATOR3(void, wkeOnURLChanged, wkeWebView webView, wkeURLChangedCallback callback, void* callbackParam, "") \
ITERATOR3(void, wkeOnURLChanged2, wkeWebView webView, wkeURLChangedCallback2 callback, void* callbackParam, "") \
ITERATOR3(void, wkeOnPaintUpdated, wkeWebView webView, wkePaintUpdatedCallback callback, void* callbackParam, "") \
ITERATOR3(void, wkeOnAlertBox, wkeWebView webView, wkeAlertBoxCallback callback, void* callbackParam, "") \
ITERATOR3(void, wkeOnConfirmBox, wkeWebView webView, wkeConfirmBoxCallback callback, void* callbackParam, "") \
ITERATOR3(void, wkeOnPromptBox, wkeWebView webView, wkePromptBoxCallback callback, void* callbackParam, "") \
ITERATOR3(void, wkeOnNavigation, wkeWebView webView, wkeNavigationCallback callback, void* param, "") \
ITERATOR3(void, wkeOnCreateView, wkeWebView webView, wkeCreateViewCallback callback, void* param, "") \
ITERATOR3(void, wkeOnDocumentReady, wkeWebView webView, wkeDocumentReadyCallback callback, void* param, "") \
ITERATOR3(void, wkeOnDocumentReady2, wkeWebView webView, wkeDocumentReady2Callback callback, void* param, "") \
ITERATOR3(void, wkeOnLoadingFinish, wkeWebView webView, wkeLoadingFinishCallback callback, void* param, "") \
ITERATOR3(void, wkeOnDownload, wkeWebView webView, wkeDownloadCallback callback, void* param, "") \
ITERATOR3(void, wkeOnConsole, wkeWebView webView, wkeConsoleCallback callback, void* param, "") \
ITERATOR3(void, wkeSetUIThreadCallback, wkeWebView webView, wkeCallUiThread callback, void* param, "") \
ITERATOR3(void, wkeOnLoadUrlBegin, wkeWebView webView, wkeLoadUrlBeginCallback callback, void* callbackParam, "") \
ITERATOR3(void, wkeOnLoadUrlEnd, wkeWebView webView, wkeLoadUrlEndCallback callback, void* callbackParam, "") \
ITERATOR3(void, wkeOnDidCreateScriptContext, wkeWebView webView, wkeDidCreateScriptContextCallback callback, void* callbackParam, "") \
ITERATOR3(void, wkeOnWillReleaseScriptContext, wkeWebView webView, wkeWillReleaseScriptContextCallback callback, void* callbackParam, "") \
ITERATOR3(void, wkeOnWindowClosing, wkeWebView webWindow, wkeWindowClosingCallback callback, void* param, "") \
ITERATOR3(void, wkeOnWindowDestroy, wkeWebView webWindow, wkeWindowDestroyCallback callback, void* param, "") \
\
ITERATOR2(void, wkeNetSetMIMEType, void* job, char *type, "") \
ITERATOR4(void, wkeNetSetHTTPHeaderField, void* job, wchar_t* key, wchar_t* value, bool response, "") \
ITERATOR2(void, wkeNetSetURL, void* job, const char *url, "") \
ITERATOR3(void, wkeNetSetData, void* job, void *buf, int len, "调用此函数后,网络层收到数据会存储在一buf内,接收数据完成后响应OnLoadUrlEnd事件.#此调用严重影响性能,慎用" \
"此函数和wkeNetSetData的区别是,wkeNetHookRequest会在接受到真正网络数据后再调用回调,并允许回调修改网络数据。"\
"而wkeNetSetData是在网络数据还没发送的时候修改") \
ITERATOR1(void, wkeNetHookRequest, void *job, "") \
ITERATOR3(void, wkeNetOnResponse, wkeWebView webView, wkeNetResponseCallback callback, void* param, "") \
ITERATOR2(void, wkeNetGetMIMEType, void* job, wkeString mime, "") \
\
ITERATOR2(bool, wkeIsMainFrame, wkeWebView webView, wkeWebFrameHandle frameId, "") \
ITERATOR2(bool, wkeIsWebRemoteFrame, wkeWebView webView, wkeWebFrameHandle frameId, "") \
ITERATOR1(wkeWebFrameHandle, wkeWebFrameGetMainFrame, wkeWebView webView, "") \
ITERATOR4(jsValue, wkeRunJsByFrame, wkeWebView webView, wkeWebFrameHandle frameId, const utf8* script, bool isInClosure, "") \
\
ITERATOR3(void, wkeWebFrameGetMainWorldScriptContext, wkeWebView webView, wkeWebFrameHandle webFrameId, v8ContextPtr contextOut, "") \
\
ITERATOR0(v8Isolate, wkeGetBlinkMainThreadIsolate, "") \
\
ITERATOR6(wkeWebView, wkeCreateWebWindow, wkeWindowType type, HWND parent, int x, int y, int width, int height, "") \
ITERATOR1(void, wkeDestroyWebWindow, wkeWebView webWindow, "") \
ITERATOR1(HWND, wkeGetWindowHandle, wkeWebView webWindow, "") \
\
ITERATOR2(void, wkeShowWindow, wkeWebView webWindow, bool show, "") \
ITERATOR2(void, wkeEnableWindow, wkeWebView webWindow, bool enable, "") \
\
ITERATOR5(void, wkeMoveWindow, wkeWebView webWindow, int x, int y, int width, int height, "") \
ITERATOR1(void, wkeMoveToCenter, wkeWebView webWindow, "") \
ITERATOR3(void, wkeResizeWindow, wkeWebView webWindow, int width, int height, "") \
\
ITERATOR2(void, wkeSetWindowTitle, wkeWebView webWindow, const utf8* title, "") \
ITERATOR2(void, wkeSetWindowTitleW, wkeWebView webWindow, const wchar_t* title, "") \
\
ITERATOR3(void, jsBindFunction, const char* name, jsNativeFunction fn, unsigned int argCount, "") \
ITERATOR2(void, jsBindGetter, const char* name, jsNativeFunction fn, "") \
ITERATOR2(void, jsBindSetter, const char* name, jsNativeFunction fn, "") \
\
ITERATOR4(void, wkeJsBindFunction, const char* name, wkeJsNativeFunction fn, void* param, unsigned int argCount, "") \
ITERATOR3(void, wkeJsBindGetter, const char* name, wkeJsNativeFunction fn, void* param, "") \
ITERATOR3(void, wkeJsBindSetter, const char* name, wkeJsNativeFunction fn, void* param, "") \
\
ITERATOR1(int, jsArgCount, jsExecState es, "") \
ITERATOR2(jsType, jsArgType, jsExecState es, int argIdx, "") \
ITERATOR2(jsValue, jsArg, jsExecState es, int argIdx, "") \
\
ITERATOR1(jsType, jsTypeOf, jsValue v, "") \
ITERATOR1(bool, jsIsNumber, jsValue v, "") \
ITERATOR1(bool, jsIsString, jsValue v, "") \
ITERATOR1(bool, jsIsBoolean, jsValue v, "") \
ITERATOR1(bool, jsIsObject, jsValue v, "") \
ITERATOR1(bool, jsIsFunction, jsValue v, "") \
ITERATOR1(bool, jsIsUndefined, jsValue v, "") \
ITERATOR1(bool, jsIsNull, jsValue v, "") \
ITERATOR1(bool, jsIsArray, jsValue v, "") \
ITERATOR1(bool, jsIsTrue, jsValue v, "") \
ITERATOR1(bool, jsIsFalse, jsValue v, "") \
\
ITERATOR2(int, jsToInt, jsExecState es, jsValue v, "") \
ITERATOR2(float, jsToFloat, jsExecState es, jsValue v, "") \
ITERATOR2(double, jsToDouble, jsExecState es, jsValue v, "") \
ITERATOR2(bool, jsToBoolean, jsExecState es, jsValue v, "") \
ITERATOR2(const utf8*, jsToTempString, jsExecState es, jsValue v, "") \
ITERATOR2(const wchar_t*, jsToTempStringW, jsExecState es, jsValue v, "") \
\
ITERATOR1(jsValue, jsInt, int n, "") \
ITERATOR1(jsValue, jsFloat, float f, "") \
ITERATOR1(jsValue, jsDouble, double d, "") \
ITERATOR1(jsValue, jsBoolean, bool b, "") \
\
ITERATOR0(jsValue, jsUndefined, "") \
ITERATOR0(jsValue, jsNull, "") \
ITERATOR0(jsValue, jsTrue, "") \
ITERATOR0(jsValue, jsFalse, "") \
\
ITERATOR2(jsValue, jsString, jsExecState es, const utf8* str, "") \
ITERATOR2(jsValue, jsStringW, jsExecState es, const wchar_t* str, "") \
ITERATOR1(jsValue, jsEmptyObject, jsExecState es, "") \
ITERATOR1(jsValue, jsEmptyArray, jsExecState es, "") \
\
ITERATOR2(jsValue, jsObject, jsExecState es, jsData* obj, "") \
ITERATOR2(jsValue, jsFunction, jsExecState es, jsData* obj, "") \
ITERATOR2(jsData*, jsGetData, jsExecState es, jsValue object, "") \
\
ITERATOR3(jsValue, jsGet, jsExecState es, jsValue object, const char* prop, "") \
ITERATOR4(void, jsSet, jsExecState es, jsValue object, const char* prop, jsValue v, "") \
\
ITERATOR3(jsValue, jsGetAt, jsExecState es, jsValue object, int index, "") \
ITERATOR4(void, jsSetAt, jsExecState es, jsValue object, int index, jsValue v, "") \
\
ITERATOR2(int, jsGetLength, jsExecState es, jsValue object, "") \
ITERATOR3(void, jsSetLength, jsExecState es, jsValue object, int length, "") \
\
ITERATOR1(jsValue, jsGlobalObject, jsExecState es, "") \
ITERATOR1(wkeWebView, jsGetWebView, jsExecState es, "") \
\
ITERATOR2(jsValue, jsEval, jsExecState es, const utf8* str, "") \
ITERATOR2(jsValue, jsEvalW, jsExecState es, const wchar_t* str, "") \
ITERATOR3(jsValue, jsEvalExW, jsExecState es, const wchar_t* str, bool isInClosure, "") \
\
ITERATOR5(jsValue, jsCall, jsExecState es, jsValue func, jsValue thisObject, jsValue* args, int argCount, "") \
ITERATOR4(jsValue, jsCallGlobal, jsExecState es, jsValue func, jsValue* args, int argCount, "") \
\
ITERATOR2(jsValue, jsGetGlobal, jsExecState es, const char* prop, "") \
ITERATOR3(void, jsSetGlobal, jsExecState es, const char* prop, jsValue v, "") \
\
ITERATOR0(void, jsGC, "")
#if ENABLE_WKE == 1
extern "C" __declspec(dllexport) void wkeInit();
extern "C" __declspec(dllexport) void wkeInitialize();
extern "C" __declspec(dllexport) void wkeInitializeEx(const wkeSettings* settings);
WKE_FOR_EACH_DEFINE_FUNCTION(WKE_DECLARE_ITERATOR0, WKE_DECLARE_ITERATOR1, WKE_DECLARE_ITERATOR2, \
WKE_DECLARE_ITERATOR3, WKE_DECLARE_ITERATOR4, WKE_DECLARE_ITERATOR5, WKE_DECLARE_ITERATOR6, WKE_DECLARE_ITERATOR11)
#else
WKE_FOR_EACH_DEFINE_FUNCTION(WKE_DEFINE_ITERATOR0, WKE_DEFINE_ITERATOR1, WKE_DEFINE_ITERATOR2, \
WKE_DEFINE_ITERATOR3, WKE_DEFINE_ITERATOR4, WKE_DEFINE_ITERATOR5, WKE_DEFINE_ITERATOR6, WKE_DEFINE_ITERATOR11)
typedef void (WKE_CALL_TYPE *FN_wkeInitializeEx)(const wkeSettings* settings);
__declspec(selectany) const wchar_t* kWkeDllPath = L"node.dll";
inline void wkeSetWkeDllPath(const wchar_t* dllPath)
{
kWkeDllPath = dllPath;
}
inline void wkeInitializeEx(const wkeSettings* settings)
{
HMODULE hMod = ::LoadLibraryW(kWkeDllPath);
FN_wkeInitializeEx wkeInitializeExFunc = (FN_wkeInitializeEx)::GetProcAddress(hMod, "wkeInitializeEx");
wkeInitializeExFunc(settings);
WKE_FOR_EACH_DEFINE_FUNCTION(WKE_GET_PTR_ITERATOR0, WKE_GET_PTR_ITERATOR1, WKE_GET_PTR_ITERATOR2, WKE_GET_PTR_ITERATOR3, \
WKE_GET_PTR_ITERATOR4, WKE_GET_PTR_ITERATOR5, WKE_GET_PTR_ITERATOR6, WKE_GET_PTR_ITERATOR11);
return;
}
inline void wkeInit()
{
wkeInitializeEx(nullptr);
return;
}
inline void wkeInitialize()
{
wkeInitializeEx(nullptr);
return;
}
#endif
#endif // WKE_DEFINE_H
@@ -0,0 +1,31 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.13
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MiniBlink", "MiniBlink\MiniBlink.csproj", "{FF9F4C6E-B7BA-498A-9F3F-49F27CE9AF1A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MiniBlinkPinvokeDemo", "..\MiniBlinkPinvokeDemo\MiniBlinkPinvokeDemo.csproj", "{0EAAE309-A967-4C07-AB24-F276E9EF56EB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FF9F4C6E-B7BA-498A-9F3F-49F27CE9AF1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FF9F4C6E-B7BA-498A-9F3F-49F27CE9AF1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FF9F4C6E-B7BA-498A-9F3F-49F27CE9AF1A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FF9F4C6E-B7BA-498A-9F3F-49F27CE9AF1A}.Release|Any CPU.Build.0 = Release|Any CPU
{0EAAE309-A967-4C07-AB24-F276E9EF56EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0EAAE309-A967-4C07-AB24-F276E9EF56EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0EAAE309-A967-4C07-AB24-F276E9EF56EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0EAAE309-A967-4C07-AB24-F276E9EF56EB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {37B73C44-7802-453B-83B2-664D0FE3C1FB}
EndGlobalSection
EndGlobal
+16
View File
@@ -0,0 +1,16 @@
# MiniBlinkPinvoke
## 本项目用C# 调用由 @龙泉寺扫地僧 开发的 MiniBlink https://github.com/weolar/miniblink49
## 感谢 @龙泉寺扫地僧 在本人开发对接 MiniBlink 中许多帮助。
## 任何人可以使用本代码用于任何地方任何场景,但本人不对因为使用本代码而带来的任何影响负责。当然,你使用本代码用到实际产品不妨发邮件告知本人,或MiniBlink作者@龙泉寺扫地僧,表达对作者的一点点尊重。
#调用
详见:https://github.com/E024/MiniBlinkPinvokeDemo
# 关于讨论
大家有问题可以加群94093808(大神云集)
# 联系本人
Email: i@cloud1024.com
QQ:370588543
## 个人精力有限,可有偿提供接口实现