|
hi, trying to add a .wav file to my project's resources, and play it through axWindowsMediaPlayer1.
Problem is i dont quite know how to tell the axWindowsMediaPlayer1 where the file is.
I have tried the following:
WindowsFormsApplication1.Properties.Resources.tune (tune being the wav file)
except now the player has a problem because of no file extension, and if i add an extension, it plays nothing.
WindowsFormsApplication1.Properties.Resources.tune.wav (plays nothing, you can see why)
any help would be appreciated, thanks.
|
|
|
|
|
I don't think this will work, I've only ever been able to get WMP to play files in the file system. Unless you can set up a web server and make it think it's coming from an online source.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
In the Solution Explorer you can open the directory named Resources,click tune.wav.
Change its first advanced properties,so it would copy the wav file to the the directory where your program is.
axWindowsMediaPlayer1.URL = Application.StartupPath + "\\Resources\\tune.wav";
You can have a try.
My English is just so so,wish it can help you.
|
|
|
|
|
thaks for the replies, but is there anyway i can somehow pack the wav file into the program? i would rather it not be separate. thanks.
|
|
|
|
|
See this[^] article.
/ravi
|
|
|
|
|
Hi friends,
If some one knows about any link or article on mshtml Event Object Model
Please lead me ....
Thanks
|
|
|
|
|
|
In C++ I can pass parameters by value/reference(using &).
If I create an instance of a class using the new keyword in C++, and pass the pointer pointing to it by reference (reference to pointer, e.g. MyClass &* ptr), is it the same as passing a ref type by ref in C#?
As in both cases, the callee can change the object’s state, as well as point/refer to other objects.
What do you think?
|
|
|
|
|
I think the only way to be sure is to write some test code. I suspect you are wrong, in that you can't dereference a reference in C#, I think that ref basically is worthless if it's already a ref type, it adds nothing.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Here you go:
{
string s="a";
log("s="+s);
doubleString1(s);
log("s="+s);
doubleString2(ref s);
log("s="+s);
}
private void doubleString1(string s) { s+=s; }
private void doubleString2(ref string s) { s+=s; }
outputs:
s=a
s=a
s=aa
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
I am working on a screen capture project that uses a global mouse hook. It works great.
currently when the user holds the right mouse button down for a time the cursor changes to a hand.
see below
[DllImport("user32.dll")]
static extern IntPtr LoadCursor(IntPtr hInstance, int lpCursorName);
private int IDC_HAND = 32649; /// IDC_HAND = 32649;///IDC_UPARROW=32516///IDC_CROSS=32515
private const uint OCR_NORMAL = 32512;
on event
private void setcursor()
{
IntPtr hcursor = LoadCursor(IntPtr.Zero, IDC_HAND);/// IDC_HAND/// IDC_UPARROW//IDC_CROSS
bool ret_val = SetSystemCursor(hcursor, OCR_NORMAL);
}
What I need is a LARGE CROSS
so I made these changes
DllImport("user32.dll")]
static extern IntPtr LoadCursor(IntPtr hInstance, int lpCursorName);
private int IDC_CROSS=32515; /// IDC_HAND = 32649;///IDC_UPARROW=32516///IDC_CROSS=32515
private const uint OCR_NORMAL = 32512;
private void Form1_Load(object sender, EventArgs e)
{
RegistryKey loadcursor = Registry.CurrentUser.OpenSubKey("Control Panel\\Cursors", true);
loadcursor.SetValue("Crosshair","%SYSTEMROOT%\\Cursors\\lcross.cur");
loadcursor.Close();
}
on event
private void setcursor()
{
IntPtr hcursor = LoadCursor(IntPtr.Zero, IDC_CROSS);/// IDC_HAND/// IDC_UPARROW//IDC_CROSS
bool ret_val = SetSystemCursor(hcursor, OCR_NORMAL);
}
am changing the poiter of the crosshair cursor the crude way !
dont now how to make it apply the rgistry changes. so that you dont
have re boot to make changes apply.
I would do it in the private void setcursor(),
but there is no system "large crosshair cursor".
only lcross.cur in windows/cursors.
AM I MESSED UP OR WHAT?
Thanks,
Regards.
P.S.
here is a link to the published project
it works great. Just want to put a little polish on it.
www.softsourcesolutions.com/nabit.zip
modified on Friday, September 18, 2009 10:33 PM
|
|
|
|
|
I'm searching for a nice way to get notification from Web Service. Something like this, I call a method of WS and it register me in someway. Then when some other application calls another method then it should send me any kind of notification. I got exactly what I needed in How to Get Notifications from a .NET Web Service[^]but it can be go worse in some condition. I read about Duplex[^] but its WCF. So is there any cool way of doing this...?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
I have an excel file payroll, I want to convert this file into xml file format DTD for interactive software
has anyone ever do that can help me, can provide the source code for me.
Thanks
kmt
|
|
|
|
|
|
hi
when i write a character in google search bar then it appears all or part of things that started with this character
so i want to know if it is xml technology or what
and how to use this with a c# application connecting to sql server database
thanks
Mohamed
|
|
|
|
|
Hi,
assuming a TextBox, the basic principle is to provide a handler for the TextChanged event; in there, the text is used in a search command (say a SELECT * FROM ... WHERE ... in SQL) and the results are shown in a DropDown, a ToolTip, or whatever you choose.
So basically there is one database query for each character you type into the TextBox.
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
thanks very much dude
you answered my question 
|
|
|
|
|
Hi,
I'm trying to talk to a mini-filter driver using p-invoke, but cannot make this function return successfully:
C/C++ function:
HRESULT WINAPI FilterSendMessage(
IN HANDLE hPort,
IN LPVOID lpInBuffer OPTIONAL,
IN DWORD dwInBufferSize,
IN OUT LPVOID lpOutBuffer OPTIONAL,
IN DWORD dwOutBufferSize,
OUT LPDWORD lpBytesReturned
);
C# function:
[DllImport("FltLib", CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Auto)]
public static extern int FilterSendMessage(
[In] SafeFileHandle hPort,
[In] IntPtr lpInBuffer,
[In] int dwInBufferSize,
[In, Out] IntPtr lpOutBuffer,
[In] int dwOutBufferSize,
[Out] out int lpBytesReturned);
My problem is that whenever I call this function (in C# code) it returns 0x80070057 (Invalid parameter). The handle to the port is valid, and I have received a message from the filter just before this method is called.
I'm using it like this to send a message to the filter:
int bufferSize = Marshal.SizeOf(myBuffer);
IntPtr inBuffer = Marshal.AllocHGlobal(bufferSize);
int bytesReturned = 0;
Marshal.StructureToPtr(myBuffer, inBuffer, true);
int res = FltLib.FilterSendMessage(_hPort, inBuffer, bufferSize,
IntPtr.Zero, 0, out bytesReturned);
Any help appreciated, thanks...
Soren
|
|
|
|
|
Ahhr - never mind, my bad!
It works fine passing the right buffer
Soren
|
|
|
|
|
Hi,
I am using some unmanaged Dlls and need equivalent types when calling the functions in these DLLs from managed C# code:
For e.g.: const char** = ref string, const char* = string, char** = out IntPtr.
Does anyone know the equivalents for these?
int* = ?
char**** = ?
char*** = ?
float* = ?
uint64* = ?
double* = ?
thanks
|
|
|
|
|
They are all inptr. Any pointer has the same space in memory, as it's a memory address. Then you need to marshall the intptr in your managed code to get the data it's pointing to. A char * is different, it's a string. So, a char ** is a pointer to a string. Hence, an IntPtr.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I tend to disagree somewhat. For value types a single indirection can easily be accomplished using the ref keyword; I do use IntPtr for reference types that either got fixed or GCHandle-pinned (with the exception for strings).
Here is a working example:
[DllImport("kernel32.dll")]
public static extern int GetDiskFreeSpaceEx(string rootPathName,
ref long lpFreeBytesAvailable, ref long lpTotalNumberOfBytes,
ref long lpTotalNumberOfFreeBytes);
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Yes, that would clearly work, hence, my 5
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
One note to this - if you're passing a string into unmanaged code that's going to be written to, you should use a StringBuilder instead of a string.
|
|
|
|
|
I do. It even is my favorite way of returning a string: just pass a SB with sufficient capacity and have it filled.
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|