|
|
|
Hello Alan,
After testing, it appears that this the notification that an f5 refresh causes? Is this correct?
Regardless, it doesn't seem to cause solve the problem... maybe TweakUI also clears the icon cache registry value. I'll look into this.
If you have any other ideas on how to cause a refresh, it'd be appreciated.
Thanks!
Matt
|
|
|
|
|
Take a look at:
KB132668: Icons randomly change to different icons[^]
dealing with the shell icon cache[^].
The KB article explains that you can change color depth to rebuild the shell icon cache. The second link is interesting as it explains an way to interact with the icon cache. By the way, this is the solution:
Observing registry access of tweakui.exe revealed access to a registry values:
HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics\ reg_sz: Shell Icon Size
First Rebuild Icon Cache reads the Shell Icon Size value, then writes a value of 4, then must run the shell32.dll function SendMessageTimeout, then write the original value to Shell Icon Size.
Here is more information from dealing with the shell icon cache[^]:
You can force a full cache flush by manually changing the the icon size yourself to something
one pixel smaller, broadcasting WM_SETTINGCHANGE and then setting the icon size back to normal again
(obviously followed by another WM_SETTINGCHANGE). The message broadcast is typically done something
like this:
SendMessageTimeout(
HWND_BROADCAST,
WM_SETTINGCHANGE,
SPI_SETNONCLIENTMETRICS,
(LPARAM)"WindowMetrics",
SMTO_NORMAL|SMTO_ABORTIFHUNG,
10000, NULL);
You alter the icon size by manually changing its value in the registry. The key to look at is:
HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics
The values for the icon size are Shell Icon Size and Shell Small Icon Size (both are stored as
strings - not DWORDs). You only need to change one of them to cause the refresh to happen (typically
the large icon size). If those values don't exist, the shell uses the SM_CXICON metric
(GetSystemMetrics) as the default size for large icons, and half of that for the small icon size. If
you're trying to cause a refresh and the registry entry doesn't exist, you can just assume that the
size is set to SM_CXICON.
There you go! Now to test and "problem" solved!
Thanks for your direction Alan!
Matt Brown
source: http://www.programmingforums.org/post87847-9.html[^]
static void RefreshIconCache()
{
RegistryKey k = Registry.CurrentUser.OpenSubKey("Control Panel").OpenSubKey("Desktop").OpenSubKey("WindowMetrics", true);
Object OriginalIconSize = k.GetValue("Shell Icon Size");
k.SetValue("Shell Icon Size", (Convert.ToInt32(OriginalIconSize) + 1).ToString());
k.Flush(); k.Close();
int res = 0;
SendMessageTimeout(0xffff, 0x001A, 0, "", 0x0002, 5000, out res);
k = Registry.CurrentUser.OpenSubKey("Control Panel").OpenSubKey("Desktop").OpenSubKey("WindowMetrics", true);
k.SetValue("Shell Icon Size", OriginalIconSize);
k.Flush(); k.Close();
SendMessageTimeout(0xffff, 0x001A, 0, "", 0x0002, 5000, out res);
}
modified on Thursday, March 26, 2009 9:15 AM
|
|
|
|
|
Hi there and thanks for reading.
I am currently writing a basic virus scanner but i have hit a problem. I know that a virus will have a signature (a unique order of binary 0's and 1's) that represents how the virus is written. The exact same piece of code will always have the same binary signature.
However, how can i convert a file into its binary format ready to be scanned?
My current idea is to keep virus signatures in an xml file, then scan files in a folder for the signatures stored in the xml file.
I am trung to keep it as simple as possible as i have been asked for a basic virus scanner.
This project is still in its early stages so i may be approaching this completly wrong, if so, pointers would be appreciated.
Regards,
|
|
|
|
|
File.ReadAllBytes will read the file as a byte array.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Then just add foreach in signatures, byte[].Contains, and MessageBox.Show. I *knew* those guys at norton were overcharging!
|
|
|
|
|
I am having a little issue on a project I've been working on for a while.
So I open my project now, then if I try to add a Dataset to it, it throws this error:
(To a windows form)
Failed to create component 'DataSet'. The error message follows:
'Microsoft.VSDesigner.Common.NoCurrentProjectException: Could not retrieve the current project.
at Microsoft.VSDesigner.Common.ProjectItemUtil.GetCurrentProject(Boolean throwException)
and it has a ton more.
But the thing is my project opens just fine. So how come Visual Studio is doing this?
|
|
|
|
|
|
Well I did try doing a repair on the application and that didn't work. I also tried another project and it did the same thing so my project wasn't the one corrupt (YAY!).
I completely uninstalled everything VS2008 related (including SQL and AJAX). I reinstalled the application then my computer crashed! I was working on it remotely so I have to wait till I get back to the office to turn on my computer . This would be a great time for having that vPro technology.
Its strange though because it wasn't a corrupt install (I don't think anyways). I have been using it for 6 months and it just did that today. But if I logged in as someone else it worked. Something got corrupt with my profile, but it took me reinstalling everything and my computer crashing to realize that "Hey, maybe since it worked logging in as someone else, its a profile issue and not the application.". But oh well.
Thanks
|
|
|
|
|
hi people, a few days ago i asked how could i call a form to interact with the desktop from my windows service, because everytime i started the service my form would show but it would show on this blue screen not on my desktop
well Wes and Vikram told advised me not to do this and they mentioned this:
"Do something else. Services should not interact with the desktop. If you really want to do something like this, you have to have another application that communicates with the service. "
but honestly i dont know what they were talking about with this, how can i make an application like this??
can anyone help me with this?, maybe some links or suggestions?
thanks a lot in advance
|
|
|
|
|
There are several ways for IPC
1. Pipes
2. .Net Remoting or WCF
|
|
|
|
|
mirko86 wrote: but honestly i dont know what they were talking about with this
Ok then there are two things you should choose from.
1) Take on work that you do know how to do.
2) Study a subject you don't understand until you do understand.
Note: Study a subject DOES NOT mean ask people in internet forums to explain it to you.
|
|
|
|
|
i just asked for help on where to start, see the first response? now i have a starting point thanks to him ,you didnt help at all
you really dont have to answer you know if some messages annoy you just ignore them man
thanks for the responses people
|
|
|
|
|
You think this is a forum for helping people? well... sometimes yeah, but people mainly just like to moan. Think of it as an 'outlet for stress' forum, you will get alot more out of it that way
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
haha luckily for me people have always been nice and helpful to me except for that guy, he even bothered to come back just to insult me
|
|
|
|
|
|
Hi...
Even though its not a good idea to work with, You can still do it....
write a windows service with an IPC server channel (possibly windows service as a server), create a shared object (Class library) and create an IPC client channel in your application to communicate with the service through your shared object...
In simple .Net Remoting.......
If you have further queries let me know....
Have a Happy Coding.....
|
|
|
|
|
Hello,
I write apllication(.NET 3.5 C#, SQL Server 2k8) (type ERP) with modules like: HRM, SCM, FRM, MRP.
It is multi user application.
I decide store all important data from DB in Dictionaries or List<t> ex. for INVOICE i create Dictionary<int,> etc.
To reduce connection with data base I have mechanism base on events to update specific data in my Dictionaries.
I chose this solution because I don't want once again fill my GridView from DataBase when one record has been changed by another user.
To synchronize my Dictionaries I want to use Query Notification and tracking changes mechanism (SQL Server 2008).
And all work fine but ....
Hypothetical situation.
I have for example 20 Dictionaries and any of this Dictionary have 2000-5000 elements.I fill it when the user logs on to an application.
How does it affect the weight of memory?
Is that way - casched Dictionaries - is a better solution then load all data (ex.Invoices) from data base when i need use it ?
Sorry for my English. It is not perfect.
|
|
|
|
|
Such extensive caching is usually not required unless you have some tremendous load on your servers. Generally speaking, you should avoid caching as muc has possible because it adds an additional level of complexity that must be managed in addition to managing the data in the database. You greatly increase the risk of data corruption but caching everything all the time, because it is now your responsibility to make absolutely certain data integrity constraints are met, rather than letting an RDBMS do it for you. Not only that, you will indeed greatly increase your memory footprint, and that footprint will grow as the usage of your application grows to the point where you can't keep everything in memory at all times.
If you already have performance problems...then there are other ways to solve them...such as scaling out your hardware (better hardware, more servers, etc.) If you do not have performance problems yet, and are trying to preemptively solve possible performance problems...don't bother. It is difficult to predict what may cause performance problems, and caching isn't always the best solution, and should generally not be the first. You can gain much more in terms of performance improvements for less cost by adding hardware than by increasing the complexity of your code.
|
|
|
|
|
Thank you for your answere.
Unfortunetlly I have this mechanism in my application and I'm done 2 modules. It is hard to change everythig in this moment.
But... is there a big problem if in my whole application with all modules I will be have maximum 100 000 rows in my whole tables in Data Base ?
I don't know that 100 000 records whether much, and how much it affects the load on the system ?
Because I want to sell this application with computer (notebook), my minimum requiments is:
- Core 2 Duo 2GHz,
- minimum 2GB RAM.
|
|
|
|
|
I can't say exactly what the memory load would be. It entirely depends on the size of your records. If they are all maximum size (aprox 8000 bytes, barring varchar(max) columns), and factoring in .NET overhead, 100000 records will use approximately a gig of memory. That is JUST for the rows...that doesn't factor in any other memory used by your application. Assuming you want this application to work on 32bit systems, then you will really be pushing it, as each app in 32bit windows gets a maximum of 2Gb addressable memory space.
That aside, there are much deeper concerns than memory consumption here. You are trying to cache ALL of your data in memory. Its not as simple as sticking all your records in a collection. There are usually relationships between data, concurrent updates, general data integrity, etc. to worry about when you cache that much data. Despite the fact that you have already started development, I think you need to take a step back and really evaluate what caching all your data means to the long-term sustainability of your project. You may think that continuing on will save time and money...but you are just as likely to introduce some very complex scenarios due to your caching that will need to be addressed down the road, and that could cause your long-term costs to explode far beyond any short-term costs of reevaluating your approach.
|
|
|
|
|
Thx for you answer.
Because I have 2 modules finshed from 4, I'll change the way of work with database during creation 2 new modules. In time I'll try to change everything, without simple dictionaries like for example types of invoices or types of education level.
What you suggesting as an alternative ??
I thought about :
- strong typed DataSet's,
- LINQ to SQL (but I read that is more slow then classic ADO.NET),
- Entity Framework,
- ADO.NET (mode non-connection),
- or something else ??
I'd like to just keep communicating with the database using stored procedures.
Overall, I am not afraid of new challenges and if I need I'll learn new technologies.
Thank you once again
|
|
|
|
|
I would recommend LINQ to SQL. You can build a conceptual model with L2S, then add stored procedures that return objects from your model. You are still able to use SPs, but you are still able to strongly typed objects rather than data sets. L2S is not slow if you use it for what it is...an ORM. The SQL generated by L2S is actually very efficient. If you use it with procs, you won't really see any of the performance benefits...but, neither will you run into anything that could cause performance problems either (i.e. working with huge object graphs and their changes, which can get kind of hairy).
Entity Framework is premature. It has potential, but its up to Microsoft to realize that potential. Currently, EF is very intrusive and heavy. It will work great for non-distributed apps where the clien app is not separated from its business by web services or remoting. However, if there are web services separating your presentation from your domain, then EF is a real disaster.
There is another free ORM, called nHibernate. It came from the Java world, so it doesn't fit well with Microsoft standards, but it is one of the better ORM's out there. It still has some of the problems that EF does as it is a bit intrusive, however it does generally support POCO and PI, so its currently a better choice than EF if you want a real ORM.
Since you are currently looking to use stored procs, I would defintly go with L2S. Its the simplest solution that will get you the quickest results with procs.
|
|
|
|
|
Ok, thx for your advice.
I'll try to learn LINQ to SQL.
|
|
|
|
|