Small app: copy a file path to clipboard

02 Apr 2008 | Windows, Software | Comments »


I decided to make a small but useful program with what i’ve learned so far from C and the Windows API.I have used a free version of xplorer² for some time, and i’ve been overusing one small but useful feature in that program, which, in a keystroke, copies the selected file path to the clipboard. I have liked this feature so much I wanted to add that in any file manager as a menu item in the right-click (aka contextual) menu.

So here’s my little app. I didnt named it, really, but let’s call it “File to clipboard”, for simplicity’s sake.

To use it, extract the executable anywhere, i’d recommend into \Program Files\ or \Windows\ . Execute it once directly to install the right-click menu element into the system. From on now, you can right-click any file an select “Copy path to clipboard” to.. surprisingly, copy the whole file path to the clipboard.

Let me rephrase: you only have to execute the program direcly once so you install the right-click menu into the system. Even if you have to execute it only once, it gets executed everytime you use the menu item “Copy path to clipboard”, so do not erase it.

Installation and usage: Download the zip file here, and copy filetocb.exe in a directory of your choice. I recommend Program Files or Windows, as stated above. Execute once to add the right-click menu item, and profit!

Tip: Holding Shift when clicking on “Copy path to clipboard” will instead copy a 8.3 (DOS) formatted path, if available. If there is no 8.3 path, it will revert to the long (standard/default) file path. Either way, an audio dignal (Windows’ “ding!”) will play, indicating you really copied a 8.3 path into the clipboard.

Open source, newbie friendly: in the zip file, there is a folder named “source”, which is my source files used to build filetocb.exe. I have fully documented main.c so if anyone wanted to learn abit how it works, they can do so. There is also a GIMP XCF file, used to make a simple Windows icon for the program.

Windows XP: How to change your network card’s usage priority

19 Feb 2008 | Networking, Windows | Comments »

If you happen to have a desktop or laptop which has more than one network adapter, one for the LAN and the other connected to your modem, Windows may mess up it’s internal routing table and try to reach google.com over your LAN connection.

This mini-howto provides some information about changing your network card’s order (or priority). This is handy to specify on which network connection your programs will go. Be sure to backup on paper everything you change so you can come back to safe defaults in case of troubles.

Open a Run box using the Start menu and clicking Run (this may be quickly reached by typing Win+R, that is, holding the Windows key between Ctrl and Alt and pressing R), and execute ncpa.cpl — which is a quick shortcut to your “Networking neighborhood” ’s Propreties.

Select advanced in the top menu, and choose Advanced Settings. The first list in the first tab (Adapters and bindings) is the actual order of your physical network adapters. That is,   everytime you or some program tries to connect over a network card, it will go thru all those cards (unless specified otherwise) until the destination is reached. You can re-arrange the order by selecting one of the adapters in the list, and clicking on the arrow buttons on the right side. Click OK when done.

If you happen to have disabled the Printing Spooler service, clicking Ok will warn you about not being able to completly do the changes, which is false to some point. Since our objective is to move around the priority of the adapters, this part is actually done BEFORE the error message popping up, so the changes (at least, the parts we’re interested in) are actually done. You may discard the error message and click on Cancel in the adapters window– note that it doesn’t cancel what we’ve done, you may verify if you wish so.

You may try to test your network at this point, but it didn’t made the trick for me. You may ALSO have to change the TCP/IP Routes priority too. Follow these steps, and do not fool around too much, since we can really funk up the system’s networking in there! You’ve been warned ;)

Still in the Network Connections window (the ncpa.cpl window), right click and choose propreties on every network connections than you think it causes troubles. Or, to reverse the problem around, choose Properties on the network connection you want to push up to the first one being used at all times.

In the General tab, select the TCP/IP option in the list and click on Propreties (shortcut: you can also simply double-click on TCP/IP), and click on the Advanced button in the lower part of the General tab. In the IP Parameters Tab, uncheck “Automatic Metric” and in the textbox below, enter a numeric value between 1 and 9999. This value is actually important and deals with the TCP/IP routing priority of the Windows networking. By putting a small value, this network connection will be used first, and with a large value this will be used as later as possible, depending of the others connection’s Metric value.

In other words, your connection attempt will use every connection (shown as connected or not disabled in the Networking window) ordered by the metric value specified here.

General troubleshooting tips/software for Windows

17 Nov 2007 | Windows, Software | 1 Comments »

Some (if not all) of these links can help you alot when debugging a broken Windows installation.

  • Dependency walker: this free program will show you an hierarchical view of dependencies (DLL’s needed, what these DLLs needs in return, etc) for a given program. You can also view the dependencies for a DLL file, an OCX file, and god knows what else. What’s cooler, you can “trap” a program so it runs inside Dependency Walker, so you can view in real time what DLL it needs at a certain point. There may be others features, but I haven’t messed around too much.
  • DLL Help database: Directly from Microsoft, this database lets you search from a file name, from a package name (Like Microsoft .NET Framework), and you can see some basic stats (file size, date, where it came from). Handy when you’re not sure if the DLL’s installed in your system are the good one or some fake installed by a spyware. It would be safe to assume that only Microsoft products are listed in this database.
  • Process Library: Lets you search with an executable filename (like iexplore.exe) and this site will explain where it comes from. Ideal to locate running spyware/trojans or to identify unknown running processes.
  • Process Explorer: This, along with Process Library above, will give you as much information as possible on running applications. Process Explorer is one of the programs created by the guys from SysInternals (which is now part of Microsoft), and is a replacement for the task manager, except that its a task manager on steroids. Just like dependency walker, you can get information about dll’s used, subprocesses running, and you can even see what files, directories and even TCP/IP ports is opened by a program! You can set it so it completly replaces the Windows Task Manager: even if you try to run “taskmgr.exe”, Process explorer will be launched instead. Quick tip: Ctrl+Shift+Escape will launch Task Manager (or Process Explorer if it overrides Task Manager) from anywhere inside Windows. Some programs that tries to block user input like Ctrl+Alt+Del doesnt know about this keyboard shortcut, so this one works 99.9% of the time.

Happy(ier) Windows debugging!

Wordpress theme by Sırrı Özden. All tips and articles contained on this website are put into the public domain.