Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  • Users: SJA
  • Order by date
  1. SJA

    Text box length wrong if text set at design time

    Thank you for your prompt replies. I should have seen this because the project I'm working on transmits these characters out via USB and I can see the 0x0A and 0x0D appear in the receive buffer of the device. Problem solved :)
  2. SJA

    Text box length wrong if text set at design time

    I wonder if anyone can explain this:- Create a form with a multi line text box and 2 buttons. Put the following code under the buttons:- Private Sub Cmd_Count_Click() MsgBox Len(Text1.Text) & " characters.", vbOKOnly End Sub Private Sub Cmd_Fill_Click() Dim X As Long Dim sTemp As String For...
  3. SJA

    How to calculate fast CRC16-CCITT checksum in VB

    Here is the code to calculate the CRC16-CCITT checksum which uses the x^16,x^12,x^5,x^1 polynomial. It uses a lookup table for speed. DataByte() is the byte array which the checksum is calculated for. In the example the array is loaded from a hex string in Text1.Text. The initial value is loaded...
  4. SJA

    Get the cursor style

    Oh dear, it's so embarrassing when you reply to your own question. After hours of research on MSDN etc the method is simple. Use the GetCursor () function. Microsoft say it returns a handle to the cursor. A handle which changes depending on the cursor type.
  5. SJA

    Get the cursor style

    Can anybody please tell me an API function which will return the current cursor style. I specifically want to know when the cursor changes to one of the resize identifiers:- IDC_SIZENESW IDC_SIZENS IDC_SIZENWSE IDC_SIZEWE Many thanks.
  6. SJA

    Graphical buttons loose bitmap image

    Problem solved! I've discovered that if you store the pictures (bitmaps,jpgs etc) in the same directory as the project, or more specifically in the same folder as the forms frx file then the buttons don't loose their graphics. The frx file contains the graphics information contained in the forms...
  7. SJA

    Graphical buttons loose bitmap image

    I have a frame containing an array of graghical command buttons. Each button has a small bitmap image and 3 chrs of text. When working in the IDE the buttons randomly loose their image. The image can be replaced using the buttons properties but at some future time, when the project is reloaded...
  8. SJA

    How to set your PC UART to a non standard baud rate

    I searched for ages trying to find a way to set the PC serial port to 10400 baud (the standard for IS0 9141 vehicle diagnostics) so I could monitor bus activity. It's easy but you need inpout32.dll (get this from the web). Basically what it's doing is setting the UART clock divisor manually. To...
  9. SJA

    BCD toDecimal conversion

    Paul, BDC is hex as far as the real value of the number is concerned and is limited to a max value of 0x99. If you read a PC memory address containing 2 bytes of BCD 0x34,0x12 (remember intel little endian format). The PC reads this as 0x1234 which is 4669 dec. (0x12 * 0x100) + 0x34 So to return...
  10. SJA

    BCD toDecimal conversion

    BCD is simply hexadecimal where the individual characters are limited to between 0 and 9 rather than 0 to F. So to convert from a decimal BCD number, convert it to Hex and then back to decimal i.e:- Private Sub Command1_Click() Dim Lng_Val As Long Dim Str_BCD As String Str_BCD = Hex(10032)...
  11. SJA

    Can anyone account for these extra bytes?

    elziko, Strange, I ran the code below and got no preceeding bytes. Option Explicit Dim Tmp(3) As Byte Private Sub Form_Load() Tmp(0) = 49 Tmp(1) = 50 Tmp(2) = 51 Tmp(3) = 52 Dim fnum As Long fnum = FreeFile Open App.Path & "\test.bin" For Binary As fnum Put #fnum, , Tmp Close #fnum...
  12. SJA

    Need help in data conversion...

    Elziko, There are several ways to do this :- One is to use LSET to assign the memory contents of one user defined variable into another eg .... Private Type Typ_4Byte Byte1 As Byte Byte2 As Byte Byte3 As Byte Byte4 As Byte End Type Private Type Typ_Single Byte_All As...
  13. SJA

    Access to Parallel Port under Windows 2000 using VB5 Pro

    Search the web for a dll called inpout32.zip. It gives you the dll and instructions. Good luck
  14. SJA

    Conversion of 4 bytes to single

    Snaggs and RVBasic - thanks for your help. Snaggs :- I found reference to CopyMemory in MSDN and implemented it as the following example :- Byte_Array(0) = Val("&h" & Byte1T) Byte_Array(1) = Val("&h" & Byte2T) Byte_Array(2) = Val("&h" & Byte3T) Byte_Array(3) =...
  15. SJA

    Conversion of 4 bytes to single

    I receive 4 seperate bytes from the comm port. I need to create an IEEE754 single float out of them. Presently I have 2 ways of doing this, non are very elegant. 1) Split all 4 bytes into a binary string (0s and 1s), add them together, split them up using the IEEEE 754 rules, convert them...

Part and Inventory Search

Back
Top