Tuesday, 13 December 2011

Running our PDF Tool commands on Linux Ubuntu Apache PHP server - PdfPageCount example

e.g. with PdfPageCount   available here: http://www.traction-software.co.uk/servertools/pdfpagecount/index.html

su   to switch to root user

cp PdfPageCount /var/www
cp test5.pdf /var/www
chmod 777 /var/www/*


<?php
echo "<HTML>";

$file = './test5.pdf';
$command = './PdfPageCount ';
$out = shell_exec($command. $file.' > /dev/null; echo $?'  );

echo "Page count: ";
echo $out;

echo "</HTML>";
?>

Ubuntu Root password on install? To enable the Root account (i.e. set a password)

You probably just need to enable Root account

To enable the Root account (i.e. set a password) use:

sudo passwd root

then type: su

to switch to root!

Ubuntu Linux 64bit compile error fix - STT_GNU_IFUNC symbol `strcmp' recompile with -fPIE and relink with -pie

Error:
/usr/bin/ld: dynamic STT_GNU_IFUNC symbol `strcmp' with pointer equality in `./libc.a(strcmp.o)' can not be used when making an executable; recompile with -fPIE and relink with -pie

FIX:-
Ignore -pie comment above, add -static to g++   e.g.


ln `g++ -m64 -print-file-name=libstdc++.a`
ln -s `g++ -m64 -print-file-name=libc.a`

g++ -m64 -static -static-libgcc -L.  exefile.cpp -oexefile







Friday, 9 December 2011

Linux error codes

Appendix D. Exit Codes With Special Meanings


Table D-1. Reserved Exit Codes
Exit Code NumberMeaningExampleComments
1Catchall for general errorslet "var1 = 1/0"Miscellaneous errors, such as "divide by zero" and other impermissible operations
2Misuse of shell builtins (according to Bash documentation)empty_function() {}Seldom seen, usually defaults to exit code 1
126Command invoked cannot execute Permission problem or command is not an executable
127"command not found"illegal_commandPossible problem with $PATH or a typo
128Invalid argument to exitexit 3.14159exit takes only integer args in the range 0 - 255 (see first footnote)
128+nFatal error signal "n"kill -9 $PPID of script$? returns 137 (128 + 9)
130Script terminated by Control-C Control-C is fatal error signal 2, (130 = 128 + 2, see above)
255*Exit status out of rangeexit -1exit takes only integer args in the range 0 - 255
According to the above table, exit codes 1 - 2, 126 - 165, and 255 [1] have special meanings, and should therefore be avoided for user-specified exit parameters. Ending a script with exit 127 would certainly cause confusion when troubleshooting (is the error code a "command not found" or a user-defined one?). However, many scripts use an exit 1 as a general bailout-upon-error. Since exit code 1 signifies so many possible errors, it is not particularly useful in debugging.

There has been an attempt to systematize exit status numbers (see /usr/include/sysexits.h), but this is intended for C and C++ programmers. A similar standard for scripting might be appropriate. The author of this document proposes restricting user-defined exit codes to the range 64 - 113 (in addition to 0, for success), to conform with the C/C++ standard. This would allot 50 valid codes, and make troubleshooting scripts more straightforward. [2] All user-defined exit codes in the accompanying examples to this document conform to this standard, except where overriding circumstances exist, as in Example 9-2.

NoteIssuing a $? from the command-line after a shell script exits gives results consistent with the table above only from the Bash or sh prompt. Running the C-shell or tcsh may give different values in some cases.

Notes

[1]Out of range exit values can result in unexpected exit codes. An exit value greater than 255 returns an exit code modulo 256. For example, exit 3809 gives an exit code of 225 (3809 % 256 = 225).
[2]An update of /usr/include/sysexits.h allocates previously unused exit codes from 64 - 78. It may be anticipated that the range of unallotted exit codes will be further restricted in the future. The author of this document will not do fixups on the scripting examples to conform to the changing standard. This should not cause any problems, since there is no overlap or conflict in usage of exit codes between compiled C/C++ binaries and shell scripts.

Friday, 16 September 2011

CopyFile on 64 bit windows 7 is not copying to system32 folder - fix.

You will find when you copy e.g. CopyFile(c:\\test.txt","c:\\windows\\system32\\test.txt",FALSE);    the operation completes successfully but no file test.txt is in system32 folder,   the system has actually copied it into syswow64 instead!

to get around this disable syswow64 with below code.
DisableWow64FsRedirection(NULL);
CopyFile(c:\\test.txt","c:\\windows\\system32\\test.txt",FALSE);
RevertWow64FsRedirection(NULL);

BOOL DisableWow64FsRedirection(PVOID* OldValue)
{
#ifdef
UNREFERENCED_PARAMETER(OldValue);
WIN64return TRUE;#else
LPWOW64DISABLEWOW64FSREDIRECTION fnWow64DisableWow64FsRedirection;
HMODULE kernelMod;
BOOL success = TRUE;
kernelMod = GetModuleHandleW(L"kernel32");

{
fnWow64DisableWow64FsRedirection = (LPWOW64DISABLEWOW64FSREDIRECTION)GetProcAddress(kernelMod, "Wow64DisableWow64FsRedirection");

success = fnWow64DisableWow64FsRedirection(OldValue);
}
typedef BOOL (WINAPI * LPWOW64DISABLEWOW64FSREDIRECTION)(PVOID *);if (kernelMod)if (fnWow64DisableWow64FsRedirection)return success;#endif}
BOOL RevertWow64FsRedirection(PVOID OldValue)
{
#ifdef
UNREFERENCED_PARAMETER(OldValue);
WIN64return TRUE;#else
LPWOW64REVERTWOW64FSREDIRECTION fnWow64RevertWow64FsRedirection;
HMODULE kernelMod;
BOOL success = TRUE;
kernelMod = GetModuleHandleW(L"kernel32");

{
fnWow64RevertWow64FsRedirection = (LPWOW64REVERTWOW64FSREDIRECTION)GetProcAddress(kernelMod, "Wow64RevertWow64FsRedirection");

success = fnWow64RevertWow64FsRedirection(OldValue);
}
typedef BOOL (WINAPI * LPWOW64REVERTWOW64FSREDIRECTION)(PVOID);if (kernelMod)if (fnWow64RevertWow64FsRedirection)return success;#endif}

Wednesday, 24 August 2011

C++ CListCtrl Image List disapear on click FIX

To fix this problem with the icon vanishing change ILC_COLOR32  to ILC_COLOR24
e.g.
 m_ImageList=new CImageList();
 m_ImageList->Create(32,32,ILC_COLOR24,0,3);
 hIcon1 = hIcon1=AfxGetApp()->LoadIcon(IDI_ICON_CUSTOM_PAL_COLOR);
 c1 = m_ImageList->Add(hIcon1);
 hIcon2=AfxGetApp()->LoadIcon(IDI_ICON_CUSTOM_PAL_GREY);
 c2 = m_ImageList->Add(hIcon2);
 hIcon3=AfxGetApp()->LoadIcon(IDI_ICON_CUSTOM_PAL_MONO);
 c3 = m_ImageList->Add(hIcon3);

Wednesday, 10 August 2011

workaround for C++ clock_gettime gettimeofday tv_usec tv_nsec make rand() srand() MAC OSX Lion / Intel fix

Instead of using gettimeofday or clock_gettime use below:-

#include <mach/mach_time.h>
#include <mach/mach.h>
#include <mach/clock.h>

// OS X does not have clock_gettime, use clock_get_time
clock_serv_t cclock;
mach_timespec_t mts;
host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
clock_get_time(cclock, &mts);
mach_port_deallocate(mach_task_self(), cclock);
ts.tv_sec = mts.tv_sec;
ts.tv_nsec = mts.tv_nsec;

// make unique
srand( (unsigned)time( NULL ) + ts.tv_nsec);
long random = rand()+ ts.tv_nsec

Thursday, 4 August 2011

c++ 'unresolved external symbol __security_cookie '

Long story short, the cause of this error is that /GS switch is a default switch in the compiler shipped with the PSDK.

To fix this problem you need to link your code to bufferoverflowU.lib. This should do it for most of applications out of there.

Just do

cl.exe a.cpp bufferoverflowU.lib

or

link a.obj bufferoverflowU.lib

Thursday, 28 July 2011

Windows Blue screen of death! 0x0000007B message = possible workaround fix

We recently got one of these - can be very fustrating to fix and time consuming.  what we found:-

Scenario:   In windows bootup get blue screen error: 0x0000007B (0xBACC7524, 0x00000034, 0x00000000, 0x00000000)
Get same error when startup in Safe mode with Networking.
Only mode that worked was Safe mode and Safe mode command prompt.

1. check it's not anything in the startup, from dos type: msconfig.exe      and turn off startup programs.

2. try a windows restore checkpoint in Safe Mode

3. restore partition from backup image, when you then first boot after this restore make sure you boot in Safe Mode (THIS IS IMPORTANT), if you see a hardware change message then this is probably the reason why you're having issues booting.   then reboot in normal mode.

How to screen grab/capture on Mac - Keyboard Shortcuts

Keyboard Shortcuts - Screen Capture

  • Command-Shift-3: Take a screenshot of the screen, and save it as a file on the desktop
  • Command-Shift-4, then select an area: Take a screenshot of an area and save it as a file on the desktop
  • Command-Shift-4, then space, then click a window: Take a screenshot of a window and save it as a file on the desktop
  • Command-Control-Shift-3: Take a screenshot of the screen, and save it to the clipboard
  • Command-Control-Shift-4, then select an area: Take a screenshot of an area and save it to the clipboard
  • Command-Control-Shift-4, then space, then click a window: Take a screenshot of a window and save it to the clipboard
In Leopard and later, the following keys can be held down while selecting an area (via Command-Shift-4 or Command-Control-Shift-4):
  • Space, to lock the size of the selected region and instead move it when the mouse moves
  • Shift, to resize only one edge of the selected region
  • Option, to resize the selected region with its center as the anchor point

Tuesday, 19 July 2011

Get File Association in C++ for open and print - directly from shlwapi dll

This is a slick way without the lastest sdk libs and headers by calling the DLL shlwapi directly, this way is more OS platform friendly.
NOTE: this function is not available in win98

extern "C" HRESULT ( STDAPICALLTYPE *pAssocQueryString )( UINT,UINT,LPCTSTR,LPCTSTR,LPCTSTR,LPDWORD ) = NULL;

#define ASSOCSTR_EXECUTABLE 2

void CTestassocDlg::OnOk()
{

HMODULE hMod = 0;

if ( ( hMod = ::LoadLibrary( _T( "shlwapi.dll" ) ) ) != 0 )
{
pAssocQueryString= (HRESULT (__stdcall *)(UINT,UINT,LPCTSTR,LPCTSTR,LPCTSTR,LPDWORD ) )::GetProcAddress( hMod, "AssocQueryStringA" );
}

if ( pAssocQueryString )
{
DWORD BufferSize = MAX_PATH;
char path[MAX_PATH];
pAssocQueryString(0, ASSOCSTR_EXECUTABLE, ".pdf", "print", path, &BufferSize);

}

}

Wednesday, 13 July 2011

VK_ALT undeclared / undefined C++

It's actually defined as VK_MENU

e.g.


// VK_ALT
void AltKey()
{
    INPUT input[1] = { '\0' };       
 memset(input, 0, sizeof(input));          
 input[0].type = INPUT_KEYBOARD;   
 input[0].ki.dwFlags = 0; // KEYEVENTF_EXTENDEDKEY; 
 input[0].ki.wVk = VK_MENU;
 input[0].ki.wScan = 0;
 input[0].ki.dwExtraInfo = 0;   
 input[0].ki.time = GetTickCount(); Sleep(5); 
 SendInput(1, input, sizeof(INPUT));
}
void AltKeyRelease()
{

    INPUT input[1] = { '\0' };       
 memset(input, 0, sizeof(input));            
 input[0].type = INPUT_KEYBOARD;   
 input[0].ki.dwFlags = KEYEVENTF_KEYUP; 
 input[0].ki.wVk = VK_MENU;
 input[0].ki.wScan = 0;
 input[0].ki.dwExtraInfo = 0;   
 input[0].ki.time = GetTickCount(); Sleep(5); 
 SendInput(1, input, sizeof(INPUT));
}

Saturday, 9 July 2011

Ghostscript gs - create pdf from pdf or other type, how to convert patterns to bitmaps and keep all other bitmaps dpi's untouched

It seems that dPDFSETTINGS=/screen    has an hidden option to convert patterns to bitmaps, problem is that with this the images are downsamsampled, to get around this do:-

(this converts patterns to bitmaps as 600dpi)

"C:\Program Files\gs\gs9.02\bin\gswin32c.exe" -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dQUIET   -dPDFSETTINGS=/screen -dDownsampleColorImages=false -dDownsampleGrayImages=false -dDownsampleMonoImages=false -r600 -dEmbedAllFonts=true -dOptimize=true -sOutputFile="out-test.pdf" "test.pdf"

Windows 7 program didn't install correctly - installshield setup.exe - PCA program compatability assistant FIX

Have old installsheild projects that show this when installing on Windows 7 64bit or other versions?

Right mouse on the setup.exe, Properties and go into compatability tab, change "Run with campatability mode for" to Windows 2000

This seems to fix the program not installed correctly message.

how use string table RESOURCE STRING in message box or other functions easily on one line of code

usually would be called like this:-
MessageBox("No files to save","Save Error!");

From resource stirng table:-
MessageBox((CString)MAKEINTRESOURCE(IDS_STRING_NOFILESTOSAVE),(CString)MAKEINTRESOURCE(IDS_STRING_SAVEERROR));

Thursday, 7 July 2011

GetSaveFileName OPENFILENAME save button not working on windows 7

This is todo with Themes & the manifest file, if you right mouse on the exe and select Compatibility tab, then select "Disable visual themes"   save button will then work ok.

changing stack reserve to a smaller size also fixes the issue: e.g. 0x800000

Saturday, 18 June 2011

getch() not found on linux conio.h

conio.h getch() is not standard C and is sepcific to DOS, todo it on linux do:-

#include <stdio.h>
#include <termios.h>
#include <unistd.h>

int getch( ) {
  struct termios
oldt,
                 newt;
  int            ch;
  tcgetattr( STDIN_FILENO, &oldt );
  newt = oldt;
  newt.c_lflag &= ~( ICANON | ECHO );
  tcsetattr( STDIN_FILENO, TCSANOW, &newt );
  ch = getchar();
  tcsetattr( STDIN_FILENO, TCSANOW, &oldt );
  return ch;
}

Thursday, 16 June 2011

VBS on 64bit machines with 32bit COM DLL fix

When you run the VB script do: %windir%\SysWOW64\wscript.exe scriptcom.vbs

That will run VBS in 32 bit mode.

You can register the DLL in 64 bit or 32 bit mode.

Monday, 13 June 2011

ftp entering passive mode stuck - fix

type: passive

then it will turn passive mode off.

Enabling telnet, rlogin, and rsh in Mac OS X 10.0.1 and later

Enabling telnet, rlogin, and rsh in Mac OS X 10.0.1 and later
Important:
Telnet, rlogin, and rsh send information (including passwords) over the network unencrypted. OpenSSH provides greater security. You should only revert to telnet, rlogin, and rsh if your network environment requires them.

You must be logged in as an Admin user to follow these steps. After each step in which you type a command, press the Return key.
    1. Open the Terminal utility. 2. Type sudo pico /etc/inetd.conf 3. Type in your admin password. 4. Press Return. 5. The file inetd.conf will open in the pico text editor. Using the arrow keys to navigate, scroll down until you see the lines for: #telnet #shell #login 6. Remove the pound "#" character from the line of each service you want to re-enable. 7. Save the file (press Control-O), press Return, and exit pico (press Control-X). 8. Choose Restart from the Apple menu.

Wednesday, 8 June 2011

How to get bytes count of file over 2gb (64bit) in C / C++ and output 64bit int as char text string

#include <io.h>
#include <fcntl.h>

char sizeOfFile[20] = { '\0' };
int fh = _open( "c:\\myfile.mp4", _O_RDONLY | _O_BINARY );
 __int64 len64 = _lseeki64(fh,0L,SEEK_END);
 _i64toa( len64, sizeOfFile, 10 );
 _close(fh);

Thursday, 2 June 2011

The application failed to initialize... 0xc00007b 64bit fix

We used Dependency Walker on the exe and found that the comctl32.dll was shown for x86 CPU (32bit) which was causing it not to load.
to fix check the output <exe>.manifest   file, the 64-bit version of it must have processorArchitecture='amd64'   for it to pickup the 64bit version!

fatal error C1083: Cannot open include file: "fstream.h": No such file or directory fix

The fstream.h header (and some other similar ones like iostream.h) does not exist anymore. It was part of the old iostream library and it was non standard. The replacement is fstream (without .h extension):
#include <fstream>
using namespace std; // you also need this because the standard stuff is declared in the std namespace

Wednesday, 1 June 2011

How to use ICC/ICM profiles for your printer that supports them C++ code, availabe in our IMG Addon for Batch & Print Pro

HDC hdcPrint;
BOOL sicm = SetICMProfile(hdcPrint, m_icc.GetBuffer(255));
TRACE("SetICMProfile: %d\n",sicm);

{
    AfxMessageBox("Error loading ICC/ICM profile: " + m_icc);
}

TRACE("SetICMMode: %d\n",mode);
 

DWORD dw;
BOOL rt = GetICMProfile(hdcPrint,&dw,lpszFilename);
TRACE("GetICMProfile: %s\n",lpszFilename);


// add after every start page
StartPage(hdcPrint);

TRACE("SetICMMode: %d\n",mode);
int mode = SetICMMode(hdcPrint,ICM_ON);
if(!sicm)int mode = SetICMMode(hdcPrint,ICM_ON);char lpszFilename[255] = { '\0' };

VC2008 64bit error C2440: 'static_cast' : cannot convert from 'void (__cdecl CTestappDlg::* )(UINT)' to 'void (__cdecl CWnd::* )(UINT_PTR)' fix

Change in .h header file
afx_msg void OnTimer(UINT nIDEvent);
to
afx_msg void OnTimer(UINT_PTR nIDEvent);

and change in .cpp file
void <yourapp>::OnTimer(UINT nIDEvent)
to
void <yourapp>::OnTimer(UINT_PTR nIDEvent)

Saturday, 28 May 2011

Get User Documents Folder in C++ with SHGetSpecialFolderPath

How to obtain the user login documents folder in C++

  TCHAR strPath[ MAX_PATH ];

 // Get the special folder path.
  SHGetSpecialFolderPath(
  0,       // Hwnd
  strPath, // String buffer.
  CSIDL_PERSONAL, // CSLID of folder
  FALSE ); // Create if doesn't exists?

How to create a PFX Certificate file from PVK and SPC files.

download the latest Windows 7.1 sdk from Microsoft  and use pvk2pfx.exe
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=6b6c21d2-2006-4afa-9702-529fa782d63b&displaylang=en

download the winsdk_web.exe  (498k) and when installing select Windows Native Code Development --> Tools
In dos:-

CD "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin"

pvk2pfx -pvk c:\mykey.pvk -spc c:\mykey.spc -pfx c:\mykey.pfx
you will need to enter your PVK creation password when prompted.

Tuesday, 17 May 2011

SendMail Socket crash on second email from Acrobat plugin app fix

In your project settings:  C/C++ tab, Preprocessor Definitions add: _USRDLL   to fix the problem.

possibly todo with a bug in Visual C++ - see: http://support.microsoft.com/kb/166817

Monday, 16 May 2011

Modless Dialog not launching from Acrobat ADM plugin application - error at line 21

In your first initilization dialog prompt add the following lines:


extern "C" HINSTANCE gHINSTANCE;
extern "C" HWND gHWND;

AfxSetResourceHandle(gHINSTANCE);


gHINSTANCE  can be found in Pimain.cpp

Tuesday, 10 May 2011

Drag and Drop not dropping in expected order issue

This is a general windows feature - the issue is where the mouse pointer is when you click to drag, make sure you have the mouse pointer at the very top of the list to drag so it will retain them in order on screen.

Sunday, 8 May 2011

Drag and Drop been blocked / not working in Vista and Windows 7 C++ fix in VS6 (Visual studio 6)

This is a problem with permissions in Vista and Win7 that was introduced with UAC control, there is a workaround but most are using VS2005, 2010 to get around it - to get around it in VS6 call the .dll routine directly by doing below in the startup of your app

Change the startup of your app:-

BOOL C<yourappname>App::InitInstance()
{
 AfxEnableControlContainer();

------------------------------------------------------------------------------
To:-


#define MSGFLT_ADD 1
extern "C" BOOL ( STDAPICALLTYPE *pChangeWindowMessageFilter )( UINT,DWORD ) = NULL;
BOOL C<yourappname>App::InitInstance()
{
 AfxEnableControlContainer();

 // fix drag and drop issue in Windows Vista and Windows 7
HMODULE hMod = 0;

if ( ( hMod = ::LoadLibrary( _T( "user32.dll" ) ) ) != 0 )
{
 pChangeWindowMessageFilter = (BOOL (__stdcall *)( UINT,DWORD ) )::GetProcAddress( hMod, "ChangeWindowMessageFilter" );
}

if ( pChangeWindowMessageFilter )
{
 pChangeWindowMessageFilter (WM_DROPFILES, MSGFLT_ADD);
 pChangeWindowMessageFilter (WM_COPYDATA, MSGFLT_ADD);
 pChangeWindowMessageFilter (0x0049, MSGFLT_ADD);
}

Saturday, 7 May 2011

ASUS PL-X31 data over mains fix from slowness and droping out

Found an issue with Panasonic phone mains adapter causing interference with ASUS PL-X31 data over mains, moved it to another location and now is fine.

Wednesday, 4 May 2011

Batch & Print Pro IMG Addon - header footer [FITLETITLE] not changing.

header and footers are defaulted to [FILETITLE]   this can cause complications when running from the command line as -h -f need to be blanked out.

so we've revised it for next version 1.13 release to be nothing in those fields.

download revised 1.12 version here:
http://www.traction-software.co.uk/beta/bppimgaddon.zip

COM Component invalid Class fix on .asp server scripts - security issue

COM Component invalid Class fix on .asp server scripts
This is a new windows security feature which was introduced in XP sp3 and latest Vista, Windows 7 & 2008.

NOTE: PDFTextStamp.PDFTextStampCom.1   is an example name of your COM component.

find HKEY_CLASSES_ROOT\PDFTextStamp.PDFTextStampCom.1

right mouse on it and select 'permisions...'

click Add... button

IUSR_<computer name>

click 'Full control' for permissions


then you should be ok...  this is a new windows security feature which was introduced in XP sp3 and latest Vista, Windows 7 & 2008.

Windows quick find file / folder / item tip

Not many people know this but there is a quick way to find files / folders / items in a directory and this can also be used with other list view windows and comobo boxes.

when looking for something highlight the first item or an item (file / folder) near the one your looking for, then start typing the name e.g. to find SchoolBooks

press S, it will jump straight to the S'es in the list then if you quickly do e.g. sc  it will go straight to it.

Adobe ADM -32767 to 32768 range on numbers int issue

How to fix this issue with the Int variable range that is preset.

    itemRef = sADMDialog->GetItem(promptDialog, IDC_EDIT_STARTFROM);
    sADMItem->SetUnits(itemRef, kADMNoUnits);
    sADMItem->SetMaxIntValue(itemRef,999999);  // ****  this is required
    sADMItem->SetIntValue(itemRef,atoi(token));

Mac - Keyboard keys for startup and other things... usefull.

On Boot


Key CombinationEffect
mouse downEject removable media ( I think Boot ROMs prior to 2.4f1 excluded the CD drive )
optBring up OF system picker on New World machines - boot to 9 on pre-New World machines
F8Bring up Mac OS X boot partition selector (DTKs only?)
cmd-periodWhen OF system picker is active, open the CD tray
cmd-optHold down until 2nd chime, will boot into Mac OS 9 ?
cmd-x (or just x?)Will boot into Mac OS X if 9 and X are on the same partition and that’s the partition you’re booting from.
cmd-opt-n-dprevent native drivers from loading (System 7 until 9.x?)
cmd-opt-shift-deleteBypass startup drive and boot from external (or CD). This actually forces the system to NOT load the driver for the default volume, which has the side effect mentioned above. For SCSI devices it searches from highest ID to lowest for a partition with a bootable system. Not sure about IDE drives.
cmd-opt-shift-delete-#Boot from a specific SCSI ID # (# = SCSI ID number)
cmd-opt-p-rZap PRAM. Hold down until second chime.
cmd-opt-n-vClear NV RAM. Similar to reset-all in Open Firmware.
cmd-opt-o-fBoot into open firmware
cmd-opt-t-vForce Quadra AV machines to use TV as a monitor
cmd-opt-x-oBoot from ROM (Mac Classic only)
cmd-opt-a-vForce an AV monitor to be recognized as one
cBoot from CD. If set to boot to X and no CD is present, may boot to 9.
dForce the internal hard disk to be the startup device
nHold down until Mac logo, will attempt to boot from network server (using BOOTP or TFTP)
rForce PowerBooks to reset the screen
tPut FireWire machine into FireWire Target Disk mode
zAttempt to boot using the devalias zip from first bootable partition found
ctl-cmd-shift-powerReset power manager (with computer off)
shift(Classic only) Disable Extensions
shift(OS X, 10.1.3 and later) Disables login items. Also disables non-essential kernel extensions (safe boot mode)
cmd(Classic only) Boot with Virtual Memory off
cmd-v(OS X only) show console messages (verbose mose) during boot. Also invokes Safe Mode
cmd-s(OS X only) boot into single user mode
cmd-opt-c-i(Mac IIci only) Set date to 20 Sep 1989 to get a graphical easter egg
cmd-opt-f-x(Mac IIfx only) Set date to 19 Mar 1990 to get a graphical easter egg
cmd-opt-shift-tab-deleteErase startup disk under 7.1(?)
Back to Contents

 

After display of Happy Mac icon

Key CombinationEffect
space(Classic only) Invoke Extensions Manager
shift(Classic only) Disable Extensions including MacsBug
shift-opt(Classic only) Disable exetensions, except MacsBug
ctrl(Classic only) Break into MacsBug as soon as it is loaded
Back to Contents
 

At login window

Key CombinationEffect
shift(10.x only) Disable auto-login, forcing login window
 

As Finder Starts

Key CombinationEffect
cmd-opt(whenever Classic Finder sees a new disk) Rebuild Desktop
opt(Mac OS 9) Do not open Finder windows
shift(Mac OS X) Do not launch startup items. Do not open Finder windows when launching Finder. The windows’ states aren’t changed to closed, as they will be reopened if you reboot again.
shift(Mac OS 9) Do not launch anything from the "Startup Items" folder.
Back to Contents
 

In Finder

opt-click close box (or cmd-opt-w)Close all open finder windows (except popup windows)
cmd-shift-opt-wClose all open finder windows (including popup windows)
cmd-right arrowOpen folder in list view
cmd-opt-right arrowRecursively open folder and nested folders in list view
cmd-left arrowClose folder in list view
cmd-opt-left arrowRecursively close folder and nested folders in list view
cmd-up arrowOpen parent folder. On Mac OS X, when nothing is selected and no windows are open, open User directory
cmd-opt-up arrowOpen parent folder, closing current folder
cmd-opt-shift-up arrowMake desktop the active window, select parent volume
cmd-down arrowOpen selected item. On Mac OS X, when nothing is selected and no windows are open, open the desktop folder
cmd-opt-down arrowOpen selected item, closing current folder
cmd-opt-oOpen selected item, closing current folder
opt-double-clickOpen selected item, closing current folder
opt-click(In disclosure triangle) expand or collapse all folders within that window
tabselect next icon alphabetically
shift-tabselect previous item alphabetically
cmd-deletemove selection to trash
cmd-shift-deleteempty trash
spacewhile navigating, opens folder under mouse immediately (with spring-loaded folders enabled)
 
In Finder Window Menu
cmd-selectClose window
cmd-shift-selectPut away popup window
cmd-opt-selectExpand selected window and close all others
ctl-selectExpand selected window and collapse all others
ctl-opt-selectActivate selected window and expand all others
Back to Contents
 

On disk mount

cmd-opt(whenever Classic Finder sees a new disk) Rebuild Desktop
opt(Mac OS 9) Add session numbers (;1, ;2, etc) to ISO-9660 CD filenames
opt(Mac OS X) Show each session on an ISO-9660 CD as a volume
cmd-opt-iForce-mount ISO-9660 partition of a CD, rather than a Mac partition
Back to Contents
 

After startup

Key CombinationEffect
 
On machines with a power key
powerBring up dialog for shutdown, sleep or restart (see next table)
cmd-ctrl-powerUnconditionally reboot (sometimes referred to as “control flower power” to easily remember) (dirty reboot - may corrupt disk)
ctrl-cmd-opt-powerFast shutdown
cmd-powerBring up debugger (if debugger installed). Really old macs (mac ii era) needed Paul Mercer’s debugger init to do this, then it got folded into the firmware, around 040 timeframe.
cmd-opt-powerPut late model PowerBooks & Desktops to sleep
cmd-opt-ctrl-power(PowerBook 500) Reset Power Manager
shift-fn-ctrl-power(PowerBook G3, G4) Reset Power Manager
 
On machines without a power key
ctrl-ejectBring up dialog for shutdown, sleep or restart (see next table)
cmd-ctrl-ejectUnconditionally reboot
ctrl-cmd-opt-ejectFast shutdown
cmd-ejectBring up debugger (if debugger installed). Really old macs (mac ii era) needed Paul Mercer’s debugger init to do this, then it got folded into the firmware, around 040 timeframe.
cmd-opt-ejectPut late model PowerBooks & Desktops to sleep
 
On all machines
cmd-opt-escForce quit current app
cmd-shift-0Put late model PowerBooks & Desktops to sleep No longer work in OS X. On Macs with three floppy drives (Mac SE) they eject the third floppy disk.
cmd-shift-1 or 2Eject internal or external floppy. Not sure which is which on dual floppy machines (Mac SE, Mac II, etc.)
cmd-shift-3Screen shot
cmd-shift-4Abstract user defined area screen shot (hold control while selecting to direct it to the clipboard on Mac OS 9)
cmd-shift-capslock-4(Classic only) User selectable window screen shot
cmd-ctl-shift-3Screen shot to clipboard
cmd-ctl-shift-4Abstract user defined area screen shot to clipboard
cmd-ctl-shift-capslock-4(Classic only) User selectable window screen shot to clipboard (classic only)
cmd-tabSwitch apps (possible to change key in Mac OS 8-9)
cmd-shift-tabSwitch apps in reverse order
cmd-spaceSwitch keyboards/script systems (if more than one is installed)
cmd-opt-spaceswitch through all keyboards in keyboards menu
opt-f3, opt-f4 or opt-f5bring up the system preferences (Mac OS X only - maybe powerbooks only? only if system preferences isn’t already running)
cmd-f1toggle between video mirroring and extended desktop mode (works on Ti Powerbooks)
opt-f1open the displays preference (10.2 and later)
cmd-f2auto-detect a newly-connected display (works on Ti Powerbooks)
opt-f2open the displays preference (10.2 and later)
opt-f3, f4, or f5open the Sounds preference (10.2 and later)
opt-f8, f9, or f10open the Keyboard and Mouse preference (10.2 and later)
f12Eject CD/DVD (must be held down on 10.1.2 or later). If the device can be dismounted, it is. If not, nothing happens.
f14dim display (cubes/g4 iMacs/others?)
f15brighten display (cubes/g4 iMacs/others?)
cmd-ctl-shift-0Spin down HD (when possible) on machines running OS 9
cmd-`cycle through current application’s windows (Mac OS X 10.2 only?)
cmd-~cycle through current application’s windows (reverse order) (Mac OS X 10.2 only?)
opt-"Empty Trash"Emptry trash without locked file or contents summary alert. Empties locked items, as well
cmd-opt-D(Mac OS X only) toggle dock
cmd-opt (when opening chooser)(Mac OS 9 only) rebuild chooser cache of printer driver information
 
(See Universal Access System Preference for more on following)
cmd-opt-ctl-8(Mac OS X, 10.2 or later) Turn on "Inverse Mode" via accessbility.
cmd-opt-8(Mac OS X, 10.2 or later) Turn on "Zoom Mode" via accessbility.
cmd-opt-plus(Mac OS X, 10.2 or later) Zoom In via accessbility.
cmd-opt-minus(Mac OS X, 10.2 or later) Zoom Out via accessbility.
Back to Contents
 

In the sleep/restart dialog

KeyEffect
SSleep
RRestart
esccancel
cmd-. (period)cancel
Return or EnterShut Down
PowerCancel (9.2.x only?)
Back to Contents
 

In other dialogs

KeyAction
escCancel
command-. (period)Cancel
enterDefault button
returnDefault button (if there are no text fields that use return
cmd-dDon’t save (in save/cancel/don’t save dialog)
cmd-rReplace (in "Do you want to replace this file" dialog, Mac OS X only)
Back to Contents
 

On keyboards with a function key

Key CombinationEffect
fn-backspaceforward delete
fn-left arrowhome
fn-right arrowend
fn-up arrowpage up
fn-down arrowpage down
Back to Contents
 

Clicks

click / modifierEffect
option-click in another applicationSwitch to that application and hide previous app
cmd-drag (window)Drag window without bringing it to front (requires application support to work behind dialogs)
cmd-drag (window background)Pan contents of window with hand (Finder)
cmd-opt-drag (window background)Option may be needed to pan contents of window with hand (Finder) on 10.3 and later
cmd-drag (Mac OS X)Rearrange menu extras
opt-drag (file)Copy file
cmd-opt-drag (file)Make alias of file
cmd-click window titlePop-up menu showing path to current folder/document (in some applications)
option-windowshadeWindowshade all windows of application (classic only)
option-zoomZoom window to full-screen
option-yellowDock all windows of application (Mac OS X only)
option-greenZoom window to fill screen (in some applications)
 
Mac OS X only - items in dock
cmd-clickReveal in Finder
cmd-opt-clickActivate app and hide other apps
ctl-click (or click and hold)contextual menu
cmd-drag into dockFreeze current dock items from moving so icon can be dropped onto an app
cmd-opt-drag into dockForce application you’re dropping onto to open dropped item
Back to Contents
 

Control Strip

opt-drag control stripMove control strip
opt-drag CS module within stripreorders CS modules
opt-drag CS module to trashuninstalls a module
opt-drag CS module elsewherewhatever dragging the module file itself would

Mac issues again - Code Warrior 7 compiler error (invalid data in pre compiled header)

Oh we love Macs, reminds me why we consentrate on windows these days.

Problem compiling old PDF Page Numberer for Mac Acrobat 5&6 to change the number limits on start, end boxes etc.

Kept getting error:-
invalid data in pre compiled header   no matter what at the start of every .cpp file.

tried  a C example in code warrior 7 and worked ok, then tried a C++ one and got the same issue.

Finally found the CodeWarrior 7 CD and re-installed on a new drive then it worked straight away! wow!

Apple Mac startup issue - monitor hertz too high to view on monitor

Ok, had an issue yestersay - old version of MAC OSX wouldn't startup on our new ViewSonic monitor due to too high hz resolution (90hz x 75hz), after a few reboots trying to telnet in to change the config startup file found that if you startup in SAFE mode then it will get past it so you can then change the settings to 60hz for the monitor graphic display in System Preferences.

To statup in safemode:

To start up into Safe Mode (to Safe Boot), do this:
  1. Be sure your Mac is shut down.
  2. Press the power button.
  3. Immediately after you hear the startup tone, hold the Shift key. The Shift key should be held as soon as possible after the startup tone, but not before the tone.
  4. Release the Shift key when you see the gray Apple icon and the progress indicator (looks like a spinning gear).
During startup in Mac OS X v10.4 or later, you will see "Safe Boot" on the login window, which appears even if you normally log in automatically. During startup in Mac OS X v10.2 through v10.3.9, you will see "Safe Boot" on the Mac OS X startup screen.
To leave Safe Mode, restart the computer normally, without holding any keys during startup.