|
It seems to me that your desired result is to be interrupted once the input is received.
Interruption by definition means context-switching (threads).
You can apply a different approach (which is not a good design), by checking a boolean variable in a while loop. As stated this isn't desired as: 1. You will waste the cpu cycles 2. You will have threads anyway 3. You will need to deal with the race condition by applying locks - as one thread will read the boolean whereas another thread will write.
Uri
|
|
|
|
|
You don't need a lock for a bool though, just make it volatile and be careful when reading it (copy to local first)
|
|
|
|
|
I always thought it was cin << ReadKey(); ...Or has my memory gone KABOOM! again?
|
|
|
|
|
That's C++.
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
Are you sure you don't want a Windows Service?
|
|
|
|
|
Input from what, the network? If so, just do a blocking read without timeout?
|
|
|
|
|
yes from network
how do i block read??
This code was posted by me...
|
|
|
|
|
If you make a NetworkStream , a normal Read should be blocking - I think. But don't trust me on this one, go to MSDN and check..
|
|
|
|
|
Hello,
I have a ListBox and its DataSource as ArrayList.
What I want is whenever I add or remove items into ArrayList, to reflect changes automatically in ListBox.
My current temporary solution is to assign DataSource null then assign back to Array list, this will force ugly update.
Any idea?
Thanks
|
|
|
|
|
|
Hey dude ............. you should not ask codes here..............You should try by your self and then you can post your questions here for discussion.............. but what you are doing here is that you are giving your questions to peoples to do it for you ................. Believe me if you are doing that every time you will not succeed in programming ....... First try your best then post a question which is difficult while you are doing
|
|
|
|
|
dsrao wrote: Please provide sample code for the below requirements
Please provide your credit card number, expiry date, and security strip code. I will then start working on your homework.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
We don't do homework here.
|
|
|
|
|
Would you like fries with that?
/ravi
|
|
|
|
|
I work on C# VS05 Window. My problem is ,i can not show the group amount in word...For more clarification :
WorkerID Designation Name CurrentSalary DueSalary
1 AC A 100 0
2 AC B 180 20
3 EG C 100 80
4 EG D 120 0
5 MD E 1000 0
6 AC F 1200 70
7 EG G 100 90
Group of AC
WorkerID Designation Name CurrentSalary DueSalary
1 AC A 100 0
2 AC B 180 20
6 AC F 1200 70
-------------------------------------------------------------------
1480 90
Current Amount : One thousand Four hundred eighty Due Amount : Ninety
In my rdlc report i show report on group of Designation .....In my group footer put sum of currentSalary...I do that But i need to show CurrentSalary and DueSalary Amount in word also ......But How to ?
sfs fdsfdsfdsf dfsd
|
|
|
|
|
Hi,
i'd like to draw a rectangle when a click on the picturebox occured.
When holding the mouse button and moving the mouse, the rectangle should resize immediately.
I know that i have to use MouseDown, MouseMove and MouseUp events, but im not sure how to do it especially while using a GraphicsPath.
Maybe somebody has a short example about this process with GraphicsPath in the bookmarks or in VS? That would help a lot!
Thanks!
|
|
|
|
|
Will this[^] article help?
/ravi
|
|
|
|
|
Hi,
How would you convert a string array to enum object??
|
|
|
|
|
By iterating and parsing the strings. See foreach and System.Enum.Parse .
|
|
|
|
|
Right
Advice of the day: dont work on a complicated code segment after midnight
|
|
|
|
|
It doesn't sound complicated.
|
|
|
|
|
Hello,
I'm using the DirectShow.Net library to create a media player in my software.
using the followong code I'm able to play files in the local pc or the network (unc path)
private const int WMGraphNotify = 0x0400 + 13;
private const int VolumeFull = 0;
private const int VolumeSilence = -10000;
private IGraphBuilder graphBuilder = null;
private IMediaControl mediaControl = null;
private IMediaEventEx mediaEventEx = null;
private IVideoWindow videoWindow = null;
private IBasicAudio basicAudio = null;
private IBasicVideo basicVideo = null;
private IMediaSeeking mediaSeeking = null;
private IMediaPosition mediaPosition = null;
private IVideoFrameStep frameStep = null;
private string filename = string.Empty;
private bool isAudioOnly = false;
private bool isFullScreen = false;
private int currentVolume = VolumeFull;
private PlayState currentState = PlayState.Stopped;
private double currentPlaybackRate = 1.0;
private bool m_bTracking;
private IntPtr hDrain = IntPtr.Zero;
private AMSeekingSeekingCapabilities seek;
private double tDuration;
public void OpenPlayFile(string filename)
{
StopClip();
CloseInterfaces();
int hr = 0;
if (filename == string.Empty)
return;
this.graphBuilder = (IGraphBuilder)new FilterGraph();
hr = this.graphBuilder.RenderFile(filename, null);
DsError.ThrowExceptionForHR(hr);
this.mediaControl = (IMediaControl)this.graphBuilder;
this.mediaEventEx = (IMediaEventEx)this.graphBuilder;
this.mediaSeeking = (IMediaSeeking)this.graphBuilder;
this.mediaPosition = (IMediaPosition)this.graphBuilder;
this.videoWindow = this.graphBuilder as IVideoWindow;
this.basicVideo = this.graphBuilder as IBasicVideo;
this.basicAudio = this.graphBuilder as IBasicAudio;
CheckVisibility();
hr = this.mediaEventEx.SetNotifyWindow(this.Handle, WMGraphNotify, IntPtr.Zero);
DsError.ThrowExceptionForHR(hr);
if (!this.isAudioOnly)
{
hr = this.videoWindow.put_Owner(this.Handle);
DsError.ThrowExceptionForHR(hr);
hr = this.videoWindow.put_WindowStyle(WindowStyle.Child | WindowStyle.ClipSiblings | WindowStyle.ClipChildren);
DsError.ThrowExceptionForHR(hr);
hr = InitVideoWindow(1, 1);
DsError.ThrowExceptionForHR(hr);
GetFrameStepInterface();
}
else
{
hr = InitPlayerWindow();
DsError.ThrowExceptionForHR(hr);
}
this.isFullScreen = false;
this.currentPlaybackRate = 1.0;
this.Focus();
hr = this.mediaControl.Run();
DsError.ThrowExceptionForHR(hr);
this.currentState = PlayState.Running;
hr = this.mediaSeeking.GetCapabilities(out seek);
DsError.ThrowExceptionForHR(hr);
if (seek != AMSeekingSeekingCapabilities.None)
{
hr = mediaPosition.get_Duration(out tDuration);
DsError.ThrowExceptionForHR(hr);
tbSeekBar.Enabled = true;
btnRewind.Enabled = true;
btnForward.Enabled = true;
timer.Enabled = true;
}
else
{
tbSeekBar.Enabled = false;
btnRewind.Enabled = false;
btnForward.Enabled = false;
timer.Enabled = false;
}
}
I need to be able to play multicast streams that are sent form other computers and cameres in the Lan in udp, in the vlc player I would use the following address to play it udp://@225.19.19.83:1234 I can'r use this address in my function because it failes on
hr = this.graphBuilder.RenderFile(filename, null);
DsError.ThrowExceptionForHR(hr);
System.IO.FileNotFoundException was unhandled
Message="Exception from HRESULT: 0x800C000D"
It's logical because my code can't connect to the source
can someone help me to be able to conncet to a udp multicast sream?
|
|
|
|
|
|
Hello,
VS 2008 SP1
I have a created a small application that records and plays audio. However, my application needs to save the wave file to the application data directory on the users computer.
The mciSendString takes a C style string as a parameter and has to be in 8.3 format. However, my problem is I can't get it to save. And what is strange is sometime it does and sometimes it doesn't. However, most of the time it failes. However, if I save directly to the C drive it works first time everything. I have used 3 different methods that I have coded below.
The error number that I get when it fails is 286."The file was not saved. Make sure your system has sufficient disk space or has an intact network connection"
[DllImport("winmm.dll",CharSet=CharSet.Auto)]
private static extern uint mciSendString([MarshalAs(UnmanagedType.LPTStr)] string command,
StringBuilder returnValue,
int returnLength,
IntPtr winHandle);
[DllImport("winmm.dll", CharSet = CharSet.Auto)]
private static extern int mciGetErrorString(uint errorCode, StringBuilder errorText, int errorTextSize);
[DllImport("Kernel32.dll", CharSet=CharSet.Auto)]
private static extern int GetShortPathName([MarshalAs(UnmanagedType.LPTStr)] string longPath,
[MarshalAs(UnmanagedType.LPTStr)] StringBuilder shortPath,
int length);
private void StopRecording()
{
string shortPath = this.shortPathName();
string formatShortPath = string.Format("save recsound \"{0}\"", shortPath);
uint result = 0;
StringBuilder errorTest = new StringBuilder(256);
result = mciSendString(string.Format("{0}", formatShortPath), null, 0, IntPtr.Zero);
mciGetErrorString(result, errorTest, errorTest.Length);
result = mciSendString("save recsound \"C:\\DOCUME~1\\Steve\\APPLIC~1\\Test.wav\"", null, 0, IntPtr.Zero);
mciGetErrorString(result, errorTest, errorTest.Length);
result = mciSendString(@"save recsound C:\DOCUME~1\Steve\APPLIC~1\Test.wav", null, 0, IntPtr.Zero);
mciGetErrorString(result, errorTest, errorTest.Length);
result = mciSendString(@"save recsound C:\Test.wav", null, 0, IntPtr.Zero);
mciGetErrorString(result, errorTest, errorTest.Length);
mciSendString("close recsound ", null, 0, IntPtr.Zero);
}
private string shortPathName()
{
string shortPath = string.Empty;
long length = 0;
StringBuilder buffer = new StringBuilder(256);
length = GetShortPathName(this.saveRecordingPath, buffer, 256);
shortPath = buffer.ToString();
return shortPath;
}
|
|
|
|
|
can we make printable grid of simple dot net grid, and can we print our form objects with grid? I am trying to create my own report builder for C# forms application
|
|
|
|