Results 1 to 9 of 9

Thread: [RESOLVED] VB6 - Unsigned data type (Can I trick?)

Threaded View

  1. #5
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: VB6 - Unsigned data type (Can I trick?)

    Hey got another idea if any of the above don't work. I am guessing that your OPC control is checking the variant type of the passed variant and if it isn't UI4 then it is ignoring it. So, how about forcing the issue with CopyMemory API...

    Code:
    Dim vData As Variant, vType As Integer
    vType = &H2000 Or 19 ' array of UI4
    vData = CVar(Vals())
    ' write to the variant structure what type of data it contains
    CopyMemory ByVal VarPtr(vData), vType, 2&
    ' now the variant thinks it is UI4; how now?
    ASyncItemValues(1) = vData
    If it works, UI2 is &H2000 Or 18
    Listing of Variant Type codes


    Edited: I see I pretty much repeated what Merri posted. Even though VB can't use the vData variant while it thinks it is UI4, your OPC should be able to. If the vData variant needs to be read by your VB app, then you'd have to change the UI4 to simply I4 which is &H2000 Or 3 for a an array of longs; then you'd be able to read the data back using VB.
    Last edited by LaVolpe; May 13th, 2009 at 03:53 PM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width