By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,065 Members | 1,598 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,065 IT Pros & Developers. It's quick & easy.

Pls help me in VB.net regarding API

P: n/a
Hi !!1

I am making on application to contl the volume similar to
sndvol32.exe . I got the some code in VB6. I am working in VB.NET so i
ma trying to convert that ocde in VB.NET
In VB6 i have these two functions in which they have used " As Any" I
know that in VB.NET this is not supported but i am not able to find
wht will i use insted of that in the declarations part.

Declare Sub CopyStructFromPtr Lib "kernel32" Alias "RtlMoveMemory"
(ByRef struct As any, ByVal ptr As Integer, ByVal cb As Integer)

'
Declare Sub CopyPtrFromStruct Lib "kernel32" Alias "RtlMoveMemory"
(ByVal ptr As Integer, ByRef struct As Any , ByVal cb As Integer)
Can anyone pls let me know wht to do in this case in case of VB.NET

Once i will make this one i iwll post the code so that everyone will
get benefit
simu
Nov 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
am****@nortelnetworks.com (simran) wrote in
news:30**************************@posting.google.c om:
Declare Sub CopyStructFromPtr Lib "kernel32" Alias "RtlMoveMemory"
(ByRef struct As any, ByVal ptr As Integer, ByVal cb As Integer)

'
Declare Sub CopyPtrFromStruct Lib "kernel32" Alias "RtlMoveMemory"
(ByVal ptr As Integer, ByRef struct As Any , ByVal cb As Integer)


If you look at the Kernel32 API, the first two parameters are just pointers
to objects.

http://msdn.microsoft.com/library/de...l=/library/en-
us/kmarch/hh/kmarch/k109_5731ba5b-a7a5-4883-87cf-543768a29a93.xml.asp

So I assume you can either pass in a pointer, structure, or object.

Do you have a specific structure to use?
Nov 21 '05 #2

P: n/a
Here's how 'As Any' is converted in general:

<MarshalAs(UnmanagedType.AsAny)> ByRef struct as Object
The MarshalAs attribute is in the System.Runtime.InteropServices namespace.

If you need help determine how to marshal data to Win32 APIs or in general
converted from VB6 to VB/C# .NET, you can take a look at these sites:
http://www.pinvoke.net/
http://www.gotdotnet.com/team/clr/bc...eHelp/FAQ.aspx

hope this helps..
Imran.
"simran" <am****@nortelnetworks.com> wrote in message
news:30**************************@posting.google.c om...
Hi !!1

I am making on application to contl the volume similar to
sndvol32.exe . I got the some code in VB6. I am working in VB.NET so i
ma trying to convert that ocde in VB.NET
In VB6 i have these two functions in which they have used " As Any" I
know that in VB.NET this is not supported but i am not able to find
wht will i use insted of that in the declarations part.

Declare Sub CopyStructFromPtr Lib "kernel32" Alias "RtlMoveMemory"
(ByRef struct As any, ByVal ptr As Integer, ByVal cb As Integer)

'
Declare Sub CopyPtrFromStruct Lib "kernel32" Alias "RtlMoveMemory"
(ByVal ptr As Integer, ByRef struct As Any , ByVal cb As Integer)
Can anyone pls let me know wht to do in this case in case of VB.NET

Once i will make this one i iwll post the code so that everyone will
get benefit
simu

Nov 21 '05 #3

P: n/a
Hi,

Take a look at the marshal.ptrtostructure and marshal.structuretoptr
methods.

http://msdn.microsoft.com/library/de...cturetopic.asp

http://msdn.microsoft.com/library/de...toptrtopic.asp

Ken
---------------------
"simran" <am****@nortelnetworks.com> wrote in message
news:30**************************@posting.google.c om...
Hi !!1

I am making on application to contl the volume similar to
sndvol32.exe . I got the some code in VB6. I am working in VB.NET so i
ma trying to convert that ocde in VB.NET
In VB6 i have these two functions in which they have used " As Any" I
know that in VB.NET this is not supported but i am not able to find
wht will i use insted of that in the declarations part.

Declare Sub CopyStructFromPtr Lib "kernel32" Alias "RtlMoveMemory"
(ByRef struct As any, ByVal ptr As Integer, ByVal cb As Integer)

'
Declare Sub CopyPtrFromStruct Lib "kernel32" Alias "RtlMoveMemory"
(ByVal ptr As Integer, ByRef struct As Any , ByVal cb As Integer)
Can anyone pls let me know wht to do in this case in case of VB.NET

Once i will make this one i iwll post the code so that everyone will
get benefit
simu
Nov 21 '05 #4

P: n/a
ken!!1
Hi!!1
thnaks for that...
but still my problme is not yet solved.
although i have seen the sites which u have told but still i ma not
able to get.........
I am gone mad by going through all ten suff and trying alot but still
nothing seems to come
out............................................... ..

wht will i do ...
????

Can anyone tell me how is there any other api with whoich i can make
that application

simu

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message news:<uU**************@TK2MSFTNGP11.phx.gbl>...
Hi,

Take a look at the marshal.ptrtostructure and marshal.structuretoptr
methods.

http://msdn.microsoft.com/library/de...cturetopic.asp

http://msdn.microsoft.com/library/de...toptrtopic.asp

Ken
---------------------
"simran" <am****@nortelnetworks.com> wrote in message
news:30**************************@posting.google.c om...
Hi !!1

I am making on application to contl the volume similar to
sndvol32.exe . I got the some code in VB6. I am working in VB.NET so i
ma trying to convert that ocde in VB.NET
In VB6 i have these two functions in which they have used " As Any" I
know that in VB.NET this is not supported but i am not able to find
wht will i use insted of that in the declarations part.

Declare Sub CopyStructFromPtr Lib "kernel32" Alias "RtlMoveMemory"
(ByRef struct As any, ByVal ptr As Integer, ByVal cb As Integer)

'
Declare Sub CopyPtrFromStruct Lib "kernel32" Alias "RtlMoveMemory"
(ByVal ptr As Integer, ByRef struct As Any , ByVal cb As Integer)
Can anyone pls let me know wht to do in this case in case of VB.NET

Once i will make this one i iwll post the code so that everyone will
get benefit
simu

Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.