Missing IContextMenu ?
I am building a shell extension project in VS2005 IDE which is converted from VC++ 6.0. During buid I am getting the following error
"error C2787: 'IContextMenu' : no GUID has been associated
with this object", but The same project works fine in VC++ 6.0.
Doug Harrison (VC++ MVP) responded to query and solved it in one go!, following was his reply
"
This is interesting. There are two <comdef.h> header files in VC.NET, one in
Vc7/include and the other in Vc7/PlatformSDK/include. The former splits off
the smart pointer typedefs into comdefsp.h, and it doesn't include
IContextMenu. The latter does. You can try to #include the PlatformSDK
header directly, change your INCLUDE path order, or supply the missing
typedef yourself, e.g.
struct __declspec(uuid("000214e4-0000-0000-c000-000000000046"))
IContextMenu;_COM_SMARTPTR_TYPEDEF(IContextMenu, __uuidof(IContextMenu));
"
How to launch Windows Picture and Fax Viewer programmatically?
My fellow cpian Rajesh R Subramanian in codeproject visual c++ forums answer this question, here what he replied for above question :-
The code which does the stuff is within shimgvw.dll. try ShellExecute() with "open", and pass this as the path
rundll32.exe C:\WINDOWS\System32\shimgvw.dll, ImageView_Fullscreen C:\\myimage.jpg
How to identify the architecture of given binary file?
Sometimes programmer requires to know the architecture of binary file, i.e. it's belong to x32 architecture or x64 architecture. recently at codeproject(My Fav programmer site), Randor , has replied to this query, here he created a small function, that could help you to determine the architecture of app! :-
DWORD GetPEMachineType(LPTSTR sz)
{
 HANDLE hFile = CreateFile(sz,GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
 if(NULL != hFile)
 {
 LARGE_INTEGER bigInt;
 BOOL diditWork = GetFileSizeEx(hFile, &bigInt);
 HANDLE hFileMap = CreateFileMapping(hFile,
 NULL,
 PAGE_READWRITE,
 bigInt.HighPart,
 bigInt.LowPart + 0x2000 ,
 _T("someGUID"));if(NULL != hFileMap)
 {
 LPVOID hMap = MapViewOfFile(hFileMap,FILE_MAP_READ,0,0,0);if(NULL != hMap)
 {
 HMODULE hModule = (HMODULE)hMap;
 IMAGE_DOS_HEADER * pDosHeader = (IMAGE_DOS_HEADER *)hModule;
 IMAGE_FILE_HEADER * pFileHeader = (IMAGE_FILE_HEADER *)(((LPBYTE)hModule)
 + pDosHeader->e_lfanew +
 sizeof(IMAGE_NT_SIGNATURE));return pFileHeader->Machine;
 }
 }
 }
}
and possible returns could be
| Constant Name | Original Value | Description |
|---|---|---|
| Â IMAGE_FILE_MACHINE_UNKNOWN | Â 0x0 | Â The contents of this field are assumed to be applicable to any machine type |
| Â IMAGE_FILE_MACHINE_AM33 Â | Â 0x1d3 Â | Â Matsushita AM33 IMAGE_FILE_MACHINE_AMD64 0x8664 x64 |
| Â IMAGE_FILE_MACHINE_ARM | Â 0x1c0 Â | Â ARM little endian |
|  IMAGE_FILE_MACHINE_EBC |  0xebc  |  EFI byte code |
|  IMAGE_FILE_MACHINE_I386 |  0x14c  |  Intel 386 or later processors and compatible processors |
| Â IMAGE_FILE_MACHINE_IA64 | Â 0x200 Â | Â Intel Itanium processor family |
| Â Â IMAGE_FILE_MACHINE_M32R | Â 0x9041 Â | Â Mitsubishi M32R little endian |
| Â IMAGE_FILE_MACHINE_MIPS16 | Â 0x266 Â | Â MIPS16 |
| Â IMAGE_FILE_MACHINE_MIPSFPU | Â 0x366 Â | Â MIPS with FPU |
| Â IMAGE_FILE_MACHINE_MIPSFPU16 Â | Â 0x466 Â | Â MIPS16 with FPU |
| Â IMAGE_FILE_MACHINE_POWERPC | Â 0x1f0 Â | Â Power PC little endian |
| Â IMAGE_FILE_MACHINE_POWERPCFP | Â 0x1f1 Â | Â Power PC with floating point support |
| Â IMAGE_FILE_MACHINE_R4000 | Â 0x166 Â | Â MIPS little endian |
| Â IMAGE_FILE_MACHINE_SH3 | Â 0x1a2 Â | Â Hitachi SH3 |
| Â IMAGE_FILE_MACHINE_SH3DSP | Â 0x1a3 Â | Â Hitachi SH3 DSP Â |
| Â IMAGE_FILE_MACHINE_SH4 | Â 0x1a6 Â | Â Hitachi SH4 |
| Â IMAGE_FILE_MACHINE_SH5 Â | Â 0x1a8 Â | Â Hitachi SH5 |
| Â IMAGE_FILE_MACHINE_THUMB | Â 0x1c2 Â | Â Thumb |
| Â IMAGE_FILE_MACHINE_WCEMIPSV2 | Â 0x169 Â | Â Â MIPS little-endian WCE v2 |
Also there is one more function in ImageHlp library which is do above task :- MapAndLoad