Also ich möchte 2 Scripte zusammen in einem Script verwenden.
In diesen Script möchte ich alle Funktionen rein haben:
Spoiler anzeigen
#include <register.au3>
$masterkey = 12345
Local $register = False
If FileExists('reg.ini') Then
$registerName = IniRead('reg.ini','Auth','Name','')
$registerKey = IniRead('reg.ini','Auth','Key','')
$register = _generateKey($registerName,$registerKey)
EndIf
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
$frmMain = GUICreate("Das super Programm", 493, 165)
$tabMain = GUICtrlCreateTab(0, 0, 489, 161)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$tsProgramm = GUICtrlCreateTabItem("Programm")
$cmdClickMe = GUICtrlCreateButton("Dieser Knopf wird sie zur Vollversion führen", 8, 48, 473, 80, $WS_GROUP)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$tsRegister = GUICtrlCreateTabItem("Registrieren")
$lblRegName = GUICtrlCreateLabel("Name:", 24, 32, 35, 17)
$lblRegKey = GUICtrlCreateLabel("Schlüssel:", 24, 56, 52, 17)
$txtRegKey = GUICtrlCreateInput("", 80, 56, 385, 21)
$txtRegName = GUICtrlCreateInput("", 80, 32, 385, 21)
$cmdUnlock = GUICtrlCreateButton("Freischalten", 168, 88, 177, 25, $WS_GROUP)
$tsKeygenerator = GUICtrlCreateTabItem("Keygenerator")
$lblMasterKey = GUICtrlCreateLabel("Master Key:", 8, 40, 60, 17)
$lblName = GUICtrlCreateLabel("Name:", 8, 65, 35, 17)
$lblSchluessel = GUICtrlCreateLabel("Schlüssel:", 8, 90, 52, 17)
$txtMasterKey = GUICtrlCreateInput("12345", 72, 40, 385, 21)
$txtName = GUICtrlCreateInput("", 72, 65, 385, 21)
$txtSchluessel = GUICtrlCreateInput("", 72, 90, 385, 21)
$cmdCopy = GUICtrlCreateButton("Kopiere Schlüssel in die Zwischenablage", 72, 120, 385, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
_registerDemo()
If FileExists('reg.ini') Then GUICtrlSetData($txtRegName,IniRead('reg.ini','Auth','Name',''))
If FileExists('reg.ini') Then GUICtrlSetData($txtRegKey,IniRead('reg.ini','Auth','Key',''))
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $cmdClickMe
MsgBox(64,'INFO','Brav so soll es sein ;-)')
Case $cmdUnlock
_registerDemoKey($txtRegName,$txtRegKey)
EndSwitch
WEnd
Func _registerDemo()
If $register then Return
GUICtrlSetState($cmdClickMe, $GUI_DISABLE)
EndFunc
Func _registerDemoKey($controlName,$controlKey)
$strregisterName = GUICtrlRead($controlName)
$strregisterKey = GUICtrlRead($controlKey)
_createKeyIni($strregisterName,$strregisterKey)
MsgBox(64,'Hinweis','Das Programm muss neu gestartet werden, um die Eingabe zu prüfen.')
Exit
EndFunc
Und diesen hier möchte ich da rein haben:
Spoiler anzeigen
OnAutoItExitRegister("_Exit")
FileInstall('C:\Dokumente und Einstellungen\Administrator\Desktop\MD5Hash.dll',@TempDir & "\MD5Hash.dll",1)
#compiler_plugin_funcs = MD5Hash
$MD5Plugin = PluginOpen(@TempDir & '\MD5Hash.dll')
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
$frmMain = GUICreate("Das super Programm", 493, 165)
$tabMain = GUICtrlCreateTab(0, 0, 489, 161)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$tsProgramm = GUICtrlCreateTabItem("Programm")
$cmdClickMe = GUICtrlCreateButton("Dieser Knopf wird sie zur Vollversion führen", 8, 48, 473, 80, $WS_GROUP)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$tsRegister = GUICtrlCreateTabItem("Registrieren")
$lblRegName = GUICtrlCreateLabel("Name:", 24, 32, 35, 17)
$lblRegKey = GUICtrlCreateLabel("Schlüssel:", 24, 56, 52, 17)
$txtRegKey = GUICtrlCreateInput("", 80, 56, 385, 21)
$txtRegName = GUICtrlCreateInput("", 80, 32, 385, 21)
$cmdUnlock = GUICtrlCreateButton("Freischalten", 168, 88, 177, 25, $WS_GROUP)
$tsKeygenerator = GUICtrlCreateTabItem("Keygenerator")
$lblMasterKey = GUICtrlCreateLabel("Master Key:", 8, 40, 60, 17)
$lblName = GUICtrlCreateLabel("Name:", 8, 65, 35, 17)
$lblSchluessel = GUICtrlCreateLabel("Schlüssel:", 8, 90, 52, 17)
$txtMasterKey = GUICtrlCreateInput("12345", 72, 40, 385, 21)
$txtName = GUICtrlCreateInput("", 72, 65, 385, 21)
$txtSchluessel = GUICtrlCreateInput("", 72, 90, 385, 21)
$cmdCopy = GUICtrlCreateButton("Kopiere Schlüssel in die Zwischenablage", 72, 120, 385, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $txtName
If StringLen(GUICtrlRead($txtName)) > 0 Then _generateKey()
Case $txtMasterKey
If StringLen(GUICtrlRead($txtName)) > 0 Then _generateKey()
Case $cmdCopy
ClipPut(GUICtrlRead($txtSchluessel))
EndSwitch
WEnd
Func _generateKey()
$str = GUICtrlRead($txtName)
$masterKey = GUICtrlRead($txtMasterKey)
$key = ''
For $i = 1 To StringLen($str)
$tmp = Asc(StringMid($str,$i,1))
$tmp = Number($tmp) * $masterKey
$key &= String($tmp)
Next
GUICtrlSetData($txtSchluessel, MD5Hash($key,2,True) )
EndFunc
Func _Exit()
PluginClose($MD5Plugin)
EndFunc
Hier ist die dazu benötigte au3 Datei:
Spoiler anzeigen
OnAutoItExitRegister("_Exit")
; WICHTIG, beim Erzugen, den Pfad im ersten Parameter vollständig angeben.
FileInstall('C:\Dokumente und Einstellungen\Administrator\Desktop\MD5Hash.dll',@TempDir & "\MD5Hash.dll",1)
; Erzeuge die MD5Hash Funktionen
#compiler_plugin_funcs = MD5Hash
; Lade die DLL
$MD5Plugin = PluginOpen(@TempDir & '\MD5Hash.dll')
; Globaler Schluessel
Global $masterKey = 12345
Func _generateKey($str,$userkey='0')
$key = ''
For $i = 1 To StringLen($str)
$tmp = Asc(StringMid($str,$i,1))
$tmp = Number($tmp) * $masterKey
$key &= String($tmp)
Next
Return MD5Hash($key,2,True) = $userkey
EndFunc
Func _createKeyIni($str='',$userkey='')
IniWrite('reg.ini','Auth','Name',$str)
IniWrite('reg.ini','Auth','Key',$userkey)
_generateKey($str,$userkey)
EndFunc
Func _Exit()
; Schliesse die DLL wieder
PluginClose($MD5Plugin)
EndFunc
Bekomme immer Fehlermeldungen darum frage ich hier ![]()
Danke schon mal im vorraus ![]()