|
If my math is right, at 250Hz, you need to fire the event every 4 milliseconds. The timers that your finding all have 1 millisecond resolution. At that low an interval, the millisecond timers are not really that accurate. They can be off by as much as a millisecond when your app receives the notification.
I think that part of the problem is the priority that your process is running under. You might want to consider running your app and then, before you start the timer test, go into the Task Manager, click on the Processes tab, right-click on your app and bump the priority up to High or RealTime to see if the interval stabilizes for you.
RageInTheMachine9532
|
|
|
|
|
Hi All
I have started writing a program to get the crc32 of a file. I have this working fairly well. The only thing now is I need to get the crc32 of a complete folder and its contents and get an overall checksum for it, but I don't seem to be able to get it to work. If anyone can give some insight to this problem it would be great. Also I cannot get to display the file size of the file i am checking.
Thanks
|
|
|
|
|
You might want to show the code your using to get a CRC on a directory and its contents.
Are you looking to get the CRC on all the filenames? Or are you trying to get a combined CRC of all the files in the directory?
RageInTheMachine9532
|
|
|
|
|
I am trying to get a combined CRC for all the files. I am using the FastCRC library to try get the code to work. So far I can get the crc of a single file I have tried to code it to check the directory but it never works so I usually start from scratch again.
|
|
|
|
|
Code samples are important so we can see what your doing!
Your going to have to get the CRC of each file, one at a time. I downloaded the FastCRC library and according to the docs your can use FCRC32_CalculateFile to get the CRC of each file. This is a little pseudocode to illustrate:
' Assuming VB.NET
Dim checksum as Integer
FCRC32_Init()
For Each Filename in Directory
FCRC32_CalculateFile( checksum, Filename )
Next
MsgBox( FCRC32_LongToHex32( checksum, True ) )
RageInTheMachine9532
|
|
|
|
|
This is the main code that I was using
Private Sub cmdCRC32_click()
Dim checksum As Long
Dim buffer As Long
If txtFileInfo.Text = "" Then
MsgBox "PLEASE SELECT A FILE", vbExclamation, "No File Selected"
End If
'Calculate the CRC32 checksum and MD5 of a file
If FCRC32_CalculateFile(checksum, txtFileInfo.Text) = 0 Then
txtInfo.Text = txtFileInfo.Text & vbCrLf & _
"CRC32= " & FCRC_LongToHex32(checksum, True) & vbCrLf & _
"MD5=" & QHASH_FileHexDigest(MD5_ALGID, txtFileInfo.Text, True)
End If
End Sub
Thanks
|
|
|
|
|
So far, it looks good, though you can drop the declaration for 'buffer'. You'll never use it...
Now all you need to is to wrap this in code that goes thru a list of filenames and your all set. You can use the Dir() function to do this:
' Assuming VB.NET
' For VB6, change Integer type to Long
Dim iCheckSum As Integer
Dim strFilename As String
FCRC32_Init()
strFilename = Dir( startingPathAsString )
Do While strFilename <> ""
FCRC32_CalculateFile( iCheckSum, Filename )
strFilename = Dir()
Loop
MsgBox( "CRC32: " & FCRC32_LongToHex32( iCheckSum, True ) )
RageInTheMachine9532
|
|
|
|
|
I'm still having huge problems using the dir function. Is there a sample of code i could get
|
|
|
|
|
You'll have to post what you have so we can see what your doing. The only code example I have is in my previous post.
RageInTheMachine9532
|
|
|
|
|
can u plz. tell me wots CRC32
rIsHaBh
|
|
|
|
|
It's a 32 bit Cyclic Redundancy Check. Its used to give a block of data a value that represent an error check. The block of data is transmitted with it's CRC value, then the receiver gets the block, performs a CRC calculation on it and compares that value with the CRC that was transmitted with the block of data. If the two don't match, there was problem with the transmission.
RageInTheMachine9532
|
|
|
|
|
CRC stands for Cyclic Redundency Check. Where I work we use it to check .iso files transfered over the network to make sure that it is the same. If anything happened to it in transfer there would be a difference. So if the CRC32 is the same then the file is the same. It can be used to check all the files on a cd also, so if any file changed in creating a cd the CRC32 checksum would be different than that of the master disc.
|
|
|
|
|
Thank u buddies!!
rIsHaBh
|
|
|
|
|
i'm srying to read a table from a sql database. i'm using a sqldataadapter, what code should i put in the page load for this to work
|
|
|
|
|
Hi CodeProject Champs
I want to deploy Crystal Report with my software. I got registered on the site www.crystaldecisions.com/net/licensing. After deployment it was giving error "Invalid Keycode". When I registered they send me a pdf named net_distribution_license.pdf file. But it does not have any keycode. How shud i proceed? From where to get the key code for crystal report.
thanks
Be Humble in Victory and Strong in Defeat. -Het
|
|
|
|
|
Hi,
I have been added a web reference. VB.NET has been created a proxy class in my project. But I need to declare prefix for an element. How can I add prefix into an element such as below by VB.NET?
I want to following form;
<RFC_GET_TRUSTED_SYSTEM_ID.Response xmlns="urn:sap-com:document:sap:rfc:functions">
To following form;
<x:RFC_GET_TRUSTED_SYSTEM_ID.Response x:xmlns="urn:sap-com:document:sap:rfc:functions">
Thank you
Orkun GEDiK
|
|
|
|
|
hi,
her problem of M-DAC is really not working out, please please please help her out.
Thanks to all for reading
Be Humble in Victory and Strong in Defeat. -Het
|
|
|
|
|
'//Connecting to sqlserver thru ADO
Dim sConnectionstring As String
Dim rst As New ADODB.Recordset 'will hold records returned
Dim com As New ADODB.Command 'will pass command to sql server
Dim cn As New ADODB.Connection 'our database connection object
sConnectionstring = "Uid=Yourusername; pwd=Yourpassword;" & _
"InitialCatalog=Yourdatabase;" & _
"Data Provider=SQLOLEDB; provider=MSDATASHAPE;" & _
"Server=Your-server-if-any;"
cCnn.ConnectionString = sVarConnectionString
cCnn.Open
With com
.ActiveConnection = cn
.CommandText = "SELECT * FROM your-table"
.CommandTimeout = 0 '//don't time-out
.CommandType = adCmdText '//exec the text
End With
rstGP.Open com '//open the recordset
'//accessing the data in rst
If Not rst.BOF And Not rst.EOF Then rst.MoveFirst
While (Not rst.EOF)
MsgBox "Field1 = " & rst!Field1 '//Field1 is a colum in the table
MsgBox "Field2 = " & rst!Field2 '//Field2 is a colum in the table
MsgBox "Field3 = " & rst!Field3
MsgBox "Fieldn = " & rst!Fieldn
rst.MoveNext
Wend
'//Creating a table..
CREATE TABLE
[ database_name.[ owner ] . | owner. ] table_name
( { < column_definition >
| column_name AS computed_column_expression
| < table_constraint > ::= [ CONSTRAINT constraint_name ] }
| [ { PRIMARY KEY | UNIQUE } [ ,...n ]
)
e.g. assume my database is called db1 - i can create table tb1 with
2 columns col1 and col2
CREATE TABLE
db1 tb1
(
col1 AS INT,
col2 AS VARCHAR(100) NOT null
)
'//xml
Don know much about xml..
1fm1fu
|
|
|
|
|
Hello,
I programmed a click event handler for a button on a worksheet. In this handler I wanted to change some cells. But when the handler changed the first cell it aborted directly after the comand.
Here's my code:
This is the event handler itself, it is calling another function that is doing the work:
Private Sub bReorgWorkTime_Click()
ReorgWorkTime bReorgWorkTime.Parent
End Sub
Public Function ReorgWorkTime(xButtonWorksheet As Worksheet)
Dim iDay As Integer
Dim xWorkTime As Variant
Dim xReorgedTime As Variant
Dim dWorkTime As Double
Dim bOldEventsEnabled As Boolean
iDay = ROW_DAY_1
bOldEventsEnabled = Application.EnableEvents
Application.EnableEvents = False
' Fill in all days without over times:
While (iDay <= ROW_DAY_31)
xWorkTime = xButtonWorksheet.Cells(iDay, COL_WORKED_TIME)
If (IsNumeric(xWorkTime) And Not IsEmpty(xWorkTime)) Then
dWorkTime = xWorkTime
xButtonWorksheet.Cells(iDay, COL_REORGED_TIME) = dWorkTime
' Aborts here
Else
xButtonWorksheet.Cells(iDay, COL_REORGED_TIME) = ""
' or here
End If
iDay = iDay + 1
Wend
Application.EnableEvents = bOldEventsEnabled
End Function
Believing the debugger the "iDay = iDay + 1" line isn't even reached!
I use Excel 2002 SP-1 German
|
|
|
|
|
How can you convert a heximal string to a "normal string"???
For example, I've got a register file which contains the following:
[HKEY_LOCAL_MACHINE\SOFTWARE\ORL\WinVNC3\Default]
"Password"=hex:88,bf,a4,48,1a,4b,4d,4d
So, I want to know how you can convert the heximal string "88,bf,a4,48,1a,4b,4d,4d" into just normal letters and numers...
And I'm using VB 6.0!!!!!
(¯`·._.·[eRiK]·._.·´¯)
|
|
|
|
|
Friend Function HexToStr(ByVal strHex As String) As String
Dim i As Integer
Dim sb As New System.Text.StringBuilder(strHex.Length \ 2)
For i = 0 To strHex.Length - 2 Step 2
sb.Append(Microsoft.VisualBasic.Chr(Convert.ToByte(strHex.Substring(i, 2), 16)))
Next
Return sb.ToString
End Function
|
|
|
|
|
Didn't see and unhex functions built in so you have to build one
Private Function unHex(ByVal hexStr As String) As Integer
Dim position As Integer = 1
Dim Result As Integer = 0
While Not position > hexStr.Length
Dim thisChar As Char = Mid(hexStr, position, 1)
Select Case UCase(thisChar)
Case "A"
Result += 10 * (16 ^ (hexStr.Length - position))
Case "B"
Result += 11 * (16 ^ (hexStr.Length - position))
Case "C"
Result += 12 * (16 ^ (hexStr.Length - position))
Case "D"
Result += 13 * (16 ^ (hexStr.Length - position))
Case "E"
Result += 14 * (16 ^ (hexStr.Length - position))
Case "F"
Result += 15 * (16 ^ (hexStr.Length - position))
Case Else
Result += Val(thisChar) * (16 ^ (hexStr.Length - position))
End Select
position += 1
End While
Return Result
End Function
This will take as input a hexstring of any length and give you a result as an integer.
ex. unHex("C17") = 3096
ex. unHex("C17BD") = 792509
Matthew Hazlett
Windows 2000/2003 MCSE
Never got an MCSD, go figure...
|
|
|
|
|
One more thing, I'm using VB 6.0, NOT .NET!!!!
And I don't only want them to be converted into numbers, nut just into a string, for example a word!!!
eRiK
|
|
|
|
|
If you trying to get that password, you'll be a little disappointed. At a glance, those numbers are way above the normal ascii characters. Your looking at an encrypted password.
RageInTheMachine9532
|
|
|
|
|
hi all,
i am a beginner with vb.net,when i tested WMI i encounter a problem
i want to shutdown my computer with wmi,but when the programme work,it just shutdown windows,my computer still work..
is anybody here know how to solute it?
thanks
I try my best!
|
|
|
|