Non-member functions do not have access to to "this"
pointer of your class.
You need to do the following :
1) create a GLOBAL pointer to your class. So near the
top of the CPP file, add something like :
CYourClass pYourClass = NULL;
2) sometime before the callback function is to
be called, you need to initialize the pointer. This
must be done in a member function of your class :
pYourClass = this;
3) then in the callback function :
if (pYourClass != NULL)
pYourClass->Whatever();
Day to day work issues we find with windows, mac, unix and internet, software apps etc. we get many many questions and find out some weird things tips and tricks about windows OS that might help others, some of these will help others and help our clients setup software to there requirements.
Friday, 26 October 2012
Tuesday, 21 August 2012
fix fatal: libm.so.2: open failed: No such file or directory
To fix do this problem:-
ln -s /usr/lib/libm.so.1 /usr/lib/libm.so.2
in /usr/lib you should have libm.so, libm.so.1 and libm.so.2 files.
ln -s /usr/lib/libm.so.1 /usr/lib/libm.so.2
in /usr/lib you should have libm.so, libm.so.1 and libm.so.2 files.
Monday, 30 July 2012
IMAP - too many simultaneous connections Gmail
IMAP - too many simultaneous connections
Keep getting this error? then go into gmail webpage, then click bottom right where it says: Last account activity: 0 minutes ago
Details
Click on Details and click button "Sign out all other sessions"
Now it should be ok, check the ip's to make sure no-one has hacked your account.
Tuesday, 8 May 2012
MS DOS script to rename, append date, delete files older than 30 or N days
MS DOS script to rename, append date, delete files older than 30 or N days
Here is a script to rename and append time/date to backup file, move it to an archive directory, and search and delete all files older than 30 days.
ren c:\files\backup2.bkf backup1_%date:~4,2%%date:~7,2%%date:~10,4%_.bkf
move E:\ntbackup\backup?_* E:\ntbackup\archive
forfiles /P “E:\ntbackup\archive” /S /M *.bkf /D -30 /C “cmd /c del @PATH”
move E:\ntbackup\backup?_* E:\ntbackup\archive
forfiles /P “E:\ntbackup\archive” /S /M *.bkf /D -30 /C “cmd /c del @PATH”
Monday, 30 April 2012
How to find virtual windows Virtual Store area in registry
registry key:-
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Local AppData
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Local AppData
how to check in C++ for access and not use VirtualStore redirection in Win7 _access
Here's how to check and not do virtualization redirection:-
#include <io.h>
if( (_access( "c:\\yourfile.txt", 2 )) != -1)
{
AfxMessageBox( "has write permission\n" );
}
else
{
#include <io.h>
if( (_access( "c:\\yourfile.txt", 2 )) != -1)
{
AfxMessageBox( "has write permission\n" );
}
else
{
AfxMessageBox( "doesn't have write permission\n" );
// here you can change the path to something else.
}
post-build pre-link step commands how to ignore // rem in c++
Add a REM to the beginning of the command e.g.
REM "C:\Program Files\Microsoft Platform SDK\Bin\mt.exe" -manifest "PDFContentSplitSA.exe.manifest" -outputresource:"Release/PDFContentSplitSA.exe";#1
REM "C:\Program Files\Microsoft Platform SDK\Bin\mt.exe" -manifest "PDFContentSplitSA.exe.manifest" -outputresource:"Release/PDFContentSplitSA.exe";#1
How to turn off VirtualStore in C++ manifest file fix asInvoker
create file.exe.manifest: with below contents:-
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="asInvoker"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
then add the manifest to the exe (Windows SDK required for mt.exe command)
"Path of the MT.exe"
-manifest "$(ProjectDir)[application name].exe.manifest"
-outputresource:"$(TargetDir)$(TargetFileName)";#1
in vc6++
"C:\Program Files\Microsoft Platform SDK\Bin\mt.exe" -manifest "file.exe.manifest" -outputresource:"Release/file.exe";#1
Thursday, 12 April 2012
run 32bit COM dll's on 64bit Windows IIS7 & IIS6
For IIS7 - Open a command prompt and run the following (run as administrator):-
%windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.enable32BitAppOnWin64:true
To enable IIS 6.0 to run 32-bit:-
1.Open a command prompt and navigate to the %windir%\Inetpub\AdminScripts directory.
2.Type the following: cscript.exe adsutil.vbs set W3SVC/AppPools/Enable32BitAppOnWin64 “true”
%windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.enable32BitAppOnWin64:true
To enable IIS 6.0 to run 32-bit:-
1.Open a command prompt and navigate to the %windir%\Inetpub\AdminScripts directory.
2.Type the following: cscript.exe adsutil.vbs set W3SVC/AppPools/Enable32BitAppOnWin64 “true”
Tuesday, 10 April 2012
Sony Vegas Hang Audio Device - conflict with DigiDesign ASIO Driver fix
This is a conflict with DigiDesign ASIO Driver, do below to fix it but then digidesign may fail.
manually delete from windows/system32 these files:
digi32.dll, digiasio.dll, digiplatformsupport.dll, diomidi.dll, and directio.dll
manually delete from windows/system32 these files:
digi32.dll, digiasio.dll, digiplatformsupport.dll, diomidi.dll, and directio.dll
64bit register com dll DllRegisterServer with error code 0x80070005 fix
If the privilege level is wrong, you might got an error message on DllRegisterServer with error code 0x80070005
to fix:-
Click start menu and right mouse on "Command Line Prompt" and select "Run As Administrator"
It should be noted that remember using that right regsvr32.exe.
64-bit version: C:\Windows\system32\regsvr32.exe
32-bit version: C:\Windows\sysWOW64\regsvr32.exe
Dev Studio 2008 Compiler error: _WIN32_WINNT settings conflicts with _WIN32_IE setting fix
change in your stdafx.h
#define _WIN32_WINNT 0x0400
to
#define _WIN32_WINNT 0x0500
#define _WIN32_WINNT 0x0400
to
#define _WIN32_WINNT 0x0500
Wednesday, 15 February 2012
c++ First-chance exception in exe (KERNEL32.DLL): 0x0EEDFADE: (no name) FIX!!!
First-chance exception in Test.exe (KERNEL32.DLL): 0x0EEDFADE: (no name)
Just add below before you call the DLL.
CoInitialize(NULL);
Just add below before you call the DLL.
CoInitialize(NULL);
Monday, 6 February 2012
USA federal holidays 2012
| Monday, January 2* | New Year's Day |
| Monday, January 16 | Birthday of Martin Luther King, Jr. |
| Monday, February 20** | Washington's Birthday |
| Monday, May 28 | Memorial Day |
| Wednesday, July 4 | Independence Day |
| Monday, September 3 | Labor Day |
| Monday, October 8 | Columbus Day |
| Monday, November 12*** | Veterans Day |
| Thursday, November 22 | Thanksgiving Day |
| Tuesday, December 25 | Christmas Day |
Wednesday, 1 February 2012
How to fix the CListCtrl MFC C++ lines in middle of item issue bug fix.
Problem:-
fix:-
To fix this bug in the MFC List Control you need to specialize the control, over-ride the method wich responds to the scroll, and force it to redraw the list completely after it has done the scroll.
SmoothListCtrl.cpp
// SmoothListCtrl.cpp : implementation file
//
#include "stdafx.h"
#include "MFC_Sample.h" // your project header
#include "SmoothListCtrl.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSmoothListCtrl
CSmoothListCtrl::CSmoothListCtrl()
{
}
CSmoothListCtrl::~CSmoothListCtrl()
{
}
BEGIN_MESSAGE_MAP(CSmoothListCtrl, CListCtrl)
//{{AFX_MSG_MAP(CSmoothListCtrl)
ON_WM_VSCROLL()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSmoothListCtrl message handlers
void CSmoothListCtrl::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
CListCtrl::OnVScroll(nSBCode, nPos, pScrollBar);
Invalidate();
UpdateWindow();
}
SmoothListCtrl.h
#if !defined(AFX_SMOOTHLISTCTRL_H__91716634_7EEA_4555_8977_2F7C96751793__INCLUDED_)
#define AFX_SMOOTHLISTCTRL_H__91716634_7EEA_4555_8977_2F7C96751793__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// SmoothListCtrl.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CSmoothListCtrl window
class CSmoothListCtrl : public CListCtrl
{
// Construction
public:
CSmoothListCtrl();
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSmoothListCtrl)
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CSmoothListCtrl();
// Generated message map functions
protected:
//{{AFX_MSG(CSmoothListCtrl)
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_SMOOTHLISTCTRL_H__91716634_7EEA_4555_8977_2F7C96751793__INCLUDED_)
fix:-
To fix this bug in the MFC List Control you need to specialize the control, over-ride the method wich responds to the scroll, and force it to redraw the list completely after it has done the scroll.
SmoothListCtrl.cpp
// SmoothListCtrl.cpp : implementation file
//
#include "stdafx.h"
#include "MFC_Sample.h" // your project header
#include "SmoothListCtrl.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSmoothListCtrl
CSmoothListCtrl::CSmoothListCtrl()
{
}
CSmoothListCtrl::~CSmoothListCtrl()
{
}
BEGIN_MESSAGE_MAP(CSmoothListCtrl, CListCtrl)
//{{AFX_MSG_MAP(CSmoothListCtrl)
ON_WM_VSCROLL()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSmoothListCtrl message handlers
void CSmoothListCtrl::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
CListCtrl::OnVScroll(nSBCode, nPos, pScrollBar);
Invalidate();
UpdateWindow();
}
SmoothListCtrl.h
#if !defined(AFX_SMOOTHLISTCTRL_H__91716634_7EEA_4555_8977_2F7C96751793__INCLUDED_)
#define AFX_SMOOTHLISTCTRL_H__91716634_7EEA_4555_8977_2F7C96751793__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// SmoothListCtrl.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CSmoothListCtrl window
class CSmoothListCtrl : public CListCtrl
{
// Construction
public:
CSmoothListCtrl();
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSmoothListCtrl)
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CSmoothListCtrl();
// Generated message map functions
protected:
//{{AFX_MSG(CSmoothListCtrl)
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_SMOOTHLISTCTRL_H__91716634_7EEA_4555_8977_2F7C96751793__INCLUDED_)
Tuesday, 31 January 2012
CImageList Add return index skipping fix C++
iIndex = m_ImgList.m_ImageListCopy.Add(&cb16,CLR_NONE );
If the iInex skips e.g. 4 from last image then this means the image is actually 4x larger and needs scaling to 16x16.
If the iInex skips e.g. 4 from last image then this means the image is actually 4x larger and needs scaling to 16x16.
Saturday, 28 January 2012
How to convert CString to std::wstring or usigned short * c++
CString str = "Hello World";
wchar_t buffer[255];
// convert the text
mbstowcs(buffer,(LPCSTR)str,str.GetLength()+1);
Wednesday, 25 January 2012
error C2061: syntax error : identifier 'THIS_FILE' c++
To fix this move all your include files above the #ifdef _DEBUG and using namespace std below. e.g.
#include "stdafx.h"
#include <stdlib.h>
#include <string>
#include <iostream>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
using namespace std;
#include "stdafx.h"
#include <stdlib.h>
#include <string>
#include <iostream>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
using namespace std;
Thursday, 19 January 2012
Paper page sizes in points / picas / pixels / inches / mm / cm
Here's a list of paper page sizes:-
The below are not available in the -paper parameter.
This list of the common American and European paper sizes includes the ISO standards, which are used globally. All dimensions are specified in inches, millimeters as well as PostScript points (1/72 inch, always rounded off).
This overview covers:
- ISO page sizes – The ISO A series is the most frequently used page measurement standard. It includes the DIN A4 format. The ISO B sizes are used for poster printing while ISO C is meant for envelopes. The SRA standard defines press sheet sizes and is used in the printing industry.
- American paper size dimensions – such as ‘Letter’, ‘Legal’ and the ANSI series.
- English sheet sizes – with a focus on formats for writing paper and book printing.
ISO A paper sizes
The A-series consists of a logical set of paper sizes that are defined by the ISO 216 standard. The largest size (A0) measures one square meter. The height/width ratio remains constant (1:1.41) for all sizes. This means you get the A1 size by folding an A0 paper in two along its shortest side. Then fold the A1 size in two to get an A2 size paper, and so on… A-sizes are used to define the finished paper size in commercial printing: A4 is for office documents, A5 is for notepads and A6 is for postcards.
Millimeters | Inches | Points | ||||
Height | Width | Height | Width | Height | Width | |
| A0 | 1189 | 841 | 46.81 | 33.11 | 3370 | 2384 |
| A1 | 841 | 594 | 33.11 | 23.39 | 2384 | 1684 |
| A2 | 594 | 420 | 23.39 | 16.54 | 1684 | 1190 |
| A3 | 420 | 297 | 16.54 | 11.69 | 1190 | 842 |
| A4 | 297 | 210 | 11.69 | 8.27 | 842 | 595 |
| A5 | 210 | 148 | 8.27 | 5.83 | 595 | 420 |
| A6 | 148 | 105 | 5.83 | 4.13 | 420 | 298 |
| A7 | 105 | 74 | 4.13 | 2.91 | 298 | 209 |
ISO B paper sizes
The same logic from the A-sizes also applies for the B-series, except here the starting point was the dimension of one of the sides, which starts at 1 meter. B-sizes are often used for posters.
Millimeters | Inches | Points | ||||
Height | Width | Height | Width | Height | Width | |
| B0 | 1414 | 1000 | 55.67 | 39.37 | 4008 | 2835 |
| B1 | 1000 | 707 | 39.37 | 27.83 | 2835 | 2004 |
| B2 | 707 | 500 | 27.83 | 19.69. | 2004 | 1417 |
| B3 | 500 | 353 | 19.69 | 13.90 | 1417 | 1001 |
| B4 | 353 | 250 | 13.90 | 9.84 | 1001 | 709 |
| B5 | 250 | 176 | 9.84 | 6.93 | 709 | 499 |
| B6 | 176 | 125 | 6.93 | 4.92 | 499 | 354 |
| B7 | 125 | 88 | 4.92 | 3.46 | 354 | 249 |
| B8 | 88 | 62 | 3.46 | 2.44 | 249 | 176 |
| B9 | 62 | 44 | 2.44 | 1.73 | 176 | 125 |
| B10 | 44 | 31 | 1.73 | 1.22 | 125 | 88 |
ISO C paper sizes
C-sizes are used for envelopes to match the A-series paper. I have omitted unrealistic sizes like C0 (imagine an envelope measuring 917 by 1297 millimetres).
Millimeters | Inches | Points | ||||
Height | Width | Height | Width | Height | Width | |
| C2 | 458 | 648 | 18.03 | 25.51 | 578 | 1837 |
| C3 | 324 | 458 | 12.76 | 18.03 | 919 | 578 |
| C4 | 229 | 324 | 9.02 | 12.76 | 649 | 919 |
| C5 | 162 | 229 | 6.38 | 9.02 | 459 | 649 |
| C6 | 114 | 162 | 4.49 | 6.38 | 323 | 459 |
ISO D paper sizes
I have no idea what D-sizes are used for but the standard is there so it should be mentioned.
Millimeters | Inches | Points | ||||
Height | Width | Height | Width | Height | Width | |
| D0 | 771 | 1090 | 30.35 | 42.91 | 2186 | 3090 |
ISO RA & SRA paper sizes
These oversized papersizes are used by printers. The dimensions in millimetres are rounded to the nearest value.
Millimeters | Inches | Points | ||||
Height | Width | Height | Width | Height | Width | |
| SRA0 | 900 | 1280 | 35.43 | 50.39 | 2551 | 3628 |
| SRA1 | 640 | 900 | 25.20 | 35.43 | 1814 | 2551 |
| SRA2 | 450 | 640 | 17.72 | 25.20 | 1276 | 1814 |
| SRA3 | 320 | 450 | 12.59? | 17.72 | 907? | 1276 |
| SRA4 | 225 | 320 | 8.86? | 12.59? | 638? | 907? |
| RA0 | 860 | 1220 | 33.86 | 48.03 | 2438 | 3458 |
| RA1 | 610 | 860 | 24.02 | 33.86 | 1729 | 2438 |
| RA2 | 430 | 610 | 16.93 | 24.02 | 1219 | 1729 |
American paper sizes
The US and Canada do not use the international standards but instead rely on the paper sizes below. The ANSI standard was added in 1995 to create a set of sizes that are based on shared dimensions. It lacks however the consistent aspect ratio of the ISO A-series.
Millimeters | Inches | Points | ||||
Height | Width | Height | Width | Height | Width | |
| Letter (ANSI A) | 279.4 | 215.9 | 11.00 | 8.50 | 792 | 612 |
| Legal | 355.6 | 215.9 | 14.00 | 8.50 | 1008 | 612 |
| Ledger (ANSI B) | 431.8 | 279.4 | 17.00 | 11.00 | 1224 | 792 |
| Tabloid (ANSI B) | 279.4 | 431.8 | 11.00 | 17.00 | 792 | 1224 |
| Executive | 266.7 | 184.1 | 10.55 | 7.25 | 756 | 522 |
| ANSIC | 432 | 559 | 17.00 | 22.00 | 1224 | 1584 |
| ANSID | 559 | 864 | 22 | 34 | 1584 | 2448 |
| ANSIE | 864 | 1118 | 34.00 | 44.00 | 2448 | 3168 |
The below are not available in the -paper parameter.
English paper sizes (writing papers)
The English nowadays use the A-sizes for office and general use. I have no idea whether many of these definitions are still in use today. Imperial and half-imperial still seem to be widely used by artists.
Millimeters | Inches | Points | ||||
Height | Width | Height | Width | Height | Width | |
| Foolscap | 419 | 336 | 16.50 | 13.25 | 1188 | 954 |
| Small Post | 469 | 368 | 18.50 | 14.50 | 1332 | 1044 |
| Sheet and 1/3 cap | 588 | 336 | 22.00 | 13.25 | 1584 | 954 |
| Sheet and 1/2 cap | 628 | 336 | 24.75 | 13.25 | 1782 | 954 |
| Demy | 507 | 394 | 20.00 | 15.50 | 1440 | 1116 |
| Large Post | 533 | 419 | 21.00 | 16.50 | 1512 | 1188 |
| Small medium | 558 | 444 | 22.00 | 17.50 | 1584 | 1260 |
| Medium | 584 | 457 | 23.00 | 18.00 | 1656 | 1296 |
| Small Royal | 609 | 482 | 24.00 | 19.00 | 1728 | 1368 |
| Royal | 634 | 507 | 25.00 | 20.00 | 1800 | 1440 |
| Imperial | 761 | 559 | 30.00 | 22.00 | 2160 | 1584 |
UK metric book printing sizes
For books A-sizes often aren’t used because A4 is too large and A5 too small. Metric Royal Octavo and Metric Crown Quarto are 2 frequently used sizes that are more comfortable to hold and read.
Millimeters | Inches | Points | ||||
Height | Width | Height | Width | Height | Width | |
| Metric Crown Quarto | 246 | 189 | 9 11/16 | 7 7/16 | 697 | 536 |
| Metric Crown Octavo | 186 | 123 | 7 5/16 | 4 13/16 | 527 | 349 |
| Metric Large Crown Quarto | 258 | 201 | 10 3/16 | 7 7/8 | 731 | 570 |
| Metric Large Crown Octavo | 198 | 129 | 7 13/16 | 5 1/16 | 561 | 366 |
| Metric Demy Quarto | 276 | 219 | 10 7/8 | 8 5/8 | 782 | 621 |
| Metric Demy Octavo | 216 | 138 | 8 1/2 | 5 7/16 | 612 | 391 |
| Metric Royal Quarto | 312 | 237 | 12 1/4 | 9 5/16 | 884 | 672 |
| Metric Royal Octavo | 198 | 129 | 7 13/16 | 5 1/16 | 561 | 366 |
Monday, 16 January 2012
convert doube DATE to CTime c++
DATE dt = spJMessage->GetDate();
SYSTEMTIME st;
COleDateTime d(dt);
d.GetAsSystemTime(st);
CTime tm(st);
CString m_emailDate;
m_emailDate.Format("%.2d/%.2d/%.4d",tm.GetDay(),tm.GetMonth(),tm.GetYear());
SYSTEMTIME st;
COleDateTime d(dt);
d.GetAsSystemTime(st);
CTime tm(st);
CString m_emailDate;
m_emailDate.Format("%.2d/%.2d/%.4d",tm.GetDay(),tm.GetMonth(),tm.GetYear());
Wednesday, 4 January 2012
convert std wstring to std string c++
BSTR bstr = SysAllocString(strMessage.c_str());
_bstr_t bstr1(bstr);
std::string str(bstr1);
SysFreeString(bstr);
_bstr_t bstr1(bstr);
std::string str(bstr1);
SysFreeString(bstr);
Subscribe to:
Posts (Atom)