deskmor.blogg.se

How to write a windows program
How to write a windows program













Or -not recommended, but not as horrible as writing in Program Files- you can create something custom like C:\MyAmazingCompany\logs. So your logs will be in C:\ProgramData\MyAmazingCompany\myamazingproduct.log. CommonApplicationData, which by default is C:\ProgramData. You can do the same as above, but instead of use Environment.SpecialFolder. If it’s a non-interactive software, like a Windows Service: You can get the localappdata path using the following line in Dot Net: If it’s a UI-based software, that your users will use interactively:Ĭreate a directory under %localappdata% (by default C:\Users\SOMEUSER\AppData\Local) with the brand name of your company and/or product, and write in there. There are many, many, MANY libraries to choose from, some of them very mature, like log4net for Dot Net or log4j for Java.īut if you want to keep it very simple, fine. You’re not supposed to tamper with the executables! Unless you’re doing some maintenance or an upgrade of course.įirst of all, it’s a good idea to not reinvent the wheel. Normal users do not have permission to write there an administrator can grant this, but they really really really shouldn’t. But when your customers install the software, the exe usually goes to C:\Program Files (that’s in Windows in Linux there are different possibilities as explained here, but let’s say /usr/bin).















How to write a windows program