Thursday, October 28, 2010

Windows 7 - Enabling Recent Items

http://social.answers.microsoft.com/Forums/en-US/w7files/thread/09a26880-f143-4e5e-b97b-1bef8507582f

Doesn't seem to be enabled by default.

Right click the 'Taskbar', click 'Properties' > select the 'Start Menu' tab > click 'Customize' > in the dialog displayed, check off the appropriate menu link, 'Recent Items'

Office Communicator

Nice little application.  However, the menus are hidden in the top left corner of the windows.


Friday, October 8, 2010

sfk (Swiss File Knife)

http://stahlworks.com/dev/swiss-file-knife.html

Used for removing or adding DOS CRs.  

DOS (Disk Operating System)
CR (carriage return)

Wednesday, October 6, 2010

MS Suite Against Motorola for Android Phones


http://www.linux-mag.com/id/7877?hq_e=el&hq_m=1086407&hq_l=4&hq_v=67baeaf602

Remember Luke telling Yoda he's not afraid and Yoda saying 'But you will be!"  Buried at the bottom of the article is MS suite again Motorola.  The patents being using to sue are very general and could be applied to any Android device.  Thank you MS.  You can't create a decent phone of you own, so kill the competition in court.  This could be a real problem if MS has success with even one of these patents.  Maybe the EU should step in again.


Wednesday, September 15, 2010

MSBuild Command Line Reference

http://msdn.microsoft.com/en-us/library/ms164311.aspx

SYSTEMTIME Structure

 http://msdn.microsoft.com/en-us/library/ms724950(VS.85).aspx
 typedef struct _SYSTEMTIME {   WORD wYear;   WORD wMonth;   WORD wDayOfWeek;   WORD wDay;   WORD wHour;   WORD wMinute;   WORD wSecond;   WORD wMilliseconds; } SYSTEMTIME, *PSYSTEMTIME;
 

fmod

http://www.cplusplus.com/reference/clibrary/cmath/fmod/

     double fmod (      double numerator,      double denominator );       float fmod (       float numerator,       float denominator ); long double fmod ( long double numerator, long double denominator );
 

COleDatTime::COleDateTime

For older unmanaged code this handles the DATE type.



 COleDateTime( ) throw( );  COleDateTime(    const VARIANT& varSrc  ) throw( ); COleDateTime(    DATE dtSrc  ) throw( ); COleDateTime(    time_t timeSrc  ) throw( ); COleDateTime(    __time64_t timeSrc  ) throw( ); COleDateTime(    const SYSTEMTIME& systimeSrc  ) throw( ); COleDateTime(    const FILETIME& filetimeSrc  ) throw( ); COleDateTime(    int nYear,    int nMonth,    int nDay,    int nHour,    int nMin,    int nSec  ) throw( ); COleDateTime(    WORD wDosDate,    WORD wDosTime  ) throw( ); COleDateTime(       const DBTIMESTAMP& dbts ) throw();
 

Re: Time DBTIMESTAMP

 http://msdn.microsoft.com/en-us/library/c3zzz087(v=VS.80).aspx
 Function for getting the DBTIMESTAMP.
 bool GetAsDBTIMESTAMP(       DBTIMESTAMP& dbts ) const throw();

On Wed, Sep 15, 2010 at 9:41 AM, Stan Hughes <hughes.stan@gmail.com> wrote:

The fraction time is from 0 to 999,999,999.

Not really sure what good this does since you can only get it for the current time and any translation of time rounds to the nearest second.

DBTIMESTAMP

The DBTIMESTAMP structure typedef is defined as follows:

 typedef struct tagDBTIMESTAMP {     SHORT  year;     USHORT month;     USHORT day;     USHORT hour;     USHORT minute;     USHORT second;     ULONG  fraction } DBTIMESTAMP; 

Members

year
The year (0 to 9999) is measured from 0 A.D.
month
The month ranges from 1 to 12 representing January through December.
day
The day ranges from 1 to a maximum of 31, depending on the number of days in the month.
hour
The hour ranges from 0 to 23.
minute
The minute ranges from 0 to 59.
second
The second ranges from 0 to 59.
fraction
The fraction represents billionths of a second ranging from 0 to 999,999,999.

Time DBTIMESTAMP


The fraction time is from 0 to 999,999,999.

Not really sure what good this does since you can only get it for the current time and any translation of time rounds to the nearest second.

DBTIMESTAMP

The DBTIMESTAMP structure typedef is defined as follows:

 typedef struct tagDBTIMESTAMP {     SHORT  year;     USHORT month;     USHORT day;     USHORT hour;     USHORT minute;     USHORT second;     ULONG  fraction } DBTIMESTAMP; 

Members

year
The year (0 to 9999) is measured from 0 A.D.
month
The month ranges from 1 to 12 representing January through December.
day
The day ranges from 1 to a maximum of 31, depending on the number of days in the month.
hour
The hour ranges from 0 to 23.
minute
The minute ranges from 0 to 59.
second
The second ranges from 0 to 59.
fraction
The fraction represents billionths of a second ranging from 0 to 999,999,999.

Tuesday, September 7, 2010

DATE Delta

#include <FLOAT.H> // for the FLT_EPSILON unmanaged code

DATE date1;
DATE date2;

DATE dEpsilon = date1 - date2;

if (dEpsilon > FLT_EPSILON)
{
   COleDateTime clTempEpsilon (depsilon);
   CString strEpsilon = clTempEpsilon.Format("%H:%M:%S %m/%d%Y");
   TRACE (strEpsilon);
}

OLE Date/Time

http://www.newobjects.com/pages/ndl/SQLite2\SQL-OleDate.htm

Related to SQL.

Starts from 30 December 1899 00:00:00


It would seem that the newer, OLD DB Date/Time, SQL Server 2008 R2, support milliseconds.

'yyyy-mm-dd hh:mm:ss[.999]

The time structure is has greater resolution:

'hh:mm:ss[.9999999]


Time Management, Conversion of system time to CTime


CTime Class

8 bytes, with an upper limit of January 18, 2038.


Time Management

#define _BASE_YEAR 70L /* 1970 is the base year */
#define _MAX_YEAR 138: /* 2038 is the max year */

Note that the _make__time64_t() function insist that the year is between 1969 and 2038.  If it is not a error value of 22 is set and a value of -1 is returned.

This is slight inconsistent with the behavior of CTime which set the time to 1970 is the time is earlier than 1900 and than creates the CTime from system time with no error.

This is a know bug.

atltime.inl

if (sysTime.wYear < 1900)
{
   __time64_t time0 = 0L;
   CTime timeT(time0);
   ...
}
else
{
   CTime timeT(
      (int) sysTime.wYear, (int)sysTime,wMonth, (int) sysTime.wDay,
      (int) sysTime.wHour, (int)sysTime.wMinute, (int) sysTime,wSecond,
      nDST);
   ...
}

The SYSTEMTIME structure does have milliseconds, but it is not used by CTime.

::VariantTimeToSystemTime() also seem to be dropping the milliseconds.

Friday, September 3, 2010

Registering and Unregistering COM DLLs

http://support.microsoft.com/kb/249873

Regsvr32.exe usage

RegSvr32.exe has the following command-line options:
Regsvr32 [/u] [/n] [/i[:cmdline]] dllname

/u - Unregister server 
/i - Call DllInstall passing it an optional [cmdline]; when used with /u calls dll uninstall 
/n - do not call DllRegisterServer; this option must be used with /i 
/s – Silent; display no message boxes (added with Windows XP and Windows Vista)
When you use Regsvr32.exe, it attempts to load the component and call its DLLSelfRegister function. If this attempt is successful, Regsvr32.exe displays a dialog box that indicates success. If the attempt is unsuccessful, Regsvr32.exe returns an error message. This may include a Win32 error code. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
193625  WinInet error codes (12001 through 12156)
For example, to manually register a Sample.ocx ActiveX control, type the following command at command prompt:
c:\regsvr32.exe sample.ocx

Tuesday, August 31, 2010

CArray Members

http://msdn.microsoft.com/en-us/library/7y7b8fx3.aspx

GetCount, GetSize, GetUpperBound seem to be all the same.

CString Methods at MSDN

http://msdn.microsoft.com/ja-jp/library/ms908314.aspx

Can use 'Find' to find a sub string in another string.


Copying a BSTR to a CString.

Note that the BSTR must be converted to a _bstr_t first.  If this is not done you only get the first character of the BSTR in the new CString.

 BSTR GetBSTR() {     _bstr_t bstr1(_T("This is the test string."));          BSTR bstr;      bstr = bstr1.copy();      return bstr; }     CComBSTR GetComBSTR() {     CComBSTR bstr("This is the test string.");      return bstr; }   void CVbsDlg::ShowBSTR(BSTR bstr) {     _bstr_t bstrStart(bstr);           CString s;      s.Format(_T("%s"), (LPCTSTR)bstrStart);      AfxMessageBox(s);  } 

COleDateTime:: Format

http://msdn.microsoft.com/en-us/library/bab3feb1(VS.80).aspx

The lowest resolution of the formating is in seconds.


DATE Description and Use


This is a 8-byte floating-point number.  Days are represented by whole number increments starting with 30 December 1899.

0.00 is 20 Dec 1899, midnight
-1.00 is 29 December 1899, midnight
5.50 is 4 January 1900, noon.



For comparing two dates:

if ((date2 - date1)  < FLT_EPSILON)
{
      printf("same date");
}

FLT_EPSILON is defined in the LIMITS.H include file for .NET. 

Defined in FLOAT.H for unmanaged code.



Wednesday, August 18, 2010

Server Message Block (SMB)

http://en.wikipedia.org/wiki/Server_Message_Block

An application network protocol known as "Microsoft Windows Network" in Windows systems.

Implemented by Samba on Linux systems and other Unix like systems.

Also called Common Internet File System (CIFS).

Wednesday, July 14, 2010

Tuesday, July 13, 2010

VS 2010 MSTest for Unmanaged Projects

Bottom line:  MSTest isn't designed for unmanaged or untrusted code.  No big surprise there.  It seems it can be used to test unmanaged code indirectly through a manage code project shim.

There are some links I found what gleaning that bit of information.  Most of this was not obtained from the MS site.  With them there is no discussion of managed versus unmanaged, because in their world no unmanaged code exists :-) 

MSDN download page for VS 2010:  http://msdn.microsoft.com/en-us/vstudio/bb984878.aspx  


Although this has nothing to do with unmanaged code, here is an example of using MSTest and NUnit together:  http://alsagile.com/archive/2010/03/09/stop-the-war-between-nunit-and-mstest-make-them.aspx


A discussion where MSTest is not recommended for unmanaged code and GTest is:  http://stackoverflow.com/questions/1392305/mstest-for-huge-legacy-codebase

And example of calling MSTest from the command line for several test projects:  http://stackoverflow.com/questions/3236268/mstest-msbuild-many-test-projects




Gallio, third party software for testing:  http://www.gallio.org/

Testing working in IDE but not from command line:  http://coderesource.org/messages-7-286282-c++-mstest_for_huge_legacy_codebase



Friday, July 9, 2010

Resetting Language Environment in VS 2008

This is done from the command line:

> DevEnv /resetuserdata

Your can than reselect the environment you want to use.



Monday, July 5, 2010

UAC - User Account Control

The Android permission security mechanism is not suppose to be as big of a pain in the neck as the Vista UAC.  Both let the user decide what risks they are willing to take.

UAC compared with Android premissions:  http://blogoscoped.com/archive/2008-12-15-n14.html

How to tweak UAC setting in Vista:  http://www.tweak-uac.com/what-is-uac/

This contains a nice description of UAC with a really cool parable or allegory:  http://netsecurity.about.com/od/quicktips/qt/UAC.htm

Wednesday, June 30, 2010

Using MSBUILD and DEVENV to Clean

http://msdn.microsoft.com/en-us/library/5ak1w89s%28VS.80%29.aspx

devenv /clean Debug Solution.sln

One can also specify the project and project configuration.

Can also run the application after it is built.




Wednesday, June 23, 2010

Setting a Property in MSBUILD

Build a debug:

C:\>msbuild BuildAll.proj /property:Configuration="Debug"

Build a release:

C:\>msbuild BuildAll.proj /property:Configuration="Release"

Build for a given target:

C:\>msbuild BuildAll.proj /property:Configuration="Release" /t:TargetName

Tuesday, June 22, 2010

How to Set Properties Sheet in VS 2010

This took me a while to figure out.

First you need to be able to look at the property sheets.  They are ASCII files so you can look at them with an editor.  They have the file extension 'props'.

To access in VS 2010, select View ==> Property Manager option.

The property manager contains a list of projects.  Select the project you want to add a new or existing property sheet.  Right click on the project to see the options.  Adding are creating, puts the sheet in both debug and Release configurations.

Right click the property page and the property page will appear.  Select the User Macros property.  This displays a pane where you can add or remove macros.  The macro is added under both debug and release.




How to Ignore an Exception in C++

try
{
    // try something that might throw an exception here.
}
catch (...)
{
   // exception will be caught but ignored.
}

Monday, June 21, 2010

msvcprtd.lib(MSVCP100D.dll) : error LNK2005: already defined in gtestd.lib(gtest.obj)

This error occurs when the C/C++ Code Generation Runtime Library in gtest is defined differently from testing code using it.  The gtest project was defined as MTd (Multi-threaded Debug) and the testing project defined as MDd (Multi-threaded DLL).

Fix:  Changed the testing project to use MTd.  From the Property Pages select Configuration Properties ==> C/C++ ==> Code Generation ==> Runtime Library ==> Multi-threaded (/MT).

Tuesday, June 8, 2010

Keyboard and Mouse Sharing

Can be done with Synergy and Synergy+ in the open source area.  Can be done with done with Multiplicity and ZoneScreen if you want to buy the application.  Synergy will work across Linux and Windows.  Multiplicity and ZoneScreen only seem to work with Windows but is much more capable.  This is a nice site that shows the alternatives.

Monday, May 31, 2010

Keyboard Shortcuts for Windows

http://support.microsoft.com/kb/126449

Windows system key combinations

  • F1: Help
  • CTRL+ESC: Open Start menu
  • ALT+TAB: Switch between open programs
  • ALT+F4: Quit program
  • SHIFT+DELETE: Delete item permanently
  • Windows Logo+L: Lock the computer (without using CTRL+ALT+DELETE)

Windows program key combinations

  • CTRL+C: Copy
  • CTRL+X: Cut
  • CTRL+V: Paste
  • CTRL+Z: Undo
  • CTRL+B: Bold
  • CTRL+U: Underline
  • CTRL+I: Italic

Mouse click/keyboard modifier combinations for shell objects

  • SHIFT+right click: Displays a shortcut menu containing alternative commands
  • SHIFT+double click: Runs the alternate default command (the second item on the menu)
  • ALT+double click: Displays properties
  • SHIFT+DELETE: Deletes an item immediately without placing it in the Recycle Bin

General keyboard-only commands

  • F1: Starts Windows Help
  • F10: Activates menu bar options
  • SHIFT+F10 Opens a shortcut menu for the selected item (this is the same as right-clicking an object
  • CTRL+ESC: Opens the Start menu (use the ARROW keys to select an item)
  • CTRL+ESC or ESC: Selects the Start button (press TAB to select the taskbar, or press SHIFT+F10 for a context menu)
  • CTRL+SHIFT+ESC: Opens Windows Task Manager
  • ALT+DOWN ARROW: Opens a drop-down list box
  • ALT+TAB: Switch to another running program (hold down the ALT key and then press the TAB key to view the task-switching window)
  • SHIFT: Press and hold down the SHIFT key while you insert a CD-ROM to bypass the automatic-run feature
  • ALT+SPACE: Displays the main window's System menu (from the System menu, you can restore, move, resize, minimize, maximize, or close the window)
  • ALT+- (ALT+hyphen): Displays the Multiple Document Interface (MDI) child window's System menu (from the MDI child window's System menu, you can restore, move, resize, minimize, maximize, or close the child window)
  • CTRL+TAB: Switch to the next child window of a Multiple Document Interface (MDI) program
  • ALT+underlined letter in menu: Opens the menu
  • ALT+F4: Closes the current window
  • CTRL+F4: Closes the current Multiple Document Interface (MDI) window
  • ALT+F6: Switch between multiple windows in the same program (for example, when the Notepad Find dialog box is displayed, ALT+F6 switches between the Find dialog box and the main Notepad window)

Shell objects and general folder/Windows Explorer shortcuts

For a selected object:
  • F2: Rename object
  • F3: Find all files
  • CTRL+X: Cut
  • CTRL+C: Copy
  • CTRL+V: Paste
  • SHIFT+DELETE: Delete selection immediately, without moving the item to the Recycle Bin
  • ALT+ENTER: Open the properties for the selected object

To copy a file

Press and hold down the CTRL key while you drag the file to another folder.

To create a shortcut

Press and hold down CTRL+SHIFT while you drag a file to the desktop or a folder.

General folder/shortcut control

  • F4: Selects the Go To A Different Folder box and moves down the entries in the box (if the toolbar is active in Windows Explorer)
  • F5: Refreshes the current window.
  • F6: Moves among panes in Windows Explorer
  • CTRL+G: Opens the Go To Folder tool (in Windows 95 Windows Explorer only)
  • CTRL+Z: Undo the last command
  • CTRL+A: Select all the items in the current window
  • BACKSPACE: Switch to the parent folder
  • SHIFT+click+Close button: For folders, close the current folder plus all parent folders

Windows Explorer tree control

  • Numeric Keypad *: Expands everything under the current selection
  • Numeric Keypad +: Expands the current selection
  • Numeric Keypad -: Collapses the current selection.
  • RIGHT ARROW: Expands the current selection if it is not expanded, otherwise goes to the first child
  • LEFT ARROW: Collapses the current selection if it is expanded, otherwise goes to the parent

Properties control

  • CTRL+TAB/CTRL+SHIFT+TAB: Move through the property tabs

Accessibility shortcuts

  • Press SHIFT five times: Toggles StickyKeys on and off
  • Press down and hold the right SHIFT key for eight seconds: Toggles FilterKeys on and off
  • Press down and hold the NUM LOCK key for five seconds: Toggles ToggleKeys on and off
  • Left ALT+left SHIFT+NUM LOCK: Toggles MouseKeys on and off
  • Left ALT+left SHIFT+PRINT SCREEN: Toggles high contrast on and off

Microsoft Natural Keyboard keys

  • Windows Logo: Start menu
  • Windows Logo+R: Run dialog box
  • Windows Logo+M: Minimize all
  • SHIFT+Windows Logo+M: Undo minimize all
  • Windows Logo+F1: Help
  • Windows Logo+E: Windows Explorer
  • Windows Logo+F: Find files or folders
  • Windows Logo+D: Minimizes all open windows and displays the desktop
  • CTRL+Windows Logo+F: Find computer
  • CTRL+Windows Logo+TAB: Moves focus from Start, to the Quick Launch toolbar, to the system tray (use RIGHT ARROW or LEFT ARROW to move focus to items on the Quick Launch toolbar and the system tray)
  • Windows Logo+TAB: Cycle through taskbar buttons
  • Windows Logo+Break: System Properties dialog box
  • Application key: Displays a shortcut menu for the selected item

Microsoft Natural Keyboard with IntelliType software installed

  • Windows Logo+L: Log off Windows
  • Windows Logo+P: Starts Print Manager
  • Windows Logo+C: Opens Control Panel
  • Windows Logo+V: Starts Clipboard
  • Windows Logo+K: Opens Keyboard Properties dialog box
  • Windows Logo+I: Opens Mouse Properties dialog box
  • Windows Logo+A: Starts Accessibility Options (if installed)
  • Windows Logo+SPACEBAR: Displays the list of Microsoft IntelliType shortcut keys
  • Windows Logo+S: Toggles CAPS LOCK on and off

Dialog box keyboard commands

  • TAB: Move to the next control in the dialog box
  • SHIFT+TAB: Move to the previous control in the dialog box
  • SPACEBAR: If the current control is a button, this clicks the button. If the current control is a check box, this toggles the check box. If the current control is an option, this selects the option.
  • ENTER: Equivalent to clicking the selected button (the button with the outline)
  • ESC: Equivalent to clicking the Cancel button
  • ALT+underlined letter in dialog box item: Move to the corresponding item

APPLIES TO
  • Windows Server 2008 Datacenter
  • Windows Server 2008 Enterprise
  • Windows Server 2008 Standard
  • Microsoft Windows Server 2003, Datacenter Edition (32-bit x86)
  • Microsoft Windows Server 2003, Enterprise x64 Edition
  • Microsoft Windows Server 2003, Enterprise Edition (32-bit x86)
  • Microsoft Windows Server 2003, Enterprise Edition for Itanium-based Systems
  • Microsoft Windows Server 2003, Standard x64 Edition
  • Microsoft Windows Server 2003, Standard Edition (32-bit x86)
  • Microsoft Windows 2000 Server
  • Microsoft Windows Millennium Edition
  • Microsoft Windows 98 Second Edition
  • Microsoft Windows 98 Standard Edition
  • Microsoft Windows 95
  • Windows Vista Business
  • Windows Vista Enterprise
  • Windows Vista Home Basic
  • Windows Vista Home Premium
  • Windows Vista Starter
  • Windows Vista Ultimate
  • Microsoft Windows XP Home Edition
  • Microsoft Windows XP Professional
  • Microsoft Windows XP Starter Edition
  • Microsoft Windows XP Tablet PC Edition