Click here to Skip to main content
15,887,214 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Readfile from *.txt Pin
Michael Dunn25-Jul-04 11:33
sitebuilderMichael Dunn25-Jul-04 11:33 
GeneralDisabling/enabling menu/toolbar items... Pin
0v3rloader25-Jul-04 7:14
0v3rloader25-Jul-04 7:14 
GeneralRe: Disabling/enabling menu/toolbar items... Pin
Ivan Cachicatari25-Jul-04 11:44
Ivan Cachicatari25-Jul-04 11:44 
GeneralRe: Disabling/enabling menu/toolbar items... Pin
0v3rloader25-Jul-04 11:57
0v3rloader25-Jul-04 11:57 
GeneralRe: Disabling/enabling menu/toolbar items... Pin
Ravi Bhavnani25-Jul-04 13:33
professionalRavi Bhavnani25-Jul-04 13:33 
GeneralSolution for globally listening to keys pressed Pin
0v3rloader25-Jul-04 6:59
0v3rloader25-Jul-04 6:59 
GeneralRe: Solution for globally listening to keys pressed Pin
PJ Arends25-Jul-04 10:13
professionalPJ Arends25-Jul-04 10:13 
Questionhow to pass a simple char* to a unicode binary text?? Pin
youpiyoyo25-Jul-04 5:45
youpiyoyo25-Jul-04 5:45 
My purpose is to pass an icon to the resource of a file or dll. If you have any sugestions..

for that I have to use UpdateResource

so I did that

hUpdateRes = BeginUpdateResource("D:\\Bureau\\ressource\\test resource\\test resource.exe", FALSE); <br />
if (hUpdateRes == NULL) <br />
{ <br />
    MessageBox(0,"Could not open file for writing.",0,0); <br />
} <br />
 <br />
// Add the dialog box resource to the update list. <br />
result = UpdateResource(hUpdateRes,RT_ICON,szTitre,MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),ico,1384); // size of resource info. <br />
if (result == FALSE) <br />
{ <br />
    MessageBox(0,"Could not add resource.",0,0); <br />
} <br />
 <br />
<br />
if (!EndUpdateResource(hUpdateRes, FALSE)) <br />
{ <br />
    MessageBox(0,"Could not write changes to file.",0,0); <br />
} 


1384 reprsente the exact size of the ico, I will chage it with sizeof or somethingelse

my problem is ico

acording to msdn ico, so the LPVOID lpData must be in "raw binary data" and the "text must be in Unicode format"

so I try that

char* ico;<br />
wchar_t *wchar=(wchar_t *)malloc( sizeof( wchar_t ) );<br />
<br />
_setmode( _fileno( stdin ), _O_BINARY ); <br />
FILE* file=fopen(szFile,"rb");<br />
FILE* filedest=fopen("dest.ico","w");<br />
fpos_t pos;<br />
if(fseek(file, 0,SEEK_END)!=0)MessageBox(0,"fseek erreur",0,0);<br />
else<br />
{<br />
	if( fgetpos( file, &pos ) == 0 )<br />
	{<br />
<br />
		ico=(char*) malloc((size_t)pos);<br />
		fseek(file, 0,SEEK_SET);<br />
		fread(ico, sizeof( char ), (int)pos, file );<br />
		//wctomb(&ico,wchar);<br />
		mbtowc( wchar ,ico,MB_CUR_MAX );<br />
	}<br />
}<br />
fclose(file);<br />
fclose(filedest);


I'm not sure about the mbtowc, ...

If have no clue to pass ico in "raw binary data and in Unicode format"

Pleazeeeeeeee help me!!
AnswerRe: how to pass a simple char* to a unicode binary text?? Pin
bikram singh26-Jul-04 7:53
bikram singh26-Jul-04 7:53 
GeneralODBC Database Metadata (All Table names) Pin
omair shafiq25-Jul-04 5:34
omair shafiq25-Jul-04 5:34 
GeneralRe: ODBC Database Metadata (All Table names) Pin
David Crow26-Jul-04 4:05
David Crow26-Jul-04 4:05 
GeneralC reateProcess Pin
Member 75213725-Jul-04 4:04
Member 75213725-Jul-04 4:04 
GeneralRe: C reateProcess Pin
PJ Arends25-Jul-04 10:06
professionalPJ Arends25-Jul-04 10:06 
Generalbandwidth monitoring Pin
Paolo Ponzano25-Jul-04 2:38
Paolo Ponzano25-Jul-04 2:38 
QuestionJumping out of a heavily-nested looping noy by using &quot;goto&quot; statement? Pin
Link260024-Jul-04 17:24
Link260024-Jul-04 17:24 
AnswerRe: Jumping out of a heavily-nested looping noy by using &quot;goto&quot; statement? Pin
Ravi Bhavnani24-Jul-04 17:52
professionalRavi Bhavnani24-Jul-04 17:52 
GeneralRe: Jumping out of a heavily-nested looping noy by using &quot;goto&quot; statement? Pin
Mike Dimmick25-Jul-04 5:30
Mike Dimmick25-Jul-04 5:30 
GeneralRe: Jumping out of a heavily-nested looping noy by using &quot;goto&quot; statement? Pin
peterchen25-Jul-04 6:13
peterchen25-Jul-04 6:13 
GeneralRe: Jumping out of a heavily-nested looping noy by using &quot;goto&quot; statement? Pin
Ravi Bhavnani25-Jul-04 12:01
professionalRavi Bhavnani25-Jul-04 12:01 
AnswerRe: Jumping out of a heavily-nested looping noy by using &quot;goto&quot; statement? Pin
Michael Dunn24-Jul-04 18:22
sitebuilderMichael Dunn24-Jul-04 18:22 
AnswerRe: Jumping out of a heavily-nested looping noy by using &quot;goto&quot; statement? Pin
Johan Rosengren24-Jul-04 20:19
Johan Rosengren24-Jul-04 20:19 
AnswerRe: Jumping out of a heavily-nested looping noy by using &quot;goto&quot; statement? Pin
bikram singh24-Jul-04 21:53
bikram singh24-Jul-04 21:53 
GeneralRe: Jumping out of a heavily-nested looping noy by using &quot;goto&quot; statement? Pin
Kevin McFarlane25-Jul-04 6:52
Kevin McFarlane25-Jul-04 6:52 
GeneralRe: Jumping out of a heavily-nested looping noy by using &quot;goto&quot; statement? Pin
bikram singh26-Jul-04 7:35
bikram singh26-Jul-04 7:35 
GeneralRe: Jumping out of a heavily-nested looping noy by using &quot;goto&quot; statement? Pin
Kevin McFarlane30-Jul-04 8:24
Kevin McFarlane30-Jul-04 8:24 

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.