|
using System;
using System.Runtime.InteropServices;
using System.IO;
public class Audio
{
[DllImport("winmm.dll")]
public static extern int PlaySound(String lpszName, int hModule, int dwFlags);
public static void Main(String[] args)
{
string filename = Directory.GetCurrentDirectory() +"\\" + "clock.wav";
PlaySound(filename, 0, 0);
}
}
|
|
|
|
|
I'm logging data to a listbox at a fairly rapid rate (10-100x /sec). THe problem is that after a few minutes my apps memory usage resembles a sawtooth wave with lows of 20-40megs and peaks of several hundred megs, each peak is typically larger than the preceding one until they get to about 250megs at which point the peaks size levels off. From saving out the logdata to a textfile, it's ~0.1% of the size of the memory usage peaks. My suspicion of what's happening is that each time I add an element to the listbox the entire Items list is destroyed and recreated. This would give the growth of several megs/second with periodic garbage collects being the large drops.
If I comment out the add line, my memory usage stays in the low double digit megabytes, so I'm fairly certain it's the listbox that's too blame. Is there anyway to do the updates without abusing the GC this badly, or do I need to rethink my logging and display approach?
lb.TopIndex = lb.Items.Add(timestamp + eventText);
|
|
|
|
|
Hi!
I think you seriously should reconsider your logging.
No use having several thousand entries in a ListBox - no-one will read them all.
Perhaps you could log to a file and just keep the last n entries in the listbox...
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Is it possible to parse an existing string (CSS properties) with RegEx? For example, the background tag contains "#CA090D url(searchbg.gif) repeat-x bottom left". The first property is the background color and the second property is the background image. I would like to be able to pull all of the values into a collection and be able to extract and replace cetain values such as background color, etc. What might be a possible way with RegEx to extract and replace these values?
|
|
|
|
|
Yes it is possible to look for the background string with regular expressions, this is exactly what they are designed for. The problems would be with different permutations of the background tag. I can't remember exactly without looking it up but I seem to remember that the attributes aren't specified in any particular order. If they can be in a particular order then it is simpler. But a Regex like the following may work (with expansion):
background\:\w+(#[0-9A-F]{6})\w+url\(([^\)]+)\)\w+(\W+)\w+(\W+)
I'm not sure if this is 100% correct as I'm rebuilding my dev machine at the moment but basically it'll match a background colour (beginning with the background: tag, followed by a # and followed by 6 hex digits), some whitespace, url( any character except a ')') , whitespace, not whitespace, whitespace, not whitespace).
Each of the attributes is assigned a group which can be accessed through the Match object.
As for replacing the values this can be done with the Regex.Replace method.
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|
|
I'm trying to do something very similar to this article here:
http://www.codeproject.com/cs/combobox/nishfontcombo.asp[^]
My question is that if you look at the font combo box in Microsoft Word it has the name of the font written in that font (just like Nish's combo box does and the one I'm working on) except where the font is a symbol font (e.g. Marlett, WingDings, etc). When there is a symbol font it prints the name in a regular font (looks like Arial) and then includes a few symbols after the name. This is something like a hybrid of the two different modes in Nish's example. Is there a way from the FontFamily object (or somewhere else) to tell that a font is a symbol font and not a regular font as Word seems to be able to do?
|
|
|
|
|
|
hi all,
i display some data from msaccess in datagridview according to some specific search criteria.
and i put 3 buttons (Word, Excel, Print) under that datagridview.
with 1st button, i want to save data displayed in a doc file. with 2nd in a xls file and the last one send to a printer.
how can i do this ?
anyone gives some information how to achieve what i wanna do ?
or suggests a document to read ?
thanks in advance,
bye.
|
|
|
|
|
i think u can use stream writer and streamreader for save data or read data from the files.
data set is in connection with xml . u just must add a xml file to your project and work with it.
for send data to printer u can use crystal report or print prieview control(i think).if you use control u must use drawing namespace(or e.graphics for ex.) to draw your form and measure the line is in your page and your no's of print pages.
|
|
|
|
|
I'd like to build an app that can retrieve the name of the computer a user is logged onto based on their user name. So let's say jjohnson1 is logged onto the network, I want to be able to launch my app and feed it jjohnson1, the program would then query something and spit back the computer name. Does that make sense?
It seems like it should be easy to do but I haven't found anything online about it.
I thought it would be in AD but I'm not so sure anymore. Any ideas?
|
|
|
|
|
Could you not have the client send the computer name to your server when the user logs on and have the server store that? You can use Environment.MachineName on the clients computer to get a computer name.
|
|
|
|
|
That would probably work, but would require me to put some code locally on a couple thousand PCs on our network.
I work in a help desk and often we need to remotely connect to their PCs to fix whatever they broke. Unfortunately, half of the call is spent showing them how to get their computer's name. That, of course, is only after they stop laughing at the thought of a computer having a name - which let me tell you gets a little old. : )
So I thought it would be cool, while we're getting their vitals (i.e. name from which we can derive their username) we could plug that username into some simple little app (maybe even a console app) and discover the PC they're currently logged onto. Doesn't it seem like that should be possible?
|
|
|
|
|
Maybe this article help you.
Best regards, Alexey.
|
|
|
|
|
I have been using Org.Mentalis.Security for desktop applications and it is very helpfull. However when I tried to use it to run pocket PCs application it didnot work. I tried to use source code to make a pocket PC version but it is driving me crazy. If anyone has an idea how to do that or knows another library that runs security features like SSL for pocket PCs please help.
By the way Org.Mentalis.Security is a great open source security library available on http://www.mentalis.org/soft/projects/secserv/download.qpx
Thanks
-- modified at 15:10 Wednesday 24th May, 2006
|
|
|
|
|
i want to use this in my application
new Microsoft.CSharp.CSharpCodeProvider().CreateCompiler()
where can i gind csc.exe compliler? Can i add end distribuite it freely in my software?
|
|
|
|
|
1. Go to msdn.microsoft.com. Search for Microsoft.CSharp.CSharpCodeProvider.
2. Hit the keys Windows+F. Type in csc.exe.
www.logifusion.com
|
|
|
|
|
Hi!
The C# compiler is part of the .NET framework and can be found somewhere under %WINDIR%\Microsoft.NET
So if you have a .NET framework installed on the target machine (which you need for your app to run), you'll also have csc.exe.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
How to create customize buttons easy?I need help quick can enybody help me!?!
nemanja
|
|
|
|
|
Hi All !
I want to terminate my Application in a specific Time .for example after 3 days , myApplication is locked .thanks a lot for any help !
Regards ,
s_mostafa_h
|
|
|
|
|
As much as some of us like to answer questions on C#. This kind of question is scary. Are you saying your app locks up after three days and you want to terminate it or are you talking about some kind of licensing thing where you want the application to stop working for the user?
www.logifusion.com
|
|
|
|
|
Try this:
You'll have to define a stopTime globally and load it when you load the app (I've just done it in the first form load event)
DateTime stopTime;
private void Form1_Load(object sender, System.EventArgs e)
{
stopTime = DateTime.Now;
}
Then you can add a timer and set it to check every so often
private void timer1_Tick(object sender, System.EventArgs e)
{
if (DateTime.Now > stopTime)
{
Application.Exit();
}
HTH
|
|
|
|
|
thanks for ur reply .
MCSD-Gandalf wrote: Are you saying your app locks up after three days and you want to terminate it
ofcourse , this is an example ...
Regards ,
s_mostafa_h
|
|
|
|
|
I have a windows app that requires I use the Microsoft Datagrid.
My users would like to be able to select multiple rows using the Shift and Ctrl keys, and the datagrid has the selection funtionality built-in, BUT
I can't seem to get the datagrid to respond to the KeyUp event for those keys on the datagrid correctly. It appears that it only fires if I do click on the margin/control area OUTSIDE the rows. I have the same code in a MouseUp event and that event seems to fire correctly, however although I have a breakpoint set in the KeyUp event, it never appears to enter this event.
Does anyone have an idea of what I'm doing wrong, or an example of some KeyUp event at the datagrid level?
Thanks
|
|
|
|
|
I am new to c# and am trying to build my own tabbed web browser.
I have a search bar at the top that has a text field.
I am trying to create a button to highlight the text in the search box field on the current loaded web page.
Kinda like the google search bar does.
Thank you for your time.
|
|
|
|
|
Use the
Document<code> property of the WebBrowser, this will provide access to a class representation of the HTML code. Once you have found the element which you need then you can select the text by using a method inside the object representing the html tag. (I think, sorry I'm in the middle of rebuilding my development machine so can't check this out). <br />
<br />
<hr>You know you're a Land Rover owner when the best route from point A to point B is through the mud.<br />
<br />
Ed
|
|
|
|