Generating a unique machine id

I had the same problem and after a little research I decided the best would be to read MachineGuid in registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography, as @Agnus suggested. It is generated during OS installation and won’t change unless you make another fresh OS install. Depending on the OS version it may contain the network adapter MAC address … Read more

Windows threading: _beginthread vs _beginthreadex vs CreateThread C++

CreateThread() is a raw Win32 API call for creating another thread of control at the kernel level. _beginthread() & _beginthreadex() are C runtime library calls that call CreateThread() behind the scenes. Once CreateThread() has returned, _beginthread/ex() takes care of additional bookkeeping to make the C runtime library usable & consistent in the new thread. In … Read more

Using SetWindowPos with multiple monitors

System Displays disposition and VirtualScreen In a Windows System, the Primary Screen (programming perspective) is the Display device which has its upper left corner position set at Point(0,0). This implies that the Displays positioned on the left of the Primary Screen, will have negative X coordinates (the Y coordinate could be negative if the Display … Read more

How to provide user name and password when connecting to a network share

I liked Mark Brackett‘s answer so much that I did my own quick implementation. Here it is if anyone else needs it in a hurry: public class NetworkConnection : IDisposable { string _networkName; public NetworkConnection(string networkName, NetworkCredential credentials) { _networkName = networkName; var netResource = new NetResource() { Scope = ResourceScope.GlobalNetwork, ResourceType = ResourceType.Disk, DisplayType … Read more

Getting CURRENT path to own executable (C++)

GetFileInformationByHandleEx with option FileNameInfo returns the current path, sans the drive designator, on the current device, when the running executable is moved within that device. To use this you apparently need to have opened the file for reading at program start up (before it’s moved). To get the executable’s path at startup you can use … Read more

Programmable router

If you only want to monitor your network then investigate and learn how to use WireShark. If you want to take the long and much harder route of making a proxy server, use a squid proxy. It runs on a Linux server and you can get a lot of user friendly GUI’s. Plus there are … Read more