Kaeru Gaman hat geschrieben:mk-soft hat geschrieben:Der Freischaltcode kann auch telefonisch angefordert werden. Das Programm so schreiben das erst nach der eingabe des freischaltcode erst alle funktionen verfügbar sind.
ahjo, aber das bringt doch auch nix, oder?
dann kann man doch den freischaltcode mit ner kopie weitergeben....
Kannst ja mal versuchen das Programm mit kopierten Freischaltcode (liegt in %APPDATA%\mk-soft) auf ein anderen PC laufen zu lassen
Anwendung:
Code: Alles auswählen
;- Konstanten
Enumeration ; Window ID
#Window
EndEnumeration
Enumeration ; Menu ID
#Menu
EndEnumeration
Enumeration ; MenuItem ID
#Menu_Exit
#Menu_Datei
#Menu_Lizenzcode
EndEnumeration
Enumeration ; Statusbar ID
#Statusbar
EndEnumeration
Enumeration ; Gadget ID
#List
EndEnumeration
;
; Get Hardware Fingerprint
;
#HW_PROFILE_GUIDLEN = $27
#MAX_PROFILE_LEN = $50
Structure HW_PROFILE_INFO
DockInfo.l
szHWProfileGUID.c[#HW_PROFILE_GUIDLEN]
szHwProfileName.c[#MAX_PROFILE_LEN]
EndStructure
Procedure.s HardwareFingerprint()
Protected hwp.HW_PROFILE_INFO
Protected result.s
GetCurrentHwProfile_(@hwp)
result = PeekS(@hwp\szHWProfileGUID[0])
ProcedureReturn result
EndProcedure
Procedure.s CreateQueryCode()
Protected query.s, hw_code.s
hw_code = HardwareFingerprint()
query = MD5Fingerprint(@hw_code, StringByteLength(hw_code))
ProcedureReturn query
EndProcedure
Procedure CheckCode(productcode.s)
Protected code.s, Result.s
code = "key:" + CreateQueryCode()
result = MD5Fingerprint(@code, StringByteLength(code))
If result = productcode
ProcedureReturn #True
Else
ProcedureReturn #False
EndIf
EndProcedure
; ***************************************************************************************
Global productcode.s
Procedure LoadProductCode()
Protected path.s
path = GetEnvironmentVariable("APPDATA")
If Right(path, 1) <> ""
path + ""
EndIf
path + "mk-soft"
CreateDirectory(path)
path + "example.ini"
If OpenPreferences(path) = 0
CreatePreferences(path)
EndIf
PreferenceGroup("Lizence")
productcode = ReadPreferenceString("productcode" , "")
ClosePreferences()
EndProcedure
Procedure SaveProductCode()
Protected path.s
path = GetEnvironmentVariable("APPDATA")
If Right(path, 1) <> ""
path + ""
EndIf
path + "mk-soft"
CreateDirectory(path)
path + "example.ini"
If OpenPreferences(path) = 0
CreatePreferences(path)
EndIf
PreferenceGroup("Lizence")
WritePreferenceString("productcode" , productcode)
ClosePreferences()
EndProcedure
Procedure Freischaltung()
Protected query.s, result.s
query = CreateQueryCode()
result = InputRequester("Freischaltung", "Anfragecode: " + query, productcode)
If result
If CheckCode(result)
productcode = result
MessageRequester("Info" , "Produktcode gültig - Ihre Software ist jetzt freigegeben")
SaveProductCode()
Else
MessageRequester("Fehler" , "Produktcode ungültig")
EndIf
EndIf
EndProcedure
; ***************************************************************************************
Procedure UpdateWindow()
Protected x,y,dx,dy
Protected mn,st,tb
x = 0
y = 0
mn = MenuHeight()
st = StatusBarHeight(#StatusBar)
;tb = ToolBarHeight(#ToolBar)
dx = WindowWidth(#Window)
dy = WindowHeight(#Window) - mn - st - tb
ResizeGadget(#List, x, y, dx, dy)
EndProcedure
Procedure WriteLog(Info.s)
Protected temp.s
temp = FormatDate("%YYYY.%MM.%DD %HH:%II:%SS - ", Date()) + Info
AddGadgetItem(#List, -1, temp)
If CountGadgetItems(#List) > 500
RemoveGadgetItem(#List, 0)
EndIf
EndProcedure
;- Globale Variablen
Global exit = 0
LoadProductCode()
;- Fenster
style = #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget
If OpenWindow(#Window, #PB_Ignore, #PB_Ignore, 400, 300, "Fenster", style)
; Menu
If CreateMenu(#Menu, WindowID(#Window))
MenuTitle("&Datei")
MenuItem(#Menu_Exit, "Be&enden")
MenuTitle("&Extras")
MenuItem(#Menu_Lizenzcode, "&Freischaltung")
EndIf
; Statusbar
CreateStatusBar(#Statusbar, WindowID(#Window))
; Gadgets
If CreateGadgetList(WindowID(#Window))
ListViewGadget(#List, 0,0,0,0)
EndIf
If CheckCode(productcode)
WriteLog("Anwendung freigegeben")
Else
WriteLog("Anwendung Freischaltcode anfordern!!!")
EndIf
;-- Hauptschleife
Repeat
event = WaitWindowEvent()
window = EventWindow()
menu = EventMenu()
type = EventType()
Select event
Case #PB_Event_Menu
Select menu
Case #Menu_Exit
Exit = 1
Case #Menu_Lizenzcode
Freischaltung()
EndSelect
Case #PB_Event_Gadget
Case #PB_Event_CloseWindow
Exit = 1
Case #PB_Event_Repaint
Case #PB_Event_SizeWindow
UpdateWindow()
Case #PB_Event_MoveWindow
Case #PB_Event_ActivateWindow
Case #PB_Event_SysTray
EndSelect
Until Exit
EndIf
Hotline
Code: Alles auswählen
Procedure.s CreateCode(querycode.s)
Protected Code.s, Result.s
Code = "key:" + querycode
Result = MD5Fingerprint(@Code, StringByteLength(Code))
ProcedureReturn Result
EndProcedure
querycode.s = InputRequester("Hotline", "Anfragecode:", "")
productcode.s = CreateCode(querycode)
Debug productcode
Viel spass am Code eintippen. Habe mich auch zwei mal verschrieben
Kann ma aber noch alles verbessern.
FF
