|
Nnamdi Onyeyiri wrote:
i was not sure how to get them all to write to the same file at once.
Try referencing them all to the same filestream, you will be writing a byte buffer (say 4kb) at any one time, using a lock to prevent (or rather queue) the other threads from writing to the stream at the same time.
READ MSDN
|
|
|
|
|
|
the byte buffer will be written to the file sequencially , you will just need to keep track of the start offset where it should be written in the file for each thread
READ MSDN
|
|
|
|
|
|
If got problems, send me the source as I just created a need to have a class like that as well
Cheers
Good Luck
READ MSDN
|
|
|
|
|
leppie wrote:
If got problems, send me the source as I just created a need to have a class like that as well
a download class?
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "All programmers are playwrights and all computers are lousy actors."
|
|
|
|
|
Yes , something that I want to integtrate into an IRC client i am writing.
READ MSDN
|
|
|
|
|
im not writing a program per say, more of im just writing misc classes, and putting them into a dll, for use in future projects.
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "All programmers are playwrights and all computers are lousy actors."
|
|
|
|
|
Thats what i meant Then I wont have to write it and I can maybe help you better it if neccesary
I am almost 80% complete with my IRC client and HTTP transfer is one of the funtionalities I would like to implement as a plugin to my client, as well as FTP and some file sharing protocols.
Give me a shout then when done please
Cheers
READ MSDN
|
|
|
|
|
|
All...
I've written a windows service which works properly on my development machine and on a QA machine. When installing it on a production machine,the service tries to start however after waiting about 30 seconds, it stops and SCM gives an error that the service did not respond in a timely fashion.
I've gone back to my code and commented everything except for a static logging method that I'm using for debugging. The entry point code is listed below...when starting the service, it is failing between logging the 2nd /3rd lines. Keep in mind that all code is commented out in the "transportClass" at this point and it is still failing to start the service. Given that it works beautifully on multiple other machines, I think it must
be configuration of some sort -- any thoughts???
/*******************************
static void Main()
{
LogError("Starting Main");
System.ServiceProcess.ServiceBase[] ServicesToRun;
LogError("Second Line");
ServicesToRun = new System.ServiceProcess.ServiceBase[] { new
transportClass() };
LogError("Third Line");
System.ServiceProcess.ServiceBase.Run(ServicesToRun);
LogError("Exiting Main");
}
*******************************/
Thanks,
Jason Mark
jmark@comcenters.com
|
|
|
|
|
I have added a custom component that draws a big ellipse on a form. (It's much more involved, but keeping it easy for an example)
Inside of the initialization, I add a delegate to the Form's Paint method.
m_Parent.Paint += new PaintEventHandler( this.Paint );
Unfortunately, the delegates are drawn first, and then all of the controls. So, all of the controls are drawn on top of my ellipse and I can't see it.
Since there isn't a method called Painted , how can I get my component to draw on TOP of the other controls instead of on the bottom?!
|
|
|
|
|
You could try using:
<br />
this.Invalidate();<br />
Call this after everything else has been drawn. The invalidate method causes the control to repaint itself. You may need to remove the handler that you gave in your post. I think this should work, but I can't be sure.
Later,
Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
Hello everyone,
I have been sifting through code project to find an answer to my question and I came up with with an article about how to make calls to the windows API with C# but it didn't quite answer my problem. How would I make a call to the Window API to change the screen resolution? What would be the call to play sound files (From what I've seen .NET doesnt have any functions to play sound files)?
|
|
|
|
|
You would use a call to ChangeDisplaySettings.
This might help:
class Win
{
internal const int ENUM_CURRENT_SETTINGS = -1;
internal const uint DM_BITSPERPEL = 0x00040000;
internal const uint DM_PELSWIDTH = 0x00080000;
internal const uint DM_PELSHEIGHT = 0x00100000;
internal const uint DM_DISPLAYFREQUENCY = 0x00400000;
internal const int CDS_UPDATEREGISTRY = 0x00000001;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
internal class DEVMODE
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
internal string dmDeviceName;
internal ushort dmSpecVersion;
internal ushort dmDriverVersion;
internal ushort dmSize;
internal ushort dmDriverExtra;
internal uint dmFields;
internal short dmOrientation;
internal short dmPaperSize;
internal short dmPaperLength;
internal short dmPaperWidth;
internal short dmScale;
internal short dmCopies;
internal short dmDefaultSource;
internal short dmPrintQuality;
internal short dmColor;
internal short dmDuplex;
internal short dmYResolution;
internal short dmTTOption;
internal short dmCollate;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
internal string dmFormName;
internal ushort dmLogPixels;
internal uint dmBitsPerPel;
internal uint dmPelsWidth;
internal uint dmPelsHeight;
internal uint dmDisplayFlags;
internal uint dmDisplayFrequency;
internal uint dmICMMethod;
internal uint dmICMIntent;
internal uint dmMediaType;
internal uint dmDitherType;
internal uint dmReserved1;
internal uint dmReserved2;
internal uint dmPanningWidth;
internal uint dmPanningHeight;
}
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
internal static extern int EnumDisplaySettings(string lpszDeviceName, int iModeNum, [In, Out] DEVMODE lpDevMode);
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
internal static extern int ChangeDisplaySettings(DEVMODE lpDevMode, int dwFlags);
}
|
|
|
|
|
Thank you
|
|
|
|
|
Defeats the portability of the application?
Normski. - the next bit of code is self modifying ... jmp 0xCODE
|
|
|
|
|
I have 10 different assembilies, I want to put it in One Library file or one assembly, cause I don't want to add references upto 10 times everytime for my different screen. Is anybody know how to do that.
Thanks in advance
|
|
|
|
|
Try putting them all in one project.
|
|
|
|
|
I have to use xml transformation.
The simplest way is
<br />
XslTransform xsltransform = new XslTransform();<br />
xsltransform.Load("favorite.xsl");<br />
xsltransform.Transform("MyDocument.xml", "TransformResult.xml");<br />
But it is necessery for me to put output of transformation not to file but to string... (all of overloaded members of Transform has file or stream)
Do you have any idea?
|
|
|
|
|
tomiga wrote:
(all of overloaded members of Transform has file or stream)
You could create a memory stream to house the output of the transformation; then once the transformation is done convert the underlying byte array to a string.
System.Text.(Encoding).GetString(myByteArray) if the XML file uses ASCII then (Encoding) should be ASCIIEncoding; if it uses UTF8 then it should be UTF8Encoding; etc...
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|
|
Thx. I have found stream witch writes output to string. StringWriter class. It helps me to solve problem.
|
|
|
|
|
Is there any way I can pass something back from a function so that it can be a string, or a number, or some other value, like a variant in COM ? I don't want to pass an object, because it's too much work for my client to try and figure out what it is. Is that my only option, apart from GetNodeInt/GetNodeString/etc. ?
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
One option other than an object that I can think of is to use very inspecific variables. So if you know that you're going to pass either a byte, an int, or a long, use the long.
You could also try converting everything to and from a string, but that might be more work than the object.
A third option is to pass a type variable. That way you can create a switch for all of the types that might be returned.
Hope this helps
|
|
|
|
|
SHaroz wrote:
A third option is to pass a type variable. That way you can create a switch for all of the types that might be returned.
That sounds very promising - could you tell me more ?
Thanks
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|