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. Managed C++/CLI
  4. Can not marshal parameter #4: The type definition of this type has no layout information.

Can not marshal parameter #4: The type definition of this type has no layout information.

Scheduled Pinned Locked Moved Managed C++/CLI
helpsysadminjsonlearning
2 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.
  • A Offline
    A Offline
    AnsGe
    wrote on last edited by
    #1

    Hai In my applcation i want to list all machines in the network. So i used the WNetOpenEnum API . My code looks like, [DllImport("Mpr.dll", EntryPoint="WNetOpenEnumA", CallingConvention=CallingConvention::Winapi)] static ErrorCodes WNetOpenEnum(ResourceScope dwScope, ResourceType dwType, ResourceUsage dwUsage, NETRESOURCE* p, IntPtr &lphEnum); NETRESOURCE* pRsrc = new NETRESOURCE(); //A managed class IntPtr handle = IntPtr::Zero; result = WNetOpenEnum(RESOURCE_GLOBALNET, RESOURCETYPE_DISK, RESOURCEUSAGE_ALL, pRsrc, handle); But when i run the application got an error " Can not marshal parameter #4: The type definition of this type has no layout information. " Whats is the problem. Plz help

    H 1 Reply Last reply
    0
    • A AnsGe

      Hai In my applcation i want to list all machines in the network. So i used the WNetOpenEnum API . My code looks like, [DllImport("Mpr.dll", EntryPoint="WNetOpenEnumA", CallingConvention=CallingConvention::Winapi)] static ErrorCodes WNetOpenEnum(ResourceScope dwScope, ResourceType dwType, ResourceUsage dwUsage, NETRESOURCE* p, IntPtr &lphEnum); NETRESOURCE* pRsrc = new NETRESOURCE(); //A managed class IntPtr handle = IntPtr::Zero; result = WNetOpenEnum(RESOURCE_GLOBALNET, RESOURCETYPE_DISK, RESOURCEUSAGE_ALL, pRsrc, handle); But when i run the application got an error " Can not marshal parameter #4: The type definition of this type has no layout information. " Whats is the problem. Plz help

      H Offline
      H Offline
      HumanOsc
      wrote on last edited by
      #2

      Hello... I believe you forget to define the StructLayoutAttribute for the paramater NETRESOURCE* p... In general it'S Sequential...:)

      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