473,385 Members | 2,269 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Pls help me in VB.net regarding API

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
4 2796
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Francis Lavoie | last post by:
Hello I have some questions regarding webframework, I must say that I quite lost and these questions are basicly to help me understand the way it work. I have some knowledge with PHP and JSP....
3
by: praba kar | last post by:
Dear All, I am new to Python. I am in need of some sorting functions (eg) numerical sorting functions and alphapetical sorting functions. I have searched through net But I cannot find any...
3
by: Samuel | last post by:
I wrote a very simple httpmodule and tried to compile it with no success. This is my code: ============== Imports System Imports System.Web Imports Microsoft.VisualBasic NameSpace...
7
by: Squignibbler | last post by:
Hi all, I have a question regarding the C++ programming language regarding the nature of the relationship between pointers and arrays. If the statement MyArray is functionally identical to...
8
by: Mike | last post by:
Hello, I have a few rather urgent questions that I hope someone can help with (I need to figure this out prior to a meeting tomorrow.) First, a bit of background: The company I work for is...
2
by: Dean R. Henderson | last post by:
For an ASP.NET web application, is there a way for one session (with appropriate security authorization) to set a HttpSessionState variable to point to another session and execute the Abandon...
5
by: archana | last post by:
Hi all, I am using timer to do some functionality on user specified time. I am using system.timers.timer class and its timer to do this functionality. What i am doing is i set autoreset to...
1
by: Dave | last post by:
Hi guys, i have a small question regarding register_globals I have managed to change the way my forms work so they will process with register_globals turned off. However i have one page which...
1
by: Jim Flanagan | last post by:
Hello - I am in need of more help regarding an approach to accomplishing the following: We have a need to change the Volume serial numbers of a bunch of preprogrammed IDE Solid State Drive...
8
by: somenath | last post by:
Hi All, I have a doubt regarding the pointer assignment . Please have a look at the following program . #include<stdio.h> #include<stdlib.h> #define NAMESIZE 10 #define SAFE_FREE(t) if(t)\...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.