473,395 Members | 1,530 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,395 software developers and data experts.

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(LayoutKind.Sequential)]
protected unsafe struct CM_VOICE_RECORDER
{
public int cb;
public uint dwStyle;
public int xPos, yPos;
public IntPtr hwndParent;
public int id;
public String lpszRecordFileName;
};

[DllImport("voicectl.dll", CallingConvention=CallingConvention.Cdecl)]
private static extern IntPtr VoiceRecorder_Create(ref CM_VOICE_RECORDER
voicerec);

//end api delcare

private CM_VOICE_RECORDER voicerec;
private IntPtr handle;

public unsafe VoiceRecorder()
{
voicerec = new CM_VOICE_RECORDER();
handle = new IntPtr();
voicerec.cb = (int)Marshal.SizeOf(voicerec);
voicerec.lpszRecordFileName = \\My Documents\\VoiceControl.wav;
voicerec.xPos = -1;
voicerec.yPos = -1;
}
//show the voice recorder
public void Show()
{
handle = VoiceRecorder_Create(ref voicerec);
}
}
Nov 20 '05 #1
1 3856
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(LayoutKind.Sequential)]
protected unsafe struct CM_VOICE_RECORDER
{
public int cb;
public uint dwStyle;
public int xPos, yPos;
public IntPtr hwndParent;
public int id;
public String lpszRecordFileName;
};

[DllImport("voicectl.dll", CallingConvention=CallingConvention.Cdecl)]
private static extern IntPtr VoiceRecorder_Create(ref CM_VOICE_RECORDER
voicerec);

//end api delcare

private CM_VOICE_RECORDER voicerec;
private IntPtr handle;

public unsafe VoiceRecorder()
{
voicerec = new CM_VOICE_RECORDER();
handle = new IntPtr();
voicerec.cb = (int)Marshal.SizeOf(voicerec);
voicerec.lpszRecordFileName = \\My Documents\\VoiceControl.wav;
voicerec.xPos = -1;
voicerec.yPos = -1;
}
//show the voice recorder
public void Show()
{
handle = VoiceRecorder_Create(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(LayoutKind.Sequential)> _
Protected Structure CM_VOICE_RECORDER
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 lpszRecordFileName As String
End Structure

<DllImport("voicectl.dll", CallingConvention=CallingConvention.Cdecl)>
Private Shared Function VoiceRecorder_Create _
(ByRef CM_VOICE_RECORDER voicerec) As IntPtr
End Function

Private voicerec As CM_VOICE_RECORDER
Private handle As IntPtr

Public Sub New()
With voicerec
.cb = Marshal.SizeOf(voicerec);
.lpszRecordFileName = "\My Documents\VoiceControl.wav"
.xPos = -1
.yPos = -1
End With
End Sub

Public Sub Show()
handle = VoiceRecorder_Create(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
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...
2
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
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...
3
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
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...
5
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...
0
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...
0
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:...
1
by: Fab | last post by:
Hi, What is the best (or simple!) way to make some voice recording in C# ? Thanks.
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.