473,569 Members | 2,352 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

can someone convert this c# to vb.net? pocket pc voice recorder

hi

can someone possibly convert this to vb.net ?
it is c# code that lets the pocket pc access the voice recorder...

many thanks...

source: wapboy
http://www.opennetcf.org/forums/topic.asp?TOPIC_ID=62


using System;
using System.Data;
using System.Runtime. InteropServices ;

/// <summary>
/// Creates an instance of the shell voice recorder
/// </summary>
public class VoiceRecorder
{
//API Declares

[StructLayout(La youtKind.Sequen tial)]
protected unsafe struct CM_VOICE_RECORD ER
{
public int cb;
public uint dwStyle;
public int xPos, yPos;
public IntPtr hwndParent;
public int id;
public String lpszRecordFileN ame;
};

[DllImport("voic ectl.dll", CallingConventi on=CallingConve ntion.Cdecl)]
private static extern IntPtr VoiceRecorder_C reate(ref CM_VOICE_RECORD ER
voicerec);

//end api delcare

private CM_VOICE_RECORD ER voicerec;
private IntPtr handle;

public unsafe VoiceRecorder()
{
voicerec = new CM_VOICE_RECORD ER();
handle = new IntPtr();
voicerec.cb = (int)Marshal.Si zeOf(voicerec);
voicerec.lpszRe cordFileName = \\My Documents\\Voic eControl.wav;
voicerec.xPos = -1;
voicerec.yPos = -1;
}
//show the voice recorder
public void Show()
{
handle = VoiceRecorder_C reate(ref voicerec);
}
}
Nov 20 '05 #1
1 3863
On 24 Jun 2004 22:22:56 -0700, Mad Scientist Jr wrote:
hi

can someone possibly convert this to vb.net ?
it is c# code that lets the pocket pc access the voice recorder...

many thanks...

source: wapboy
http://www.opennetcf.org/forums/topic.asp?TOPIC_ID=62


using System;
using System.Data;
using System.Runtime. InteropServices ;

/// <summary>
/// Creates an instance of the shell voice recorder
/// </summary>
public class VoiceRecorder
{
//API Declares

[StructLayout(La youtKind.Sequen tial)]
protected unsafe struct CM_VOICE_RECORD ER
{
public int cb;
public uint dwStyle;
public int xPos, yPos;
public IntPtr hwndParent;
public int id;
public String lpszRecordFileN ame;
};

[DllImport("voic ectl.dll", CallingConventi on=CallingConve ntion.Cdecl)]
private static extern IntPtr VoiceRecorder_C reate(ref CM_VOICE_RECORD ER
voicerec);

//end api delcare

private CM_VOICE_RECORD ER voicerec;
private IntPtr handle;

public unsafe VoiceRecorder()
{
voicerec = new CM_VOICE_RECORD ER();
handle = new IntPtr();
voicerec.cb = (int)Marshal.Si zeOf(voicerec);
voicerec.lpszRe cordFileName = \\My Documents\\Voic eControl.wav;
voicerec.xPos = -1;
voicerec.yPos = -1;
}
//show the voice recorder
public void Show()
{
handle = VoiceRecorder_C reate(ref voicerec);
}
}


Off the top of my head... I'm not sure why the original code is using
unsafe code. There doesn't seem to be anything used that would require that
- but, I don't know much about the Pocket PC environment. If the unsafe is
required for some reason on PPC, then you have to use C#.

Imports System
Imports System.Data
Imports System.Runtime. InteropServices

Public Class VoiceRecorder
<StructLayout(L ayoutKind.Seque ntial)> _
Protected Structure CM_VOICE_RECORD ER
Public cb As Intger
Public dwStyle As Integer
Public xPos As Integer
Public yPos As Integer
Public hwndParent As IntPtr
Public id As Integer
Public lpszRecordFileN ame As String
End Structure

<DllImport("voi cectl.dll", CallingConventi on=CallingConve ntion.Cdecl)>
Private Shared Function VoiceRecorder_C reate _
(ByRef CM_VOICE_RECORD ER voicerec) As IntPtr
End Function

Private voicerec As CM_VOICE_RECORD ER
Private handle As IntPtr

Public Sub New()
With voicerec
.cb = Marshal.SizeOf( voicerec);
.lpszRecordFile Name = "\My Documents\Voice Control.wav"
.xPos = -1
.yPos = -1
End With
End Sub

Public Sub Show()
handle = VoiceRecorder_C reate(voicerec)
End Sub
End Class

HTH
--
Tom Shelton [MVP]
Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3111
by: Dfenestr8 | last post by:
Hi. I'm no coder. I'm just a working guy who likes to tinker with computers in my spare time. That's my hobby. My passion is: playing instruments. Combining the two, I've made a couple of event driven, GUI controlled progs in Python and tKinter before. I made an abc/midi player, using the timidity, and abc2midi packages. I also did a...
2
1869
by: Mad Scientist Jr | last post by:
Can someone convert this code to vb.net? it is a voice recorder for pocket pc. many thanks ! source: http://www.opennetcf.org/forums/topic.asp?TOPIC_ID=62 the code: using System;
2
2106
by: Erik | last post by:
Hi Everyone, I'm having real problems compiling some source for eVC4++. The errors I am getting are below: It all seems to be centred around winsock. If I move the afsock.h reference to before my other includes then I get lots of errors like C2011: 'fd_set' : 'struct' type redefinition warning C4005: 'FD_CLR' : macro redefinition which I...
3
21406
by: Mark Kamoski | last post by:
Hi-- What is the difference between Convert.ToString(obj) and CType(obj, String)? (Assume obj is a variable of type Object.) Please advise. Thank you.
3
506
by: Mad Scientist Jr | last post by:
hi can someone possibly convert this to vb.net ? it is c# code that lets the pocket pc access the voice recorder... many thanks... source: wapboy http://www.opennetcf.org/forums/topic.asp?TOPIC_ID=62
5
4671
by: Mad Scientist Jr | last post by:
I'm trying to record a voice memo on a Pocket PC (2000) from VB.NET (smart device application from vs.net 2003). Tom Shelton did an initial conversion to VB.NET which I am trying to run, but am getting errors I don't quite understand (I've never done anything like this before)... Any help would be appreciated in getting this to work... ...
0
1928
by: Emma Gumbdough | last post by:
Okay we have here a VB.NET version of the .net compact framework voice recorder sample that uses open net CF c# version at: http://www.opennetcf.org/forums/topic.asp?TOPIC_ID=79 THIS CODE CREATES AN INSTANCE OF A VOICE RECORDER, but now how do you get it to record, save, play back, etc?
0
1642
by: m.lahlouh | last post by:
hello i have code C# in pocket pc i try to convert code from 2003 to 2005, but i have gr8 prob. Error: "resgen.exe" exited with code -1163019603. the code from microsoft MSDN: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnppcgen/html/fieldservice_pocketpc.asp if u can try it in VS.NET2003, becoze i have not one,...
1
575
by: Fab | last post by:
Hi, What is the best (or simple!) way to make some voice recording in C# ? Thanks.
0
7703
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7618
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7926
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7678
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3644
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2116
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1226
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
944
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.