Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. OleCreatePictureIndirect NOT WORKING returns -2147467262

OleCreatePictureIndirect NOT WORKING returns -2147467262

Scheduled Pinned Locked Moved Visual Basic
graphicshelpcsharpcom
8 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    FeRtoll
    wrote on last edited by
    #1

    Hello my favorite forum! :) I have problem i have converted vb6 code to vb.net its a application for images... and i have problem with Image descriptor to picturebox to image to bitmap??? not shure... i have:

    Structure imgdes
    Dim ibuff As Integer
    Dim stx As Integer
    Dim sty As Integer
    Dim endx As Integer
    Dim endy As Integer
    Dim buffwidth As Integer
    Dim palette As Integer
    Dim colors As Integer
    Dim imgtype As Integer
    Dim bmh As Integer
    Dim hBitmap As Integer
    End Structure

    Structure GUID
    Dim Data1 As Integer
    Dim Data2 As Short
    Dim Data3 As Short
    'Dim Data4() As Byte
    <VBFixedArray(7)> Dim Data4() As Byte

        'UPGRADE\_TODO: "Initialize" must be called to initialize instances of this structure. Click for more: 'ms-help://MS.VSCC.v90/dv\_commoner/local/redirect.htm?keyword="B4BFF9E0-8631-45CF-910E-62AB3970F27B"'
        Public Sub InitializeMe()
            ReDim Data4(7)
        End Sub
    End Structure
    

    Public Function image_to_picturebox(ByRef srceimg As imgdes) As System.Drawing.Image
    Dim rcode As Object
    Dim retval As Integer
    Dim Pic As New PicBmp
    ' IPicture requires a reference to "Standard OLE Types."
    ' in VB6 Select: Project, References, and check OLE Automation
    Dim IPic As System.Drawing.Image
    'UPGRADE_WARNING: Arrays in structure IID_IDispatch may need to be initialized before they can be used. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="814DF224-76BD-4BB4-BFFB-EA359CB9FC48"'
    Dim IID_IDispatch As New GUID
    Dim tempimage As imgdes

        If (srceimg.hBitmap = 0) Then
            ' We have a packed dib, gotta make it a dib section-type of image
            'UPGRADE\_WARNING: Couldn't resolve default property of object rcode. Click for more: 'ms-help://MS.VSCC.v90/dv\_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            rcode = dibtoimage(srceimg.bmh, tempimage)
            'UPGRADE\_WARNING: Couldn't resolve default property of object rcode. Click for more: 'ms-help://MS.VSCC.v90/dv\_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            If rcode = NO\_ERROR Then
                ' Replace previous image
                freeimage(srceimg)
                copyimgdes(tempimage, srceimg)
            End If
        End If
    
    D 1 Reply Last reply
    0
    • F FeRtoll

      Hello my favorite forum! :) I have problem i have converted vb6 code to vb.net its a application for images... and i have problem with Image descriptor to picturebox to image to bitmap??? not shure... i have:

      Structure imgdes
      Dim ibuff As Integer
      Dim stx As Integer
      Dim sty As Integer
      Dim endx As Integer
      Dim endy As Integer
      Dim buffwidth As Integer
      Dim palette As Integer
      Dim colors As Integer
      Dim imgtype As Integer
      Dim bmh As Integer
      Dim hBitmap As Integer
      End Structure

      Structure GUID
      Dim Data1 As Integer
      Dim Data2 As Short
      Dim Data3 As Short
      'Dim Data4() As Byte
      <VBFixedArray(7)> Dim Data4() As Byte

          'UPGRADE\_TODO: "Initialize" must be called to initialize instances of this structure. Click for more: 'ms-help://MS.VSCC.v90/dv\_commoner/local/redirect.htm?keyword="B4BFF9E0-8631-45CF-910E-62AB3970F27B"'
          Public Sub InitializeMe()
              ReDim Data4(7)
          End Sub
      End Structure
      

      Public Function image_to_picturebox(ByRef srceimg As imgdes) As System.Drawing.Image
      Dim rcode As Object
      Dim retval As Integer
      Dim Pic As New PicBmp
      ' IPicture requires a reference to "Standard OLE Types."
      ' in VB6 Select: Project, References, and check OLE Automation
      Dim IPic As System.Drawing.Image
      'UPGRADE_WARNING: Arrays in structure IID_IDispatch may need to be initialized before they can be used. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="814DF224-76BD-4BB4-BFFB-EA359CB9FC48"'
      Dim IID_IDispatch As New GUID
      Dim tempimage As imgdes

          If (srceimg.hBitmap = 0) Then
              ' We have a packed dib, gotta make it a dib section-type of image
              'UPGRADE\_WARNING: Couldn't resolve default property of object rcode. Click for more: 'ms-help://MS.VSCC.v90/dv\_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
              rcode = dibtoimage(srceimg.bmh, tempimage)
              'UPGRADE\_WARNING: Couldn't resolve default property of object rcode. Click for more: 'ms-help://MS.VSCC.v90/dv\_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
              If rcode = NO\_ERROR Then
                  ' Replace previous image
                  freeimage(srceimg)
                  copyimgdes(tempimage, srceimg)
              End If
          End If
      
      D Offline
      D Offline
      DaveAuld
      wrote on last edited by
      #2

      First of all, what exactly are you trying to do? There may be much better ways to do it now with managed code, rather than trying to upgrade old VB6 codebase.

      Dave Don't forget to rate messages!
      Find Me On: Web|Facebook|Twitter|LinkedIn
      Waving? dave.m.auld[at]googlewave.com

      F 1 Reply Last reply
      0
      • D DaveAuld

        First of all, what exactly are you trying to do? There may be much better ways to do it now with managed code, rather than trying to upgrade old VB6 codebase.

        Dave Don't forget to rate messages!
        Find Me On: Web|Facebook|Twitter|LinkedIn
        Waving? dave.m.auld[at]googlewave.com

        F Offline
        F Offline
        FeRtoll
        wrote on last edited by
        #3

        hi Dave!

        daveauld wrote:

        First of all, what exactly are you trying to do?

        this is vb6 application http://rapidshare.com/files/389129825/compar.zip.html[^] and i need the compare two images in my application like i would with this application! this is the easiest way i explain... :)

        daveauld wrote:

        There may be much better ways to do it now with managed code, rather than trying to upgrade old VB6 codebase.

        i know i made mine but its to slow and i dont get good results and here i get all good with this one! Thanks

        FeRtoll Software.net ------------ E-Mail me WebPage

        D 1 Reply Last reply
        0
        • F FeRtoll

          hi Dave!

          daveauld wrote:

          First of all, what exactly are you trying to do?

          this is vb6 application http://rapidshare.com/files/389129825/compar.zip.html[^] and i need the compare two images in my application like i would with this application! this is the easiest way i explain... :)

          daveauld wrote:

          There may be much better ways to do it now with managed code, rather than trying to upgrade old VB6 codebase.

          i know i made mine but its to slow and i dont get good results and here i get all good with this one! Thanks

          FeRtoll Software.net ------------ E-Mail me WebPage

          D Offline
          D Offline
          DaveAuld
          wrote on last edited by
          #4

          sorry, but i will not download the file from the link while at work, so don't know what the applications does. in what way are you trying to compare? visually? file content? byte by byte? pixel x pixel? Maybe your version that runs slow just needs the implementation overhauled and maybe is doing things not required?

          Dave Don't forget to rate messages!
          Find Me On: Web|Facebook|Twitter|LinkedIn
          Waving? dave.m.auld[at]googlewave.com

          F 1 Reply Last reply
          0
          • D DaveAuld

            sorry, but i will not download the file from the link while at work, so don't know what the applications does. in what way are you trying to compare? visually? file content? byte by byte? pixel x pixel? Maybe your version that runs slow just needs the implementation overhauled and maybe is doing things not required?

            Dave Don't forget to rate messages!
            Find Me On: Web|Facebook|Twitter|LinkedIn
            Waving? dave.m.auld[at]googlewave.com

            F Offline
            F Offline
            FeRtoll
            wrote on last edited by
            #5

            daveauld wrote:

            sorry, but i will not download the file from the link while at work, so don't know what the applications does.

            dont worry! :P be happy...

            daveauld wrote:

            in what way are you trying to compare? visually? file content? byte by byte? pixel x pixel?

            i need visualy compare, exsample: compare of two scanned images (exsample of small busines card), one scaned image is original and other one is a little ripped off "distroyed" and i need to detect which part is different (which part is missing) and how much percent of it! hope u understand. thats the problem with my code becose i scan pixel by pixel and scanned image have manny pixels :P and gives me nothing becose every pixel is different (i also tried to give some tolerancy for pixels but didnt success) so i want to convert that vb6 code becose it works (fast, and gives me what i need) just i dont understand in that vb6 code nothing :( why is using ole, guid, dispatch, imagedescriptor!?!? i only worked with bitmap, and graphics (i am new in visualy and .net drawing) Thanks

            FeRtoll Software.net ------------ E-Mail me WebPage

            D 1 Reply Last reply
            0
            • F FeRtoll

              daveauld wrote:

              sorry, but i will not download the file from the link while at work, so don't know what the applications does.

              dont worry! :P be happy...

              daveauld wrote:

              in what way are you trying to compare? visually? file content? byte by byte? pixel x pixel?

              i need visualy compare, exsample: compare of two scanned images (exsample of small busines card), one scaned image is original and other one is a little ripped off "distroyed" and i need to detect which part is different (which part is missing) and how much percent of it! hope u understand. thats the problem with my code becose i scan pixel by pixel and scanned image have manny pixels :P and gives me nothing becose every pixel is different (i also tried to give some tolerancy for pixels but didnt success) so i want to convert that vb6 code becose it works (fast, and gives me what i need) just i dont understand in that vb6 code nothing :( why is using ole, guid, dispatch, imagedescriptor!?!? i only worked with bitmap, and graphics (i am new in visualy and .net drawing) Thanks

              FeRtoll Software.net ------------ E-Mail me WebPage

              D Offline
              D Offline
              DaveAuld
              wrote on last edited by
              #6

              I know what your on about, but do not have the experience with any imaging techniques. I was thinking out of the box, and the difference between 2 images is similiar to how motion detection works. (or one method of it). Maybe this article could help you come up with a solution. It is in C#, but should be easily done in vb.net Motion Detection Algorithms[^]

              Dave Don't forget to rate messages!
              Find Me On: Web|Facebook|Twitter|LinkedIn
              Waving? dave.m.auld[at]googlewave.com

              F 2 Replies Last reply
              0
              • D DaveAuld

                I know what your on about, but do not have the experience with any imaging techniques. I was thinking out of the box, and the difference between 2 images is similiar to how motion detection works. (or one method of it). Maybe this article could help you come up with a solution. It is in C#, but should be easily done in vb.net Motion Detection Algorithms[^]

                Dave Don't forget to rate messages!
                Find Me On: Web|Facebook|Twitter|LinkedIn
                Waving? dave.m.auld[at]googlewave.com

                F Offline
                F Offline
                FeRtoll
                wrote on last edited by
                #7

                awww nice article! will be useful for my home door unlocker face recognition software! :P but its to much i go look in this code now to complete my problem now! :( i will keep trying to make the updated vb6 code to work... will wait to see what microsoft will tell becose i sent them email with my problem! Annyway Dave thank you werry much to waisting your time on me! :P

                FeRtoll Software.net ------------ E-Mail me WebPage

                1 Reply Last reply
                0
                • D DaveAuld

                  I know what your on about, but do not have the experience with any imaging techniques. I was thinking out of the box, and the difference between 2 images is similiar to how motion detection works. (or one method of it). Maybe this article could help you come up with a solution. It is in C#, but should be easily done in vb.net Motion Detection Algorithms[^]

                  Dave Don't forget to rate messages!
                  Find Me On: Web|Facebook|Twitter|LinkedIn
                  Waving? dave.m.auld[at]googlewave.com

                  F Offline
                  F Offline
                  FeRtoll
                  wrote on last edited by
                  #8

                  or you can help me if u can update that vb6 code to vb.net i will appreciate that! :P maybe you can make it work... the file i have posted is a vb6 solution (project) from http://catenarysystems.com/howto/comparator.html[^] i wouldnt post viruses to users of this forum! :P here is what jotti says on file http://virusscan.jotti.org/en/scanresult/a261930a8f5597b4416d88d5fd5f7fa1e77e57ef[^] :) hehe! Thanks annyway

                  FeRtoll Software.net ------------ E-Mail me WebPage

                  modified on Wednesday, May 19, 2010 3:38 PM

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups