typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL); bool Is64BitWindows() { #if defined(_WIN64) return true; // 64-bit programs run only on Win64 #elif defined(_WIN32) // 32-bit programs run on both 32-bit and 64-bit Windows // so must sniff BOOL f64 = FALSE; LPFN_ISWOW64PROCESS fnIsWow64Process; fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(GetModuleHandle(TEXT("kernel32")), "IsWow64Process"); if (NULL != fnIsWow64Process) { return !!(fnIsWow64Process(GetCurrentProcess(),… Continue reading How to check Windows or process is 64bit
Category: Windows
Refresh the taskbar of Windows 10
Sometimes windows 10 taskbar failed to draw the application icon. ie4uinit.exe can fix it. Create the following batch file and run it. REM @echo off set "UTIL=%SystemRoot%\System32\ie4uinit.exe" IF NOT EXIST %UTIL% ( set "UTIL=%SystemRoot%\Sysnative\ie4uinit.exe" ) %UTIL% -ClearIconCache %UTIL% -showREM @echo off set "UTIL=%SystemRoot%\System32\ie4uinit.exe" IF NOT EXIST %UTIL% ( set "UTIL=%SystemRoot%\Sysnative\ie4uinit.exe" ) %UTIL% -ClearIconCache… Continue reading Refresh the taskbar of Windows 10
Reading EPWING dictionaries with Dicregate
1,Obtain any EPWING dictionaries. 2,Open Dicregate.exe 3,Select [Dictionary]->[Add Dictionary]->[Electronic Dictionary] 4,Choose the dictionary folder, the folder that includes a file named “CATALOGS”
How to use VB regex in VC6
1,Open “OLE/COM object viewer” from Tool menu of VC6. 2,Find “Microsoft VBScript Regular Expressions 5.5” under “Type Libraries”. 3, Double click the node to open with “ITypeLib Viewer”. 4, Choose “Save As” and save as “vbscript.IDL”. 5, Run “midl vbscript.idl” in Command Propmt. midl.exe is typically located under “C:\Program Files\Microsoft Visual Studio\VC98\Bin”. This creates “vbscript.tlb”.… Continue reading How to use VB regex in VC6
How to move file to a trash
Use SHFileOperation(). #include <windows.h> #include <tchar.h> #include <assert.h> #include <malloc.h> #include "SHDeleteFile.h" BOOL SHDeleteFile(LPCTSTR lpFile) { size_t len = _tcslen(lpFile); if(!lpFile || lpFile[0]==0 || len <= 3) return FALSE; // only fullpath allowed do { #ifndef UNICODE if (IsDBCSLeadByte((BYTE)lpFile[0])) return FALSE; #endif if( lpFile[0]==_T(’\\’) && lpFile[1]==_T(’\\’) ) break; if( lpFile[1] ==… Continue reading How to move file to a trash
Add a debug console to your windows gui application
Call AllocConsole() at the beginning of your application. Only one console can be allocated for a process. Next, call WriteConsole to show a text. void CMyApp::LogDebug(LPCSTR p) { if(m_bAppDebug) { DWORD d; WriteConsoleA( GetStdHandle(STD_OUTPUT_HANDLE), (CONST VOID *)p, strlen(p), &d, NULL ); WriteConsoleA( GetStdHandle(STD_OUTPUT_HANDLE), (CONST VOID *)"\r\n", 2, &d, NULL ); } }void CMyApp::LogDebug(LPCSTR p)… Continue reading Add a debug console to your windows gui application