Showing posts with label Visual Studio. Show all posts
Showing posts with label Visual Studio. Show all posts

Getting Python 3.6 build tools working on Windows

What an annoying process this has become. Used to be "download this exe, install and carry on".

Didn't bother with Python 3.7 since a lot of libraries were breaking on Linux.

Downloads

Grab Microsoft Visual C++ 14.0 standalone: Build Tools for Visual Studio 2017 (x86, x64, ARM, ARM64).

Setup

  • Run vs_buildtools.exe
  • Wait for it to download a bunch of files for "Visual Studio Installer"
  • Click "Individual components"
  • Select "Compilers, build tools, and runtimes" > "VC++ 2017 version 15.7 v14.14 latest v141 tools" (or whatever is latest)
  • Select "Development activities" > "Visual C++ Build Tools core features"
  • Select "Windows  10 SDK (10.0.17134.0)"
  • Everything else needed will be automatically selected for you.
  • Last chance to change "Installation location" at the bottom
  • Go grab a coffee or tea.

All up it should take about 3.03gb in space.

image

Summary on the side should look something like this

Source

Visual C++: Add Version Number to Your Applications

While in your Resource View, right click and add a new "Version" resource.

image 

There are two "file version" fields. Edit the very first one called "FILEVERSION" as the second one below seems to be ignored altogether.

image 

[ Source ]

Synergy+: How to compile source

Synergy is a very useful utility which links your mouse and keyboard between multiple computers. Each computer still uses its own monitor and can run its own operating system.

Much like how a KVM links a keyboard/mouse between multiple computers, but without the need for wiring or sharing of a monitor.

image 
Image taken from Synergy+ homepage

The original Synergy project has died down, and the original author Chris Schoeneman has not updated it since 2006. Up comes Nick Bolton and Sorin Sbarnea to continue the project in the name of SynergyPlus on GoogleCode.

If you want to help develop this software, just pull the source from http://synergy-plus.googlecode.com/svn/trunk using your favourite SVN client. If that link no longer works, see here and let me know that its changed!

It'll take some time to pull the files out of SVN as there are some executables included (like the Visual C++ redistributable setup).

Once its done:

  • Go to "tool\win\cmake\bin"
  • Run "cmake-gui.exe" (Why the hell is this nearly 8mb?)

image 
CMake GUI

  • For the field "Where is the source code", select the SVN folder you pulled the files to.
  • Create a folder in your SVN folder called "project".
  • Within "project", create another folder called "bin".
  • For "Where to build the binaries", select your new "project" folder.
  • Click "Configure" at the bottom.

This is where you select your preferred IDE. For me, I selected Visual Studio 2005/2008. It may differ for you if you choose something else.

image
Default native compilers seem to work fine for me!

  • Fill in both EXECUTABLE_OUTPUT_PATH and LIBRARY_OUTPUT_PATH as the "bin" folder.
  • Click "Configure" again to remove the red labels.
  • Now "Generate" should be enabled. Click it.

Now you should have the project files ready for development.

image

Once you compile the code, all the binary files will be spat out in the "project\bin" folder.

Source

C++: Dialogs with SysLink control do not show up

For some strange reason, adding a SysLink control onto the dialog during design time would cause DialogBox() to fail with -1.

There are a whole bunch of advice online to get it working, but all of them involve some tinkering with project files and the inclusion of ridiculously cryptic manifest files.

The main reason the Syslink causes the DialogBox() command to fail is because it requires unicode text support, starting from ComCtl32.dll 6.

All the new functionality defined in ComCtl32.dll version 6 supports only Unicode. Therefore, you cannot create ANSI versions of SysLink controls, only Unicode versions.

To get it working (without messsing with project properties and manifest ugly files, include this line into a project header file.

#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' "\
"version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")

Note: This only works with Visual Studio 2005 and onwards.

But don't get comfy with your success, you still have another major puzzle to solve...

FunkyForest
Can you ever figure out... JAPAN? Seriously, wtf?

To handle the link click event, see this post.

[ Syslink Control Overview, Enabling Visual Styles ]

Windows: Regain disk space on C drive with some uncommon methods

I admit I've been lazy and slacking on the computer maintenance side of things lately (which translates to a few years). As a result, things have cluttered up and I'm starting to constantly run low on C:.

I do however perform the usual trimming of the temp folders and restore points, which usually do the trick. I find programs that clear the browser cache to be stupid because the files are eventually redownloaded again when you browse.

So I resorted to TuneUp Utilities' Disk Space Explorer which is a bloody brilliant computer maintenance suite. The Disk Space Explorer is a nice tool that lets you see what folders/files are hogging up space on your computer.

Adobe Acrobat 9

First on the list, and somehow unsurprisingly, Adobe Acrobat. Delete the stupid installer cache files, with half the files in languages I cant even read!

Shaved: 1.22gb.

Windows Installer Cache

Much like the the previous program, incomplete or unsuccessful installations may leave horrendous cache files on your computer.

Use the Windows Installer Cleanup Utility (which is basically MSI Zap with a nice frontend) to remove the files in a safer manner. Just be careful with it. Its sort of like a big hammer so if you go apeshit with it, something will break.

Some programs will have broken shortcuts after this is run. Just edit the shortcut and set a target, or recreate a shortcut that runs the appropriate executable.

It also removes the install logs, which makes it impossible to uninstall the software. Just be sure you want to keep it ;)

Shaved: 2.16gb to 793mb (and thats just by removing Visual Studio 2005!)

ACDSee Catalogue Database

You may have noticed that I use alot of "strange images" in my posts. I'm a massive image hoarder, and that causes my image manager to suffer.

Remember to clean your ACDSee catalogue database!

Shaved: 1.6gb to 860mb.

NOD32 Antivirus Quarantine

The quarantine will store a copy of all infected files, including the gigantic (and infected) setup files that you might of grabbed off torrents.

Go to "Tools" > "Quarantine" and remove any files you know you wont need. Its a shame you cant sort by file size.

Shaved: 530mb to 5.38mb.

Compact Thunderbird POP3 Accounts

IMAP accounts will just download content from the servers when needed, but POP3 will store a copy of the email even after you've deleted it.

To delete the unecessary emails, clear your folders (inbox, sent, etc) and then delete them again from the trash folder. Now select your account, go to "File" > "Compact Folders".

Depending on how much crap you deleted, this may take some time. The first time I discovered this functionality, I saved over 1.2gb of space! Now I do this quite often, so I didn't save as much space.

Shaved: 1.66gb to 1.63gb.

Compact VMWare Virtual Hard Drives

All your VM machines need some loving too. See here to find out how to compact the virtual disks.

This will take quite some time, and the space saved will really depend on how much you use the virtual machines. While you're waiting, you can do the next part.

Vista was disgustingly slow and took the longest to shrink by far. Its ridiculous, because there wasn't even anything installed on the damn image and it took longer than overnight to complete! Vista went from being 6.59gb to 7.9gb. WTF?

Shaved: 60.3gb to 55.19gb

Clean Up Your Mess

You always have the feeling that one day, some point in your life you're gonna have to clean your room. Same deal with your downloads folder, one day you're gonna have to clean it out and remove those duplicate downloads.

Eclipse Workspace History

See here to reduce the size of your Eclipse workspace folder by deleting the local history. The local history is a backup copy of anything you save.

Clearing this also seems to speed up your Eclipse loading times.

Shaved: 943mb

Visual Studio: View Exported DLL functions

Visual Studio comes with a crapload of tools, but most of which wont ever be used.

However, "dumpbin" is quite handy if you want to quickly see what functions are exported from a DLL file.

Fire up the Visual Studio Command Prompt and navigate to your DLL file. Then type:

dumpbin /exports Test.dll

Whalla, the function names should be listed below.

Visual Studio: Debug with trace logs to the Output window in C++

If you need to debug a loop or some sort of Window callback, its ridiculously difficult to use breakpoints.

Instead, we can use some formatted output to the debug "Output" window that'll provide us with some handy information.

First, import <crtdbg.h>. This now gives you access to the macros _RPT(), _RPTF(), _RPTW() and _RPTFW(). All of these functions have a similar signature of (reportType, format, [args]).

Each function can also take up to 4 arguments. Simply append a number of 0-4 after the function name to allow for that many number of args. The functions with "W" support wide characters (unicode).

#include <crtdbg.h>

for (int x = 0; x < 10; x++) {
    _RPT1(_CRT_WARN, "x = %d\n", x);
    //_RPTW1(_CRT_WARN, L"Unicode x = %d\n", x);
}

Will give you this output:

image 

Amazingly helpful and simple, but bloody damn hard to find the exact information online.

[ Source ]

Visual Studio 2005/2008: How to compile C++ in 64 bit

When starting with a new project, sometimes it is helpful to keep x64 in mind from the very beginning.

  • From the "Build" menu, select "Configuration Manager".
  • Under the "Active Solution Platform", select "<New...>".
  • Select "x64" from the new platform type.
    (If it is not available, you need to modify your VS2005/VS2008 installation by inserting the DVD and selecting x64 compiler under C++)
  • Copy settings from "Win32".
  • Ensure that the "Create new project platforms" checkbox is ticked.
  • OK to save.

Now in your main window, select between x86 and x64 by changing the selection in the dropdown.

imageThats all there is to it!

Visual Studio 2008: Microsoft Incremental Linker is buggy

Visual Studio's C++ linker is a piece of shit, or at least it is on Vista/Win7. I've been playing around with it for creating x64 apps and as LStucki mentioned, it doesn't seem like Microsoft is eating their own dog food very much.

A temporary fix for this would be to disable the embedded manifest.

  1. Project
  2. Properties
  3. Configuration Properties
  4. Manifest Tool
  5. Input and Output

Set "Embed Manifest" to "No".

Props to Juan Baez (Tux`) for that!

Uninstalling Visual Studio 2003

I know I know, its ancient...

But I've finally decided to let go of it now that its been superseded by not just one, but TWO newer editions of Visual Studio.

Unsurprisingly, the uninstaller didn't work. So, I had to snoop around my computer looking for things that may work.

Luckily, the uninstaller was there all along. Its just that the uninstall file used by "Add/Remove Programs" wasn't the right.

To uninstall this historic piece of software, go to "C:\Program Files\***Visual Studio .NET 2003 Folder***\Visual Studio .NET ***Installed Edition***" and run "setup.exe"

Mine happen to be:
"C:\Program Files\Microsoft Visual Studio .NET 2003\Visual Studio .NET Enterprise Architect 2003 - English"

It should take a few minutes to uninstall, so you'll have plenty of time to wipe your tears while the ashes are thrown into the sea.

 
Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog