|
what I am doing is reading the file names into a string array and then using foreach loop to process each file. This is incase there are multiple files. It seems to be doing a good job with the threading and the thread.sleep. I wonder if there are more system resources being used with my approach, I will monitor the error log and hopefully there won't be any issues
Sameer
|
|
|
|
|
|
I need to get the amount of computer physical memory.
Now, I can get the amount Windows uses by a GlobalMemoryStatus kernel32 API call.
However, this returns me the same number I see in the My Computer properties dialog box. And if I set MAXMEM paramter in the boot.ini file to 500M, this is what I'll get from this function.
Does there exist a way to find out how much memory's really plugged into my motherboard?
|
|
|
|
|
The WMI class, Win32_PhysicalMemory , will tell you how much memory is installed in each slot on the motherboard. Total it all up and you've got your total physical memory installed.
Google for "C# WMI System.Management" and you'll find examples on how to use WMI in your code.
Google for "Win32_PhysicalMemory" and you'll get the documentation on the class, including the properties to use to get your numbers.
|
|
|
|
|
That's great. Works fine for me. Thanks.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
thank you very much! works perfectly for me!
Just in case someone needs it, here's code:
using System;
using System.Management;
using System.Management.Instrumentation;
using System.Windows.Forms;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
ManagementObjectSearcher searcher =
new ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMemory");
int banknumber = 1;
foreach (ManagementObject bank in searcher.Get())
{
MessageBox.Show("Bank " + banknumber.ToString() + " size = " + bank["Capacity"].ToString());
banknumber++;
}
}
}
}
modified on Tuesday, June 9, 2009 2:07 PM
|
|
|
|
|
Hi
I am using this method to take screenshots from games in my application:
int screenWidth = Screen.GetBounds(new Point(0, 0)).Width;
int screenHeight = Screen.GetBounds(new Point(0, 0)).Height;
Bitmap bmpScreenShot = new Bitmap(screenWidth, screenHeight);
Graphics gfx = Graphics.FromImage((Image)bmpScreenShot);
gfx.CopyFromScreen(0, 0, 0, 0, new Size(screenWidth, screenHeight));
bmpScreenShot.Save("test.jpg", ImageFormat.Jpeg);
but in some games I can't get a proper screenshot. Sometimes some models are missing or only a black screen is captured.
Is there another method to capture screenshots from games? (Yes, they use DirectX)
Thanks.
|
|
|
|
|
Yes, you can ask DirectX for a copy of the backbuffer. I forgot how though but that would give you something to google for..
|
|
|
|
|
I wonder if there's a way to 'simulate' ALT+PrintScreen and then programatically get data from the clipboard and save it to a file? If there is... That oughta do it... I think
|
|
|
|
|
There is, there are functions like SendKeys . But there must be nicer ways.
My current favourite word is: Delicious!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
Dear Sir/madom
I have three tables
1. Categorys (ID, Name)
2. Definitions (ID, Name, CategoryID)
3. Versions( ID, Name, DefinitionID)
I have generated three objects using EDM
1 Cagegorys
Navigation (Definition)
2. Definitions
Navigation (Category, Version)
3. Versions
Navigation (Definition)
I want to get latest versions against each category
My Code is as follow It return all version against the categoryId but I want to get only latest version of each definition against a category.
DataEntities data = new DataEntities();
Category cat = (from c in data.Categorys where c.ID == CategoryID select c).First();
IList<definition> defintions = (from d in data.Definitions.Include("Versions") where d.Category.ID == cat.ID select d).ToList();
IList<dynamicforms.data.version> versions;
if (defintions.Count>0)
{
versions = defintions.SelectMany(d=>d.Versions).ToList();
Grid.DataSource = versions;
Grid.DataBind();
}
If I need sub query How I have construct and use subquery in this code
Your early reply will be highly appriciated please.
|
|
|
|
|
I have been searching the net for 2 months now looking for info on how to do this. Can anyone point me in the right direction?
I have a vb.net program that used SendKeys to send ctrl+C and CTRL+V that was able to do this but I can't get that to go in VS2008 C#.
tia
rafone
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
|
|
|
|
|
You're kidding right, 2 months wow!
There are a number of options
Context menu gives you right click on the node and deal with the menu option including ctrl C/V
Trap the keydown method on the node for the ctrl C, grab the node and set a flag that a node is copied, trap the next key down for the ctrl V and add the copied (cloned) node to the current selected node.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Yea really...I think if you look you will see some eariler posts going back a couple of months.
I have tried that...all I seem to get is the highlighted node I get none of the child nodes.
Originally this was a VB.net app done with VS2003 they used SendKeys CTRL+C and CTRL+V and it works fine.
Now I am trying to upgrade to C# using VS2008 and the above no longer works (don't get the child nodes)
Any other Ideas??
rafone
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
|
|
|
|
|
I guess you are copying the selected node and assuming the child nodes are in there - sounds like you need to get the whole structure of child nodes manually during the copy process.
I also presume you are copying the selected node to the clipboard and then pasting from the clipboard and accepting those limitations. This is useful only if you are moving off the app/form/control where you are copying from (and thereby losing the original structure). If it is inside your app why not grab a placeholder on the copy event and when the paste is done go and get the entire structure from the original node.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
The way it worked in the old app was they were copying the selected node and pasting using the clipboard. This copies the selected node and all of its child nodes. (they were using the sendKeys CTRL+C and CTRL+V).
The few examples I have found on the net were just the simple copy and paste of the selectedNode.
I have also tried cloning but have not gotten that to work either.
If you have an example or a link to a good example I would be most greatful.
It seems like it should be a simple task but I guess if it was there would be some meaningful examples.
tia
rafone
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
|
|
|
|
|
Hi there!!
My problem is when i am switching to another SQL SERVER with my project then every time i have to change my connection string.
Is there any way to solve this problem??
|
|
|
|
|
KIDYA wrote: My problem is when i am switching to another SQL SERVER with my project then every time i have to change my connection string.
Why is that a problem? Surely you are storing your connection string in the config file. Or have you hard coded it in to the application itself?
Man who stand on hill with mouth open wait long time for roast duck to drop in
|
|
|
|
|
I have it in config,Now tel me other way.
Please!!!
|
|
|
|
|
KIDYA wrote: I have it in config,Now tel me other way.
What specific problem do you have with having the connection string in your config file?
Man who stand on hill with mouth open wait long time for roast duck to drop in
|
|
|
|
|
i want common connection string thr' which i can run my project on any server withput changing config connection string.
|
|
|
|
|
..and how will you know how the SQL-server instance on my PC is called?
I are troll
|
|
|
|
|
you can store such information in a database!
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Telepathic software, the next wave of future development, just think about where you want to be!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Tele: meaning remote
Pathetic: standing for the quality
|
|
|
|