Click here to Skip to main content
15,899,754 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Template for experts!! help Pin
Anonymous25-Aug-03 10:19
Anonymous25-Aug-03 10:19 
GeneralRe: Template for experts!! help Pin
Joaquín M López Muñoz25-Aug-03 10:27
Joaquín M López Muñoz25-Aug-03 10:27 
Questionhow to show data in internet explorer Pin
Binayak25-Aug-03 8:20
Binayak25-Aug-03 8:20 
AnswerRe: how to show data in internet explorer Pin
PremL26-Aug-03 5:39
PremL26-Aug-03 5:39 
Generalusing CArchive with CBlockingSocket class Pin
Mike Ellertson25-Aug-03 7:56
sussMike Ellertson25-Aug-03 7:56 
GeneralRe: using CArchive with CBlockingSocket class Pin
Mikey_E25-Aug-03 8:30
professionalMikey_E25-Aug-03 8:30 
GeneralProblem with MFC create control for component Pin
tongc25-Aug-03 7:13
tongc25-Aug-03 7:13 
GeneralSHGetFileInfo Pin
Member 50856725-Aug-03 7:02
Member 50856725-Aug-03 7:02 
I want get a associated icon from a file system (for example c:\test.doc") using SHGetFileInfo function and save it in a file (for ex "C:\myicon.ico").
But GlobalSize and GlobalLock returns 0 (invalid value!!!).
I've read an IconPro example (in vs6example.exe) but I didn't found a good solution!
Please give me a good idea!
Tnk you

/******MY CODE*****/

CString nomefile = "c:\\test.doc";
HICON hGen32Icon;
HIMAGELIST hSysImageList;
SHFILEINFO shfi;
int fh;
UINT uiSize;
DWORD dwSize;
LPVOID lpGMem;
OFSTRUCT of;

hSysImageList = (HIMAGELIST)SHGetFileInfo
(nomefile,
0,
&shfi,
sizeof (SHFILEINFO),
SHGFI_SYSICONINDEX | SHGFI_SMALLICON);

hGen32Icon = ImageList_GetIcon (hSysImageList,
shfi.iIcon,
ILD_NORMAL);


dwSize = GlobalSize(hIcon); /*Don't work*/
lpGMem = GlobalLock(hIcon); /*Don't work*/

fh = OpenFile ("c:\\myicon.ico", &of, OF_WRITE | OF_CREATE);
if (fh == -1) // If NOT opened successfully.
{
MessageBox("Unable to create file", NULL, MB_OK );
}

uiSize = _lwrite(fh, (LPSTR)lpGMem, (UINT)dwSize);
_lclose(fh);



GeneralRe: SHGetFileInfo Pin
David Crow25-Aug-03 8:06
David Crow25-Aug-03 8:06 
GeneralRe: SHGetFileInfo Pin
Member 50856726-Aug-03 2:36
Member 50856726-Aug-03 2:36 
GeneralCommit to Disk Pin
jmf31415925-Aug-03 6:40
jmf31415925-Aug-03 6:40 
GeneralRe: Commit to Disk Pin
Neville Franks25-Aug-03 10:43
Neville Franks25-Aug-03 10:43 
GeneralRe: Commit to Disk Pin
jmf31415925-Aug-03 11:43
jmf31415925-Aug-03 11:43 
GeneralRe: Commit to Disk Pin
Neville Franks25-Aug-03 12:03
Neville Franks25-Aug-03 12:03 
GeneralRe: Commit to Disk Pin
parths25-Aug-03 15:25
parths25-Aug-03 15:25 
GeneralGibberish code Pin
dog_spawn25-Aug-03 15:06
dog_spawn25-Aug-03 15:06 
QuestionApplication-Close/Minimize effect, where? Pin
Exim25-Aug-03 6:39
Exim25-Aug-03 6:39 
AnswerRe: Application-Close/Minimize effect, where? Pin
Mikey_E25-Aug-03 10:16
professionalMikey_E25-Aug-03 10:16 
GeneralAutosrolling in an CEdit Pin
Bateman25-Aug-03 6:07
Bateman25-Aug-03 6:07 
Generalrefference a pointer to another process !!! Pin
mr200325-Aug-03 5:46
mr200325-Aug-03 5:46 
GeneralRe: refference a pointer to another process !!! Pin
valikac25-Aug-03 5:54
valikac25-Aug-03 5:54 
GeneralRe: refference a pointer to another process !!! Pin
Babayan Hovhannes26-Aug-03 0:04
Babayan Hovhannes26-Aug-03 0:04 
GeneralRe: refference a pointer to another process !!! Pin
mr200326-Aug-03 6:41
mr200326-Aug-03 6:41 
GeneralDev studio question for experts Pin
YaronNir25-Aug-03 4:12
YaronNir25-Aug-03 4:12 
GeneralRe: Dev studio question for experts Pin
valikac25-Aug-03 5:56
valikac25-Aug-03 5:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.