|
thanks for the reply it works.
|
|
|
|
|
I need to flush the IconCache. So i did this TweakUI thingy (iconsize - 1, refresh, iconsize + 1, refresh).
Key = Microsoft.Win32.Registry.CurrentUser;
Key = Key.OpenSubKey(@"Control Panel\Desktop\WindowMetrics", true);
Key.SetValue("Shell Icon Size", (Size-1).ToString());
SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, SPI_SETNONCLIENTMETRICS, 0);
Key.SetValue("Shell Icon Size", Size.ToString());
SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, SPI_SETNONCLIENTMETRICS, 0);
Key.Close();
i am using this DllImport
[DllImport("user32.dll")]
static extern int SendMessage(int hWnd, uint Msg, int wParam, int lParam);
and these constants:
HWND_BROADCAST = 0xffff;
WM_SETTINGCHANGE = 0x001A
SPI_SETNONCLIENTMETRICS = 0x002A;
so i have the flush most of the time BUT the app stops at the 2nd send message somehow. anybody has an idea why?
|
|
|
|
|
Which app freezes? The one sending the message (code posted above) or the one that you're trying to get to update? If it's the one above it's probably another app not handling the broadcast fast enough. I believe that the SendMessage will not return in this case until all of the apps have handled HWND_BROADCAST. Can you change it to a PostMessage instead?
Jared Parsons
jaredp@beanseed.org
http://spaces.msn.com/members/jaredp/
|
|
|
|
|
Hi all.
I saing from the beginning : My English is very bad!!!:-OOk,i am asking my questions...
I ManagementObjectSearcher ' s wanting to use sql clause constructor.Which can i sql clause to this constructor???Can you give them list to me....
Example:
private static System.Management.ManagementObjectSearcher nesne=new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive");
"SELECT * FROM Win32_DiskDrive" <<<<----- As Of this .I want to my can use sql clause...Please help me!!!
Thanks...
|
|
|
|
|
|
Hi,
I'm writing a program that uses an external service.
My problam is that the external service does'nt free it's memory - and after a while it increases and slows the system. Programs like FreeRam or cacheman free the service memory (which is running in an exe process) with no problem.
I want to be able to free the process's memory using my own code. How do I do that? What API are involved and how do I use them?
Thanks
oren_mh
|
|
|
|
|
orenmh wrote: Programs like FreeRam or cacheman free the service memory (which is running in an exe process) with no problem
I've read reports of these programs. They are supposedly a sham and don't really do anything other than trick you into thinking that is has done something useful. Most of the time they make the overall situation worse.
An external process that has no knowledge of an application cannot force it to free RAM, it can only trick it into paging memory in RAM to the swap file. This means that more RAM is freed up, but slows down already running applications because they have to be swapped back to main memory in order to run at some later point.
orenmh wrote: I want to be able to free the process's memory using my own code. How do I do that?
If you have the source code of the service, then you can re-write it to be more memory efficient.
orenmh wrote: What API are involved and how do I use them?
DisplaceExistingProgramsToVirtualMemory()
{
byte[] bigBlockOfMemory = new byte[1048576*512];
}
That ought to do it. If you have a lot of memory you might want to increase the amount allocated.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
I want to make in C# something as the following structure in C:
struct {
short int i1:2;
short int i2:4;
short int i3:1;
short int i4:9;
} My_struct;
Drot
|
|
|
|
|
AFAIK, there is no support for that type of structure in C#. You can do some hacking with bytes and properties to kinda get that experience.
Jared Parsons
jaredp@beanseed.org
http://spaces.msn.com/members/jaredp/
|
|
|
|
|
|
Use FlagsAttribute to make bit fields
[Flags]
public enum States:long
{
B_0000 = 0,
B_0001 = 1,
B_0010 = 2,
B_0100 = 4,
B_1000 = 8
}
DevIntelligence.com - My blog for .Net Developers
|
|
|
|
|
Hi, i try to add data from an Access-database to an ArrayList, so far so good, but something goes wrong, can someone help me...??
public List<cd> cdListe = new List<cd>();
public FyldListe()
{
string dbForbindelse = "provider=Microsoft.Jet.OLEDB.4.0; " + "data
source = C:\\databasenavn.mdb";
string HentAlleData = "SELECT nr, art, model, årgang, navn FROM
oversigt";
OleDbDataAdapter DataAdapter = new OleDbDataAdapter(HentAlleData,
dbForbindelse);
DataSet Datasæt = new DataSet();
DataAdapter.Fill(Datasæt, "oversigt");
DataTable dataTable = Datasæt.Tables[0];
foreach (DataRow dataRow in dataTable.Rows)
{
cdListe.Add(new Kamp(dataRow["nr"], dataRow["art"],
dataRow["model"], dataRow["årgang"]));
}
If i, instead of the last line, write:
listBox1.Items.Add(dataRow["nr"], dataRow["art"], dataRow["model"],
dataRow["årgang"]);
..everything add fine to the listBox.
But the other dosen't work, it say's, that it could not convert from
object to string, and .ToString doesn't help...
what do i do wrong...??
I use visual basic express 2005
(hope u can read my english)
Helge
|
|
|
|
|
I would think it is the Kamp constructor.
I assume the constructor looks something like that:
public Kamp(string nr, string art, srting model, string argang){
}
This means that if you call this constructor you need to pass 4 string parameters, but dataRow["xxx"] returns only an object.
If my constructor assumption is correct you'll need something like that:
cdListe.Add(new Kamp(Convert.ToString(dataRow["nr"]),
Convert.ToString(dataRow["art"]),
Convert.ToString(dataRow["model"]),
Convert.ToString(dataRow["årgang"])));
Duif wrote: I use visual basic express 2005
No you are obviously using Visual C# Express...
|
|
|
|
|
Hi Robert, thank you for the fast reply...,
i will try it immediately...
And of course you are rigth, i use visual studio C# express...
Helge
|
|
|
|
|
Hi Robert, it worked...., i'm happy...
Thank you..., have a nice week-end...
Helge
|
|
|
|
|
Hi again Robert, can you also tell me, how i get the data from the ArrayList added to a DataGridView....???
I thought, that i could do it in the DataGridView properties, datasource...
Helge
|
|
|
|
|
Depends a little bit on how you bound your data but here are two alternatives:
string nr = (string)_entriesGridView[2, 3].Value;
ArrayList list = (ArrayList)_entriesGridView.DataSource;
Kamp kamp = (Kamp)list[2];
string nr = Kamp.Nr;
|
|
|
|
|
Hi
I have created a ListView, with View put to Details.
Added a few items, and gave them some subItems.
Then I changed the background colour on all the
items and subItems.
Then when I click on one item it the background on the
first subitem gets gray, and the other subitems get
a white background.
Is it possible to make all the subitems the same colour,
when the item is selected?
Thanks
QzRz
|
|
|
|
|
In the properties for the ListView control you will see a property named "FullRowSelect". Set this property to true.
-Chris
|
|
|
|
|
It works now
Thanks!
|
|
|
|
|
Is it possible to print your entire form, with pictureboxes etc.
I know you can use ControlPaint.Button etc to print my controls, but what if i had an entire form(not mainmenu and the things above) i wished to output to my printer?
|
|
|
|
|
|
Yes but those examples doesnt really do what i want, it has shortcomings when it comes to pictureboxes etc.
In old vb6.0 you could print an entire form, with PrintForm. MSDN makes an example where they Screenshot the memory for the drawed form(since printform isnt in .net), but if some part of the form is outside the screen, it cant dump that.
To me it sound logically, that you should be able to extract the drawed form somehow, even though it isnt on screen. Perhaps build a shadow of it in memory? and then memcpy that to the printerdocument.
|
|
|
|
|
You could probably have a look at the WM_PRINT and WM_PRINTCLIENT apis. If I remember correctly they nearly did the same thing as WM_PAINT did with the difference not having an invalid area (i.e. outside of the screen).
|
|
|
|
|
Hi
I have created a new Project in VS2003, and added a WindowsForm.
I want the to forms to "communicate". When i call from one to another
I usually create:
public static string/bool/int/etc.
But i want it to do it to:
public static void.
I have done it like this,
public static void Hello()
{
HelloWorld();
}
Where the HelloWorld get data from "private void HelloWorld()"
But that does not work it gives me the error:
'SkoleTing.MainForm.XmlData' denotes a 'field' where a 'class' was expected
I have no clue what I can use instead of the "static", because it is obvious
that I cannot use "static" in this case?
Can anyone help me how to do this?
Thanks
QzRz
|
|
|
|