[Webinar] Learn how to a build a cloud-first strategyRegister Now


How do I associate/pair an Affiliate ID with a vb6 program for 100 affiliates without having to compile their code in each copy of the application?

Posted on 2007-08-08
Medium Priority
Last Modified: 2013-11-29
I have a vb6 application.  I package it with Wise Installer, v 8.0

I want to give the program to affiliates and let them give it away to their lists, and when someone on their list buys it, the affiliate gets credit for the sale.

Each affiliate will have signed up for their own affiliate ID.

I am trying to do this in a hands off fashion.  
Question by:greg_white
  • 2
LVL 31

Expert Comment

ID: 19673256
I have a suggestion for you. It's a little cludgy but I think it's graceful in its own way too.

EXE files have a header with version, copyright and description information. You can see it if you right click->properties on an EXE file in explorer and look at the Version tab.

Similarely, you can set this information in VB in your project properties, in the "Make" tab.

In your visual basic project properties, under the Make tab, change the "Comments" section to be
    AFFILIATE:0000000000     <-- with ten zeros

Then you compile your EXE. In a Hex Editor at the bottom of the EXE file will be some unicode with that string. It'll look something like


Where the . is a null char (ascii 00).

So, here's what you do, now you put this EXE on your web server. Provide your affilliate with a link that says soemthing like "Download your branded copy of the software". When they click it, the it links to a PHP page that opens the EXE for binary editing, and seeks until it finds that ".A.F.F.I... etc." string. It replaces the . with whatever is their affilliate ID. Remember to keep the length the same! For example, if the user's affilliate ID is 1634, replace it with:


Then the php script echos out the new exe to the user. Essentially it is a PHP downloader script that alters the exe before sending it out.

So the affilliate gets an EXE file and if they look at the version info in explorer, they'll see that Affilliate string with their personal affilliate ID in it.

On the VB side, you can get at this string using

So when your VB application is registered, and it talks to the server, just remember to parse the affilliate ID out of App.Comments and pass that along with it. Your server can then go ahead and give the affilliate credit for the sale.

This way you don't have to recompile the EXE for each specific affilliate, and the data isn't stored somewhere easily editable like the registry, or an INI file.

However, keep in mind that anyone CAN just open the EXE file in a hex editor and change it just like your PHP script did. I would suggest you could instead store an md5 hash of the affilliate ID in the string, instead of storing it raw, this would make it more difficult for someone to edit it and mark it with different affilliate ID.

Author Comment

ID: 19673383
Do you know if the AFFILIATE:0000000000 would remail the same inside the WISE setup packaged?  
LVL 31

Accepted Solution

Frosty555 earned 2000 total points
ID: 19684338
I suppose it depends on if the WISE package is compressed or not. I know some packages are just zip files, and inside is a file like myapp.ex_, which is uncompressed and unencrypted, the file is just renamed accordingly. Other packages use CAB files and then you'll have more difficulty getting at it.

If it is just a regular zip file, there are some php functions that let you manipulate files in zip files.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
Starting up a Project
Loops Section Overview

865 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question