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. C / C++ / MFC
  4. Problem passing bitmap paths from C++ to .NET DLL

Problem passing bitmap paths from C++ to .NET DLL

Scheduled Pinned Locked Moved C / C++ / MFC
csharpc++graphicsdebugging
3 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.
  • M Offline
    M Offline
    mpastchenko
    wrote on last edited by
    #1

    Folks here is another one, I do all operations on bitmaps within .NET DLL project, while the DLL is being used by a C++ project(windows project to be exact). When I perform operations on bitmaps I have to pass locations of them from C++ project to .DLL. BSTR bla(L"C:\\temp\\TestDLL1.bmp_BGL.bmp"); BSTR bla1(L"C:\\temp\\TestDLL1.bmp_GDI.bmp"); HRESULT hr = myobject->Load2BitmapsfromFile(bla, bla1, 50, &m); Vb.NET DLL project is set to recieve these path locations as parameters and based on them create bitmaps and more. The problem raises when I run my C++ project and debug to realize that the strings used to pass bitmap locations to .DLL are now empty. Thus I got nothing useful from that method in DLL. Any commnets on this would be helpful. Thank you, Sincerely, Max Pastchenko

    C 1 Reply Last reply
    0
    • M mpastchenko

      Folks here is another one, I do all operations on bitmaps within .NET DLL project, while the DLL is being used by a C++ project(windows project to be exact). When I perform operations on bitmaps I have to pass locations of them from C++ project to .DLL. BSTR bla(L"C:\\temp\\TestDLL1.bmp_BGL.bmp"); BSTR bla1(L"C:\\temp\\TestDLL1.bmp_GDI.bmp"); HRESULT hr = myobject->Load2BitmapsfromFile(bla, bla1, 50, &m); Vb.NET DLL project is set to recieve these path locations as parameters and based on them create bitmaps and more. The problem raises when I run my C++ project and debug to realize that the strings used to pass bitmap locations to .DLL are now empty. Thus I got nothing useful from that method in DLL. Any commnets on this would be helpful. Thank you, Sincerely, Max Pastchenko

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      mpastchenko wrote: Vb.NET DLL project Why are you being so cruel to C++, to make it talk to VB ? :P Seriously though, what's the reason for this ? You can write GDI+ code in C++, you don't need .NET at all. mpastchenko wrote: The problem raises when I run my C++ project and debug to realize that the strings used to pass bitmap locations to .DLL are now empty. The strings are constants and they are empty ? Or are you not looking at them properly ? Can the IDE show the contents of a BSTR ? If they are constants, they simply cannot be empty, as far as I can see. Why not debug the dll and see what ends up in VB.NET ? Or just put in a log file or something. Christian Graus - Microsoft MVP - C++

      M 1 Reply Last reply
      0
      • C Christian Graus

        mpastchenko wrote: Vb.NET DLL project Why are you being so cruel to C++, to make it talk to VB ? :P Seriously though, what's the reason for this ? You can write GDI+ code in C++, you don't need .NET at all. mpastchenko wrote: The problem raises when I run my C++ project and debug to realize that the strings used to pass bitmap locations to .DLL are now empty. The strings are constants and they are empty ? Or are you not looking at them properly ? Can the IDE show the contents of a BSTR ? If they are constants, they simply cannot be empty, as far as I can see. Why not debug the dll and see what ends up in VB.NET ? Or just put in a log file or something. Christian Graus - Microsoft MVP - C++

        M Offline
        M Offline
        mpastchenko
        wrote on last edited by
        #3

        In instead of having next programmer, work with GDI+ and put that constraint on him (this is a only a part of the project that will be used by someone else), I would rather contain all GDI+ in .NET thats why I am using paths (strings). So its easier for someone else, especially if not familiar with GDI+ directly to just say: LoadANDCompareMaps(bstingpath1, bstringpath2, etc) The solution to my priblem is quite simple: I was declaring my binary strings incorrectly correct syntax: BSTR bla = SysAllocString(L"C:\\temp\\TestDLL3.bmp_BGL.bmp"); Thank you Sincerely, Max Pastchenko P.S. I debugged on VB side with C++ executable and thats how I found that they were empty. And as far as i see C++ is talking to a .NET DLL which is created by VB.NET

        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