473,698 Members | 2,393 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help calling an unmanged function on Windows Mobile

Hi,

I'm using VS.NET 2005 RC to create Windows Mobile apps. I'm trying to call
the following shell function which is new on Windows Mobile 5.

SNDGETSND
http://msdn.microsoft.com/library/de...ndSetSound.asp

I basically just need to be able to get the device ringer mode (e.g. On Off
Vibrate) this seems the way to do it in WM5.

I can set up the declaration (dll import, structs, pointers etc) but when I
call it I get a "Not Supported" exception. I tried setting various unmanged
directives on the structs and parameters which stops the exception but the
call doesnt have a return value and does not seem to work, but I dont really
know what I'm doing when it comes to calling unmanged code.

Could someone proide we will a basic working example for declaring and
calling this function and I should be able to work out everything else from
there. I got that frustrated that I deleted my example code..

Paul
Nov 17 '05 #1
2 2948
Hi,

I get it to kind of work but everytime I call the function, no mater what
enum value I pass it always sets the sound to on???

[DllImport("aygs hell.dll", CharSet = CharSet.Unicode )]

public static extern Int32 SndSetSound

(SND_EVENT seSoundEvent,re f SNDFILEINFO pSoundFileInfo, bool fSuppressUI);

[StructLayout(La youtKind.Sequen tial)]

public struct SNDFILEINFO

{

[MarshalAs(Unman agedType.LPTStr , SizeConst = 260)]

public string szPathName;

[MarshalAs(Unman agedType.LPTStr , SizeConst = 260)]

public string szDisplayName;

public SND_SOUNDTYPE sstType;

}
public enum SND_SOUNDTYPE

{

SND_SOUNDTYPE_O N = 0x0001,

SND_SOUNDTYPE_F ILE = 0x0002,

SND_SOUNDTYPE_V IBRATE = 0x0004,

SND_SOUNDTYPE_N ONE = 0x0008,

SND_SOUNDTYPE_L AST = SND_SOUNDTYPE_N ONE

}

public enum SND_EVENT

{

SND_EVENT_ALL,

SND_EVENT_RINGT ONELINE1,

SND_EVENT_RINGT ONELINE2,

SND_EVENT_LAST = SND_EVENT_RINGT ONELINE2

}

Paul

"Paul Sneddon" <ma**@paulsnedd on.co.uk> wrote in message
news:xm******** *******@text.ne ws.blueyonder.c o.uk...
Hi,

I'm using VS.NET 2005 RC to create Windows Mobile apps. I'm trying to
call the following shell function which is new on Windows Mobile 5.

SNDGETSND
http://msdn.microsoft.com/library/de...ndSetSound.asp

I basically just need to be able to get the device ringer mode (e.g. On
Off Vibrate) this seems the way to do it in WM5.

I can set up the declaration (dll import, structs, pointers etc) but when
I call it I get a "Not Supported" exception. I tried setting various
unmanged directives on the structs and parameters which stops the
exception but the call doesnt have a return value and does not seem to
work, but I dont really know what I'm doing when it comes to calling
unmanged code.

Could someone proide we will a basic working example for declaring and
calling this function and I should be able to work out everything else
from there. I got that frustrated that I deleted my example code..

Paul

Nov 17 '05 #2
Hi,

I think you will get a better answer in the CF
group:microsoft .public.dotnet. framework.compa ctframework
cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Paul Sneddon" <ma**@paulsnedd on.co.uk> wrote in message
news:xm******** *******@text.ne ws.blueyonder.c o.uk...
Hi,

I'm using VS.NET 2005 RC to create Windows Mobile apps. I'm trying to
call the following shell function which is new on Windows Mobile 5.

SNDGETSND
http://msdn.microsoft.com/library/de...ndSetSound.asp

I basically just need to be able to get the device ringer mode (e.g. On
Off Vibrate) this seems the way to do it in WM5.

I can set up the declaration (dll import, structs, pointers etc) but when
I call it I get a "Not Supported" exception. I tried setting various
unmanged directives on the structs and parameters which stops the
exception but the call doesnt have a return value and does not seem to
work, but I dont really know what I'm doing when it comes to calling
unmanged code.

Could someone proide we will a basic working example for declaring and
calling this function and I should be able to work out everything else
from there. I got that frustrated that I deleted my example code..

Paul

Nov 17 '05 #3

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

Similar topics

8
5473
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- Hello, I have a very simple problem but cannot seem to figure it out. I have a very simple php script that sends a test email to myself. When I debug it in PHP designer, it works with no problems, I get the test email. If
0
2216
by: Nick White [MSFT] | last post by:
Hello fellow Microsoft Windows Mobile and Embedded enthusiasts: I invite you to peruse the list below of upcoming technical chats and Webcasts offered by the Windows Mobile and Embedded Devices Group. For the full list of upcoming Windows Mobile and Embedded chats, to review archived chat sessions, or to request a reminder for a chat, visit http://msdn.microsoft.com/embedded/community/community/chats/. Also, the Windows Mobile and...
4
2658
by: VicVic | last post by:
Dear Great Experts, I have a problem and need your help! We have a Flat DLL built in C++ (CCC), and on top of it, we built another DLL built in C# (SSS), which has .Net Assembly. CCC was imported into SSS. Now we build applications using SSS as a reference, and we found some problems exist in CCC. From our applicatyion, We can Debug into SSS, but cannot go further into CCC.
3
1102
by: kilroytrout | last post by:
When trying to use some unmanged C++ libs in a VS 2005 Release Candidate Windows Forms (/clr) project, I found that any dynamic initialization in the lib's global STL objects (perhaps other C++ objects as well) create an exception at startup. Has anyone seen this or know a workaround? For example create a simple /clr C++ console app: #include "unmanaged.h"
2
5042
by: John Regan | last post by:
Hello All I am trying to find the owner of a file or folder on our network (Windows 2000 Server) using VB.Net and/or API. so I can search for Folders that don't follow our company's specified folder structure and naming conventions and then send a Net send message to those users telling them to rectify. The information I want to get is when you select the file/folder and then: Properties -> Security Tab -> Advanced Button -> Owner Tab ->...
7
2559
by: brian_harris | last post by:
I have a string object that I need to convert into an unmanged char * to be used by several unmnaged 3rd party functions. I have tried to use: (Marshal::StringToHGlobalAuto (Profname)) This would get me an IntPtr value, but I could not find the correct way to cast an IntPtr to an unmanged char *. One example I tried was: char *inifile; inifile = static_cast <char*> (Marshal::StringToHGlobalAuto (Profname)); It gave following compile...
2
1131
by: =?Utf-8?B?c2F2?= | last post by:
hi i had a navman pin 570 which was running windows mobile 3... i have a lot of contacts that i kept backed up on the sd card... the device is no longer working and the backup file which is an .abk extension cannot be opened through windows xp... My question is how do i get the backup and restore function onto windows mobile 5/6 that was pre loaded onto windows mobile 3... any help would be greatly appreciated... thank you in advance
0
941
by: =?Utf-8?B?c2F2?= | last post by:
hi i hava a navman pin 570 which was running windows mobile 3... i have a lot of contacts that i kept backed up on the sd card... the device is no longer working and the backup file which is an .abk extension cannot be opened through windows xp... My question is how do i get the backup and restore function onto windows mobile 5/6 that was pre loaded onto windows mobile 3... or how can i extract my contacts from an .abk extension any...
10
3252
by: sulekhasweety | last post by:
Hi, the following is the definition for calling convention ,which I have seen in a text book, can anyone give a more detailed explanation in terms of ANSI - C "the requirements that a programming system places on how a procedure is called and how data is passed between a calling program and procedures are called calling conventions"
0
8608
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9161
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8897
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
7732
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4370
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3050
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
2
2332
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.