[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

ADDING A CHECKSUM TO A VB6 ACTIVEX MODULE AND CHECK AT PROGRAM START IF STILL VALID CHECKSUM

Posted on 2008-06-19
6
Medium Priority
?
600 Views
Last Modified: 2008-06-22
I use a activex module to control the comport connected to a scale and a scanner.
By Dutch law it must be impossible for a user to change the activex module in any way, so that after the tested it, they can control later on
if the software version is different then the one they tested.
How to add a checksum to the Activex and then when starting the program wich uses it,  check for valid checksum, so I can abort if changed
0
Comment
Question by:BIAPRO
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 10

Expert Comment

by:peetm
ID: 21823321
MapFileAndCheckSum is what I always use:

http://msdn.microsoft.com/en-us/library/ms680355(VS.85).aspx

0
 

Author Comment

by:BIAPRO
ID: 21823386
I took a look at this link, I believe it will do what I need, but far above my level of understandimg without some source code sample how to use this while/after compiling the ocx file, and when starting my vb program how to check if still ok.
But thanks for time anyway
0
 
LVL 10

Accepted Solution

by:
peetm earned 1500 total points
ID: 21823499
Here's a cut 'n paste from one of my projects.

Public Declare Function MapFileAndCheckSum Lib "imagehlp.dll" Alias "MapFileAndCheckSumA" (ByVal fileName As String, ByRef HeaderSum As Long, ByRef CheckSum As Long) As Long


' ================================================
' Uses imghelp.dll to calculate a file's checksum.
'
' This routine could be used to verify that files have been copied/moved ok.
'
Public Function CheckSumOfFile(ByRef fileName As String) As Long

    Dim CalcedCheckSum As Long
    Dim HeaderCheckSum As Long

    ' MapFileAndCheckSum returns this f it worked.  Can't see much point in testing this here though.
    '
    Const CHECKSUM_SUCCESS As Long = 0

    ' HeaderCheckSum will only be non-zero if the file being checksumed is a binary [exe, dll, ocx, ...]
    ' that contains checksum info, e.g., the stuff that dumpbin.exe would list by 'checksum' when used
    ' like this for example ... dumpbin /headers c:\windows\system32\systray.exe
   
    Call MapFileAndCheckSum(fileName, HeaderCheckSum, CalcedCheckSum)

    CheckSumOfFile = CalcedCheckSum
   
End Function
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:BIAPRO
ID: 21823602
just plain copy this to start with in a new project, i got error at start run

Constants,fixed-length strings, arrays, user-defined types and Declare statements not allowed as Public members of object modules
0
 
LVL 10

Expert Comment

by:peetm
ID: 21824186
You've put it into a Module, yes?  Not a Form, and you're using VB6?
0
 

Author Comment

by:BIAPRO
ID: 21824234
oops!,  no i did form will retry, thanks
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

656 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