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.