VB.NET School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Page 1 of 1
  • You cannot start a new topic
  • Reply Reply

PInvoke restriction: cannot return variants. Rate Topic: -----

#1 rpradeepa  Icon User is offline

  • New D.I.C Head
  • Pip

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 24-June 08


Dream Kudos: 0

Share |

PInvoke restriction: cannot return variants.

Post icon  Posted 25 June 2008 - 12:50 AM

Hi

Im getting this type of exception in vb.net program

PInvoke restriction: cannot return variants.

how to clear this exception

Thanks in advance
Was This Post Helpful? 0
  • +
  • -


#2 no2pencil  Icon User is online

  • DIGI-TAL-HARD-CORE
  • Icon

Reputation: 816
  • View blog
  • Posts: 17,399
  • Joined: 10-May 07


Dream Kudos: 2925

Expert In: Goofing Off

Re: PInvoke restriction: cannot return variants.

Posted 25 June 2008 - 01:27 AM

Google Search Results
Was This Post Helpful? 0
  • +
  • -

#3 rpradeepa  Icon User is offline

  • New D.I.C Head
  • Pip

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 24-June 08


Dream Kudos: 0

Re: PInvoke restriction: cannot return variants.

Posted 25 June 2008 - 01:36 AM

Hi

im using a program to record the keystroke in vb.net

  KeyHook = SetWindowsHookEx(WH_KEYBOARD_LL, KeyHookDelegate, Marshal.GetHINSTANCE(System.Reflection.Assembly.GetExecutingAssembly.GetModules()(0)).ToInt32, 0)



In this line im getting the exception error

PInvoke restriction: cannot return variants.

** Edit ** :code:
Was This Post Helpful? 0
  • +
  • -

#4 born2c0de  Icon User is offline

  • printf("I'm a %XR",195936478);
  • Icon

Reputation: 137
  • View blog
  • Posts: 4,622
  • Joined: 26-November 04


Dream Kudos: 2825

Expert In: J2ME, 80x86 Assembly, C/C++, VB6, VB.NET, C#, J2SE, Win32 API, Reversing

Re: PInvoke restriction: cannot return variants.

Posted 25 June 2008 - 06:43 AM

Yes, PInvoke cannot return Variants (which is actually good).

Simply create an overloaded definition of the API function in question replacing the Any data type with the data type you need and you should be able to call the API Function.
Was This Post Helpful? 0
  • +
  • -

#5 rpradeepa  Icon User is offline

  • New D.I.C Head
  • Pip

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 24-June 08


Dream Kudos: 0

Re: PInvoke restriction: cannot return variants.

Posted 25 June 2008 - 08:41 PM

Hi

Ya I already changed the Any data type into Long .
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1
  • You cannot start a new topic
  • Reply Reply


Fast Reply

  

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users