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;
}
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.
Saturday, 18 June 2011
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.
That will run VBS in 32 bit mode.
You can register the DLL in 64 bit or 32 bit mode.
Monday, 13 June 2011
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.
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);
#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!
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
#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' };
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)
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)
Subscribe to:
Posts (Atom)