My code looks like this: CFileDialog m_FileDialog(FALSE); m_FileDialog.m_ofn.Flags = OFN_HIDEREADONLY; m_FileDialog.m_ofn.lpstrFilter = "Rich Text Format (*.rtf)\0*.rtf\0"); m_FileDialog.m_ofn.lpstrDefExt = "*.rtf"; m_FileDialog.DoModal(); <------------------- Why do I get an assertion failed on DoModal() ???
Szymon Pusz
Posts
-
ASSERT on CFileDialog.DoModal() -
Memory deallocationWho knows how to deallocate memory I allocated using something like this: char *x = new char[100000000]; ? I know tha there is a 'delete' command, but it deallocates mem only for the current app and I want to give the memory back to the OS. Any ideas ?
-
Socket and ReadCallbackI have a problem with ReadCallback when I'm using sockets. Here's my problem: i'm writing an internet chat program. When user sends me a messages at large time intervals, everything is OK, but if he's flooding me, ReadCallback gets lots of calls. This causes that many Readcallback is calling and this causes overlapping messages in socket. Socket treats some messages as a one big message (they were sent as a separate messages). As a result of this the message is not easy readable... My ReadCallback begins with Monitor.Enter(RecQueue) and ends Monitor.Exit(RecQueue) [RecQueue = new Queue()]. How to force socket not to overlap multi messages into one? Here is my ReadCallback code: public void ReadCallback(IAsyncResult ar) { Monitor.Enter(RecQueue); StateObject state = (StateObject) ar.AsyncState; state.workSocket.Blocking = false; Socket handler = state.workSocket; handler.Blocking = false; int read; read = handler.EndReceive(ar); if (read > 0) //display a message { DisplayMessageProcedure("the message"); } else { //close the connection handler.Close(); } if (handler.Connected == true) { handler.BeginReceive(state.buffer,0,StateObject.BufferSize, 0, new AsyncCallback(ReadCallback), state); } Monitor.Exit(RecQueue); } public class StateObject { public Socket workSocket = null; public const int BufferSize = 1024; public byte[] buffer = new byte[BufferSize]; public StringBuilder sb = new StringBuilder(); } public void ListenProcedure() { IPAddress ipAd = IPAddress.Parse("0.0.0.0"); //all interfaces IPEndPoint localEP = new IPEndPoint(ipAd, System.Convert.ToInt32(PortEdit.Text)); sock = new Socket(localEP.Address.AddressFamily, SocketType.Stream, ProtocolType.Tcp); sock.Blocking = false; sock.Bind(localEP); sock.Listen(1); sock.BeginAccept(new AsyncCallback(AcceptCallback), sock); } HELP!!!
-
How to play WAVE sound from resource?Yesss, now it works!!! Thanks a lot!!!
-
How to play WAVE sound from resource?Thanks, but does anyone knows how to open these wave bytes??? I know that there's an API function called PlaySound, but it can play from file or from *Win32* resource. As far as I'm concerned C# doesn't compile resources as a Win32 type, but as it own format... Any ideas?
-
How to play WAVE sound from resource?I put a WAVE file into the resource as a Embedded resource. How to play it now? Could someone give me an example?
-
"Default" attribute to button ?How can I add something like "default" attribute to button? When I press the ENTER key I simply want to activate specific button, but where is the "default" attribute? It was in Visual C++, but in C# I don't see it... :((
-
Assembler in C# code ?Who knows if it's possible to include some inline assembler code into C# code ?
-
Yes! Solution to compile MANIFEST resource into EXE ;)At last I found the way to compile manifest into C# exe file. Download program called PE Explorer (http://www.heaventools.com). This program can insert manifest resource into the final exe file. It's a little odd, but it works very well ;P
-
Manifest compiled into the EXE fileI've already tried it and it works neither "Embedded Resource" nor "Content".:(( I think it should be compiled as a Win32 resource and C# compiles it a little bit different (resx). But I'm not sure.
-
Manifest compiled into the EXE fileI know that this topic was discussed, but no-one wrote how to compile manifest as a resource (into the EXE file). So I ask how to do it?
-
Compiling an app in C# with windows dlls STATICALLY linkedWho knows how to link all DLL's which an C# app need into one EXE file staticaly. In VS C++ there is a choice called "Use MFC in a Static Library" and then the c++ app runs on every system, but how to do it in C#???