Pages

Showing posts with label windows. Show all posts
Showing posts with label windows. Show all posts

Tuesday, August 17, 2010

4 ways to close an application

I knew these ways
  1. Clicking on the upper-right button aka the X button
  2. Alt + F4
  3. Selecting  the Close command from the system menu (the upper-left icon on a window)
And I just found out a fourth way, after so many years of using Windows.
By double clicking the upper-left icon you execute the default command, which is the Close command.

Hooray!

Sunday, July 4, 2010

Windows, slash or backslash?

In case you didn't know, Windows API accepts both the slash / and backslash \ as path name delimiters.

When I hard code file names, I always use the slash / to avoid doubling (escaping) the backslash. The latter style looks a bit ugly in my opinion.

Sunday, April 11, 2010

Compile Qt libraries for static linking

Here I describe a Qt4 setup for static linking the libraries in order to
distribute executables on Windows platform, with no DLL dependencies.

First of all, download and install the Qt SDK for Windows (LGPL) version,
which is based on MinGW.

Lets say that we install it on K:\Qt.

While developing our applications it's wise to use the shared
(DLL) Qt configuration, because it has faster build time.
Moreover, I won't even configure the static Debug mode because
it produces huge (>100 MB) executables! The static Release mode
is just fine.
(BTW, I switch to static Release mode only if I have to
test it, or, of course, when it's time to release it.)

Make a copy of K:\Qt\2010.02.1\qt
and name it K:\Qt\2010.02.1\qt_static.

Our static configuration takes extra space, but who cares?

Now copy K:\Qt\2010.02.1\bin\qtenv.bat and put it in
K:\Qt\2010.02.1\qt_static as
configure_static.cmd.
Modify it to match the below shell script:

@echo off
set INCLUDE=
set LIB=
set QTDIR=%CD%
set PATH=%CD%\bin
set PATH=%PATH%;%CD%\..\bin;%CD%\..\mingw\bin
set PATH=%PATH%;%SystemRoot%\System32
set QMAKESPEC=win32-g++

configure -release -static -platform win32-g++ -nomake examples -nomake demos -no-exceptions -no-rtti -no-qt3support -no-scripttools -no-openssl -no-opengl -no-webkit -no-phonon -no-style-motif -no-style-cde -no-style-cleanlooks -no-style-plastique -qt-libjpeg -qt-zlib -qt-libpng

echo run "mingw32-make sub-src" to build core Qt libraries only.


Before executing it we need to modify some configuration parameters.
Open K:\Qt\2010.02.1\qt_static\mkspecs\win32-g++\qmake.conf (text file) and edit
QMAKE_CFLAGS_RELEASE = ... to
QMAKE_CFLAGS_RELEASE = -Os -momit-leaf-frame-pointer

Now, open the command line console, jump in qt_static folder and
run configure_static.cmd.

As soon as configure is finished, run mingw32-make sub-src
to build everything except examples and demos. A plain mingw32-make
will build everything, but that would be a waste of our time.

Notes:
References: