blenett
asked on
Saving application Variable
Hello everyone. I have an interesting application request here.
Case:
Some places a product order in a shopping cart of a file.
At the end of the check out process they download a EXE file that is a "download manager" and then they proceed to download the file. They can move this EXE to any other computer, and it will know what file to download.
I have the application....but how do you store/hold the customer ID in the application when it is distributed. I have seen this at BuyMusic.com. You buy a song, download the app at the checkout...and the app knows who you are and can download at other locations by just moving the app.
If I can just store the customer id in the app, that is all i would need.
Hope you can help!!!
Case:
Some places a product order in a shopping cart of a file.
At the end of the check out process they download a EXE file that is a "download manager" and then they proceed to download the file. They can move this EXE to any other computer, and it will know what file to download.
I have the application....but how do you store/hold the customer ID in the application when it is distributed. I have seen this at BuyMusic.com. You buy a song, download the app at the checkout...and the app knows who you are and can download at other locations by just moving the app.
If I can just store the customer id in the app, that is all i would need.
Hope you can help!!!
You can store the customer ID somewhere in the Windows Registry or Windows directory
Use SaveSetting and GetSetting to store and retreive values from the VBA key in the registry:
Description:
SaveSetting appname, section, key, setting
appname String expression containing the name of the application orproject to which the setting applies.
section String expression containing the name of the section where the key setting is being saved.
key String expression containing the name of the key setting being saved.
setting Expression containing the value that key is being set to.
GetSetting(appname, section, key[, default])
Same as above except default is used for when the key is not in the registry.
This Code example should explain it all. Add 2 command buttons, paste the following and run:
Private Sub Command1_Click()
msg = InputBox("Enter the cust id to store")
SaveSetting "TestApp", "TestSection", "CustID", msg
End Sub
Private Sub Command2_Click()
MsgBox GetSetting("TestApp", "TestSection", "CustID", "No Key Found")
Command1.Enabled = True
End Sub
Private Sub Form_Load()
Command1.Caption = "Save Value"
Command2.Caption = "Get Value"
Command1.Enabled = False
End Sub
Description:
SaveSetting appname, section, key, setting
appname String expression containing the name of the application orproject to which the setting applies.
section String expression containing the name of the section where the key setting is being saved.
key String expression containing the name of the key setting being saved.
setting Expression containing the value that key is being set to.
GetSetting(appname, section, key[, default])
Same as above except default is used for when the key is not in the registry.
This Code example should explain it all. Add 2 command buttons, paste the following and run:
Private Sub Command1_Click()
msg = InputBox("Enter the cust id to store")
SaveSetting "TestApp", "TestSection", "CustID", msg
End Sub
Private Sub Command2_Click()
MsgBox GetSetting("TestApp", "TestSection", "CustID", "No Key Found")
Command1.Enabled = True
End Sub
Private Sub Form_Load()
Command1.Caption = "Save Value"
Command2.Caption = "Get Value"
Command1.Enabled = False
End Sub
blenett,
I thinks it a difficult task to save data on a exe, unless you re-compile your application for every company that will use it, which is improper. Probably there is a login screen that must be filled up by the user that will identify them. Another probable way is to create a exe file from winzip which contains thet exe file and a file which contains identifier for the user during run time of your application.
For the Music software. Normally you are required to registered to run this application. All the data will be either be save on registry or file for your idetity.
I thinks it a difficult task to save data on a exe, unless you re-compile your application for every company that will use it, which is improper. Probably there is a login screen that must be filled up by the user that will identify them. Another probable way is to create a exe file from winzip which contains thet exe file and a file which contains identifier for the user during run time of your application.
For the Music software. Normally you are required to registered to run this application. All the data will be either be save on registry or file for your idetity.
ASKER
Hello Omnicast,
Definately agree it is hard.....as far as the music sofware.....there is no login/registration on the app...and you can move the app anywhere...so registry is not involved.
I am thinking if they compile the app during the order process with customer id/order id
maybe with .NET command line compile??
Tricky
Definately agree it is hard.....as far as the music sofware.....there is no login/registration on the app...and you can move the app anywhere...so registry is not involved.
I am thinking if they compile the app during the order process with customer id/order id
maybe with .NET command line compile??
Tricky
let the program talk to a database, and let the user remember some kind of serial number.
that way only 1 exe is needed
that way only 1 exe is needed
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi blenett,
I have seen a way to write in the exe file. It was posted also here at the expert exchange. But the problem is more about software piracy. Check this post it might help you to understand more about writing data to exe file and reading it.
https://www.experts-exchange.com/questions/21218575/Protecting-the-application-from-Piracy.html
I hope this might help you with your problem.
Thanks
I have seen a way to write in the exe file. It was posted also here at the expert exchange. But the problem is more about software piracy. Check this post it might help you to understand more about writing data to exe file and reading it.
https://www.experts-exchange.com/questions/21218575/Protecting-the-application-from-Piracy.html
I hope this might help you with your problem.
Thanks
ASKER
I will look into that example tonight.
ASKER
Hey Guys I should be testing this this week.
The app to write to the exe....do you reccomend doing it in .ASP page or to write a tiny app and call it in .ASP page via shell.
also iHadi, let me know if you have the write portion of your read example.
The app to write to the exe....do you reccomend doing it in .ASP page or to write a tiny app and call it in .ASP page via shell.
also iHadi, let me know if you have the write portion of your read example.
Hi Blenett,
Here's the 'write portion' that you asked for and I hope it will help
'========================= ========== ========== ==
Private Sub PutCustomerID()
Dim myPath As String
Dim iData As String * 10
Dim DataToWrite As String * 6
DataToWrite = "test12"
' Open the Exe for binary access
myPath = YourExePath
Open myPath For Binary As #1
' Read the Last 10 bytes
Get #1, LOF(1) - 9, iData
' Check if they are our information
If Left(iData, 4) = "~MD~" Then
' Write the data only
Put #1, LOF(1) - 5, DataToWrite
Else
' Write the data with our verifing string
Put #1, LOF(1), "~MD~" & DataToWrite
End If
Close #1
End Sub
'========================= ========== ========== =
Here's the 'write portion' that you asked for and I hope it will help
'=========================
Private Sub PutCustomerID()
Dim myPath As String
Dim iData As String * 10
Dim DataToWrite As String * 6
DataToWrite = "test12"
' Open the Exe for binary access
myPath = YourExePath
Open myPath For Binary As #1
' Read the Last 10 bytes
Get #1, LOF(1) - 9, iData
' Check if they are our information
If Left(iData, 4) = "~MD~" Then
' Write the data only
Put #1, LOF(1) - 5, DataToWrite
Else
' Write the data with our verifing string
Put #1, LOF(1), "~MD~" & DataToWrite
End If
Close #1
End Sub
'=========================