Thanx! It works perfectly now (you immediately see the result). So for all who want to change the desktopwallpaper, the "final" code is: [DllImport("user32.dll")] public static extern bool SystemParametersInfo (uint uiAction, uint uiParam, string pvParam, uint fWinIni); ReturnValue=SystemParametersInfo(0x0014,0,"FILENAME",0x0002); Mario
Mario12345
Posts
-
How to change the desktopwallpaper -
How to change the desktopwallpaperHelp! I got stuck at the moment. First I tried to change the registry value with: RegistryKey key = Registry.CurrentUser.OpenSubKey( "Control Panel\\Desktop" ); if (key==null) listBox1.Items.Add("--- Key not there!"); else { listBox1.Items.Add(key.GetValue("Wallpaper")); key.SetValue("Wallpaper","C:\\test.bmp"); } With GetValue I get the correct actual Wallpaper-filename, but when trying to write with SetValue I get a System.UnauthorizedAccessException "Cannot write to the registry key" ---------------------------------------- Then I tried to call the Windows API function with: [DllImport("user32.dll")] public static extern bool SystemParametersInfo (long uiAction, long uiParam, string pvParam, long fWinIni); (..) bool ReturnValue=false; ReturnValue=SystemParametersInfo(0x0014,0,"C:\\test.bmp",0x0002); After the call, the ReturnValue is true and the screen updates (flashes). But the desktop-wallpaper is still the same. The Bitmap "C:\\test.bmp" exists Any idea? Mario :confused:
-
How to change the desktopwallpaperHello! How can I change my Windows Desktopwallpaper in C#? I need to see the result at once, so an refresh or so could also be nessesary, I don't know Thanx for any help Mario
-
Display Text/Dynamic Icons in System Tray?Hello. Solved it with: // Create Bitmap Bitmap TestBitmap = new Bitmap(16,16,PixelFormat.Format32bppArgb); // Draw whatever you want for (int i=0; i<16; i++) TestBitmap.SetPixel(i,i,Color.Red); // Show as Icon IntPtr PtrIcon = TestBitmap.GetHicon(); this.MyTrayIcon.Icon = Icon.FromHandle(PtrIcon); MyTrayIcon is a "NotifyIcon", Other PixelFormat may be better, This is just a code-snipped... Mario
-
Display Text/Dynamic Icons in System Tray?Hello! I would like to display some little information (numbers to be exactly) in the system tray. I tried successfully to display an Icon there (NotifyIcon), but this is of course static. Is it possible to display Text/numbers in the tray? When it is not, are there possibilities to dynamically create/draw icons at runtime to display them? Thanx for any help Mario
-
Visual C# .NET Standard edition - missing featuresHello! I'm a computer science student and want to start coding with Visual Studio .Net in C#. As I want to use my Apps commercially, the Student-licence doesn't seem to be usefull for me. On the other hand I doesn't have the money to buy the professional version of .NET. And I don't nedd any Server things or other languages than C#. So The Visual C# .NET Standard edition seems to be the right thing for me. So I looked at the comparison-table at http://msdn.microsoft.com/vcsharp/howtobuy/choosing.asp and there it says, that NOT supported are: -Class Libraries Create reusable class library components using the Class Library template Does that mean, I cannot program class libraries?!? Or is only the template missing? -Windows Control Libraries Construct custom user interface controls for Windows Forms using the Windows Control Library template. The same question: Does that mean, I cannot program custom control libraries, or is only the template missing? If you have any serious warnings NOT to buy this edition, please let me know. Mario
-
.NET or C++/MFC?Good hint- Thanx. Maybe I'll call ngen on all my assemblies first to speed up the whole thing. On todays PCs a "normal" App (no big calculations etc.) should work, I think. And as I learned how to import extern dlls today - there doesn't seem to be any big restrictions left. Hopefully the C#-community will get as big as the MFC-Scene is today - that helps a lot on solving problems. Mario
-
.NET or C++/MFC?OK, thats absolutely right. Now here's the big but: Time. I think I've to decide which language to use (which Package I buy for my own). Maybe I continue with C++/MFC, because as my projects may get bigger, I don't want to hit on any limits and then rewrite the whole stuff in another language/environment.
-
.NET or C++/MFC?I just got started writing Windows-Apps in C++ and C#. The .Net concept seems to me much easier, exspecially because it has a "real & full" object oriented structure and not that confusing ResourceFile-concept of MFC. If I use a button, I can see how it is instantiated, properties are set etc. As a bottom up C++ Learner it is somehow confusing to me, to describe Buttons etc. in Resourcefiles instead of coding them into real c++ sourcecode. The big disadvantage I see at the moment is, that even if you want to distribute a small Tool, you force the user to install the whole .NET framework. But maybe in some months, nearly every Windows-System will have this Framework already installed. My Question is now: As a Newbie, should I better continue writing in C# or C++/MFC? And in this context, is it possible to use some more "advanced" features in .Net like playing sounds, use external dlls (lame, zip etc.) or accessing the serial port for example? Thanx for your opinions Mario