Click here to Skip to main content
16,005,037 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: Access is denied while export crystal report Pin
Christian Graus26-Jun-08 1:21
protectorChristian Graus26-Jun-08 1:21 
Questionhow would you do this using TDD? Pin
mr_lasseter25-Jun-08 14:39
mr_lasseter25-Jun-08 14:39 
AnswerRe: how would you do this using TDD? Pin
led mike26-Jun-08 5:05
led mike26-Jun-08 5:05 
Questioniexplore.exe.config Pin
Member 450727925-Jun-08 13:35
professionalMember 450727925-Jun-08 13:35 
AnswerRe: iexplore.exe.config Pin
Christian Graus25-Jun-08 23:39
protectorChristian Graus25-Jun-08 23:39 
AnswerRe: iexplore.exe.config Pin
Abhijit Jana28-Jun-08 0:24
professionalAbhijit Jana28-Jun-08 0:24 
AnswerRe: iexplore.exe.config Pin
Paul Conrad28-Jun-08 8:03
professionalPaul Conrad28-Jun-08 8:03 
QuestionGarbage Collector destroys my unmanged data Pin
ctoma200525-Jun-08 4:15
ctoma200525-Jun-08 4:15 
Hy there, I have a big problem. I need to play sounds(for now WAVs), more at a time. I have a method, because I used DirectSound3 on C++ and it worked. So I made a native dll that has 4 methods: one to initialize DirectSound, one to add a sound, one to play and one to stop.
The add methods looks like this:

[DllImport("playsound.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.Cdecl)]


public static extern void Add(string name,bool looped,IntPtr data);


At first,I had the wav sound in my application Resources(as an unmanaged memory stream), so I have done this:



data = new byte[Resource.win.Length];

Resource.sound.Read(data, 0, Resource.sound.Length);

handle = GCHandle.Alloc(data, GCHandleType.Pinned);

DirectSound.Add("soundname", false, handle.AddrOfPinnedObject());


The application seems to work fine. The sound does play. My problems started when I placed a button on the form.Even if the button doesn't do anything,pressing him increases app memory. When the application reaches a level(at my computer,aproximately 10 MB), the output shows "thread X exited with code.." and,from now on, the application is frozen,it blocks(at the method Play).

I suspect that the thread that exited was the garbage collector, and it messed up my sound.But I have a GCHandle on it...

When the method Add is called, the native dll(made in C++ Builder) uses new to create a buffer. Does .NET ignore that..and considers it unused memory?I can't tell .NET what is in that dll...because it is native. How do I stop him from taking that memory?

PS: If I load the sound directly from a file (!) the application does not froze,it just doesn't play the sound. Maybe because the resources are an object? So when the garbage collecter works,it compacts the memory?

If someone is fammiliar with this kind of problems, please help me, I am really stuck. Thans in advance.
QuestionRe: Garbage Collector destroys my unmanged data Pin
Mark Salsbery25-Jun-08 10:32
Mark Salsbery25-Jun-08 10:32 
AnswerRe: Garbage Collector destroys my unmanged data Pin
ctoma200525-Jun-08 21:53
ctoma200525-Jun-08 21:53 
GeneralRe: Garbage Collector destroys my unmanged data Pin
ctoma200526-Jun-08 2:00
ctoma200526-Jun-08 2:00 
GeneralRe: Garbage Collector destroys my unmanged data Pin
Mark Salsbery26-Jun-08 4:44
Mark Salsbery26-Jun-08 4:44 
QuestionRe: Garbage Collector destroys my unmanged data Pin
Mark Salsbery26-Jun-08 5:11
Mark Salsbery26-Jun-08 5:11 
AnswerRe: Garbage Collector destroys my unmanged data Pin
ctoma200526-Jun-08 6:09
ctoma200526-Jun-08 6:09 
GeneralRe: Garbage Collector destroys my unmanged data Pin
Mark Salsbery26-Jun-08 6:33
Mark Salsbery26-Jun-08 6:33 
QuestionWhat is the .Net equivalent of GetSystemMetrics(SM_CXVSCROLL)? Pin
KeesVer24-Jun-08 23:55
KeesVer24-Jun-08 23:55 
AnswerRe: What is the .Net equivalent of GetSystemMetrics(SM_CXVSCROLL)? Pin
led mike25-Jun-08 4:44
led mike25-Jun-08 4:44 
QuestionWorkflow Foundation -- why? Pin
Rei Miyasaka23-Jun-08 17:52
Rei Miyasaka23-Jun-08 17:52 
AnswerRe: Workflow Foundation -- why? Pin
Mark Churchill23-Jun-08 18:14
Mark Churchill23-Jun-08 18:14 
GeneralRe: Workflow Foundation -- why? Pin
Rei Miyasaka23-Jun-08 19:23
Rei Miyasaka23-Jun-08 19:23 
GeneralRe: Workflow Foundation -- why? Pin
Mark Churchill24-Jun-08 17:55
Mark Churchill24-Jun-08 17:55 
QuestionLauch a local program and pass args. Pin
Cory Kimble23-Jun-08 6:40
Cory Kimble23-Jun-08 6:40 
AnswerRe: Lauch a local program and pass args. Pin
Giorgi Dalakishvili23-Jun-08 6:54
mentorGiorgi Dalakishvili23-Jun-08 6:54 
GeneralRe: Lauch a local program and pass args. Pin
Cory Kimble23-Jun-08 9:55
Cory Kimble23-Jun-08 9:55 
GeneralRe: Lauch a local program and pass args. Pin
led mike23-Jun-08 10:01
led mike23-Jun-08 10:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.