我不确定这是否更适合在不同的SE网站(超级用户?)。
我想构建并将复杂的宏驱动驱动电子表格销售到某个垂直方向。我主要关注的是垂直内部客户之间的免费/未经授权的分发。
我可以看到市场上有一些模糊不清的产品可能能够做我想做的事情,但我能找到的一些评论并不乐观。
然而,一家供应商列出免费分发可以通过以下任何一种方式规避:
是否有人知道任何指导方针/框架(任何语言),我可以构建自己的解决方案来实现这一目标,即需要许可证代码或在线激活?
如果这通常是一项艰难的尝试,是否有人推荐的商业产品?
我也在想,实现这一目标所涉及的复杂性可能会促使我构建一个小型SaaS应用程序。我走这条路是不是更好?
答案 0 :(得分:2)
在宏中创建您自己的特殊唯一许可证密钥,这些密钥不太可能在密钥生成器中生成。例如,添加您自己的前缀。如果用户在在线数据库中使用它,则可以存储。该解决方案的缺点是用户必须连接到外部互联网。
然后使用以下键锁定该模块:
要保护您的代码,请打开Excel工作簿,然后转到工具>宏> Visual Basic编辑器(Alt + F11)。现在,从VBE中转到Tools> VBAProject Properties,然后单击Protection页面选项卡,然后选中“Lock project from viewing”,然后输入您的密码并再次确认。完成此操作后,您必须保存,关闭&重新打开工作簿以使保护生效。
答案 1 :(得分:1)
我创建了一个Excel工作表,如果每月订阅付款失败,我可以远程删除访问权限。以下是如何实现这一目标:
创建HTML表格并将其上传到您的网站
在Excel文档中,转到数据选项卡并选择从Web获取 - 将表格导入名为"验证" - 确保你的表有3列。序列号位于第一列,第二列中的用户描述以及第3列顶部的错误消息。此处存储的错误消息是每个未注册的用户都会看到的消息。第一个序列号应出现在表格的单元格A2中。
在Visual Basic编辑器中将此代码粘贴到模块中 - 此代码将根据PC的硬盘序列号返回8位序列号:
Function HDSerialNumber() As String
Dim fsObj As Object
Dim drv As Object
Set fsObj = CreateObject("Scripting.FileSystemObject")
Set drv = fsObj.Drives("C")
HDSerialNumber = Left(Hex(drv.SerialNumber), 4) _
& "-" & Right(Hex(drv.SerialNumber), 4)
End Function
另外在另一个模块中,我确保已连接互联网。如果没有互联网,则表格关闭。如果你不这样做,那么如果有人从互联网断开连接,你的连续剧就不会被加载。
Option Explicit
#If VBA7 And Win64 Then
Private Declare PtrSafe Function InternetGetConnectedStateEx Lib "wininet.dll" (ByRef lpdwFlags As Long, ByVal lpszConnectionName As String, ByVal dwNameLen As Integer, ByVal dwReserved As Long) As Long
#Else
Private Declare Function InternetGetConnectedStateEx Lib "wininet.dll" (ByRef lpdwFlags As Long, ByVal lpszConnectionName As String, ByVal dwNameLen As Integer, ByVal dwReserved As Long) As Long
#End If
Function IsInternetConnected() As Boolean
Dim strConnType As String, lngReturnStatus As Long, MyScript As String
If Application.OperatingSystem Like "*Macintosh*" Then
MyScript = "repeat with i from 1 to 2" & vbNewLine
MyScript = MyScript & "try" & vbNewLine
MyScript = MyScript & "do shell script ""ping -o -t 2 www.apple.com""" & vbNewLine
MyScript = MyScript & "set mystatus to 1" & vbNewLine
MyScript = MyScript & "exit repeat" & vbNewLine
MyScript = MyScript & "on error" & vbNewLine
MyScript = MyScript & "If i = 2 Then set mystatus to 0" & vbNewLine
MyScript = MyScript & "end try" & vbNewLine
MyScript = MyScript & "end repeat" & vbNewLine
MyScript = MyScript & "return mystatus"
If MacScript(MyScript) Then IsInternetConnected = True
Else
lngReturnStatus = InternetGetConnectedStateEx(lngReturnStatus, strConnType, 254, 0)
If lngReturnStatus = 1 Then IsInternetConnected = True
End If
End Function
然后在Workbook_Open区域内粘贴:
Private Sub Workbook_Open()
If IsInternetConnected Then
Dim objFSO As Object
Dim MyFolder As String
Dim sFileName As String
Dim iFileNum As Integer
Dim sBuf As String
Dim trialstartdate As String
Dim z As String
Dim fsoFSO
Set fsoFSO = CreateObject("Scripting.FileSystemObject")
'UNCOMMENT below to SHOW the serials sheet when the workbook is opened
ActiveWorkbook.Sheets("Verify").Visible = xlSheetVisible
'UNCOMMENT below to hide the serials sheet when the workbook is opened
'ActiveWorkbook.Sheets("Verify").Visible = xlSheetVeryHidden
Refresh_Serials
z = 2
'loop here for valid hard drive serial number
Do Until IsEmpty(Worksheets("Verify").Cells(z, 1).Value)
If Worksheets("Verify").Cells(z, 1).Value = HDSerialNumber Then
'verified and let pass
GoTo SerialVerified
End If
z = z + 1
Loop
Dim custommessage As String
custommessage = Worksheets("Verify").Cells(2, 3)
MsgBox custommessage + " Your serial number is: " + HDSerialNumber
Dim wsh1, MyKey1
Set wsh1 = CreateObject("Wscript.Shell")
MyKey1 = "%{TAB}"
wsh1.SendKeys MyKey1
MsgBox "The Commission Tracker will not open without a valid serial number. It will now close. uncomment this in workbook->open to close the workbook if the serial isn't found"
Application.DisplayAlerts = False
'uncomment this to close the workbook if the serial isn't found
'ActiveWorkbook.Close
Application.DisplayAlerts = True
SerialVerified:
' does the end user agree to not use this tool for mailicous purposes?
MsgAgree = MsgBox("Your PC's serial number is " & HDSerialNumber & ". By clicking 'Yes' you agree to use our software as described in our end user agreement. - the URL to your terms here", vbYesNo, "Final Agreement")
If MsgAgree = vbNo Then
'close program
MsgBox "This program will now close since you do not agree to our end user agreement"
Application.DisplayAlerts = False
ActiveWorkbook.Close
Application.DisplayAlerts = True
Else
'continue to open the program
End If
Else
MsgBox "No Network Connection Detected - You must have an internet connection to run the commission tracker."
Application.DisplayAlerts = False
ActiveWorkbook.Close
Application.DisplayAlerts = True
End If
End Sub
应该这样做......