Click here to Skip to main content
15,917,606 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: DialogBox of win32 dll Pin
Manjunath S25-Aug-06 3:02
Manjunath S25-Aug-06 3:02 
GeneralRe: DialogBox of win32 dll Pin
prasad_som25-Aug-06 3:08
prasad_som25-Aug-06 3:08 
QuestionDefault edit/richeditctrl text selection allows easy delete after tab key to control. Pin
lctrncs24-Aug-06 8:17
lctrncs24-Aug-06 8:17 
AnswerRe: Default edit/richeditctrl text selection allows easy delete after tab key to control. Pin
David Crow24-Aug-06 9:14
David Crow24-Aug-06 9:14 
AnswerRe: Default edit/richeditctrl text selection allows easy delete after tab key to control. [modified] Pin
Justin Tay24-Aug-06 9:17
Justin Tay24-Aug-06 9:17 
GeneralRe: Default edit/richeditctrl text selection allows easy delete after tab key to control. Pin
lctrncs24-Aug-06 14:32
lctrncs24-Aug-06 14:32 
GeneralRe: Default edit/richeditctrl text selection allows easy delete after tab key to control. Pin
Justin Tay24-Aug-06 15:30
Justin Tay24-Aug-06 15:30 
GeneralRe: Default edit/richeditctrl text selection allows easy delete after tab key to control. Pin
lctrncs24-Aug-06 15:33
lctrncs24-Aug-06 15:33 
GeneralRe: Default edit/richeditctrl text selection allows easy delete after tab key to control. Pin
Justin Tay24-Aug-06 15:47
Justin Tay24-Aug-06 15:47 
GeneralRe: Default edit/richeditctrl text selection allows easy delete after tab key to control. Pin
lctrncs24-Aug-06 21:21
lctrncs24-Aug-06 21:21 
GeneralRe: Default edit/richeditctrl text selection allows easy delete after tab key to control. Pin
lctrncs25-Aug-06 3:55
lctrncs25-Aug-06 3:55 
QuestionApp Icon not showing correctly on desktop Pin
$motty24-Aug-06 8:05
$motty24-Aug-06 8:05 
AnswerRe: App Icon not showing correctly on desktop Pin
Waldermort24-Aug-06 8:34
Waldermort24-Aug-06 8:34 
GeneralRe: App Icon not showing correctly on desktop Pin
$motty24-Aug-06 12:04
$motty24-Aug-06 12:04 
GeneralRe: App Icon not showing correctly on desktop Pin
Waldermort24-Aug-06 14:37
Waldermort24-Aug-06 14:37 
GeneralRe: App Icon not showing correctly on desktop Pin
$motty24-Aug-06 20:58
$motty24-Aug-06 20:58 
GeneralRe: App Icon not showing correctly on desktop Pin
Waldermort24-Aug-06 22:51
Waldermort24-Aug-06 22:51 
GeneralRe: App Icon not showing correctly on desktop [modified] Pin
$motty25-Aug-06 4:53
$motty25-Aug-06 4:53 
Questionsend message to Yahoo user Pin
Silly Boy24-Aug-06 7:15
Silly Boy24-Aug-06 7:15 
QuestionRe: send message to Yahoo user Pin
David Crow24-Aug-06 7:37
David Crow24-Aug-06 7:37 
AnswerRe: send message to Yahoo user Pin
jk chan24-Aug-06 14:27
jk chan24-Aug-06 14:27 
AnswerRe: send message to Yahoo user Pin
ThatsAlok24-Aug-06 18:08
ThatsAlok24-Aug-06 18:08 
QuestionChanging bitmaps using UpdateResource Pin
Kharfax24-Aug-06 7:09
Kharfax24-Aug-06 7:09 
Hi people, im using Update Resource to change a Bitmap in a DLL.

The bitmap is beign changed, but the new added bitmap hasn't a valid format.

I found this at expert exchange
char* buf = (char*)HeapAlloc (GetProcessHeap(), 0, dwFileSize + 2);
memcpy (buf, &dwFileSize, sizeof (dwFileSize));
memcpy (buf + 4, lpBuffer + 2, dwFileSize - 2);

This guy said that the resource BMP dont start with BM, instead the first 4 bytes are the lenght of the resource.
But a working BMP in the DLL begins with BM.

I tried without that code and the newly added BMP has an invalid format anyway.

Any suggestion??

Thanks a lot people Big Grin | :-D




HANDLE hFile;<br />
	DWORD dwFileSize, dwBytesRead;<br />
	LPBYTE lpBuffer;<br />
<br />
	hFile = CreateFile("test.bmp", GENERIC_READ, <br />
                   0,<br />
                   NULL,<br />
                   OPEN_EXISTING,<br />
                   FILE_ATTRIBUTE_NORMAL,<br />
                   NULL);<br />
<br />
	if (INVALID_HANDLE_VALUE != hFile)<br />
	{<br />
		dwFileSize = GetFileSize(hFile, NULL);<br />
<br />
		lpBuffer = new BYTE[dwFileSize];<br />
<br />
		if (ReadFile(hFile, lpBuffer, dwFileSize, &dwBytesRead, NULL) != FALSE)<br />
	  {<br />
<br />
<br />
                  /// I found this at experts exchange<br />
		  char* buf = (char*)HeapAlloc (GetProcessHeap(), 0, dwFileSize + 2);<br />
		  memcpy (buf, &dwFileSize, sizeof (dwFileSize));<br />
		  memcpy (buf + 4, lpBuffer + 2, dwFileSize - 2);<br />
<br />
<br />
		  <br />
			if( UpdateResource( targetModule,<br />
								RT_BITMAP,<br />
								MAKEINTRESOURCE(1002),<br />
								MAKELANGID(LANG_SPANISH,SUBLANG_SPANISH_ARGENTINA),<br />
								(LPVOID)buf,<br />
								 sizeof(buf))) {<br />
<br />
									MessageBox("Update OK", NULL, MB_OK);<br />
	<br />
								}<br />
			else {<br />
				MessageBox("Error in update", NULL, MB_OK);<br />
			}<br />
<br />
			//Cierro edicion de recursos<br />
			if(EndUpdateResource(targetModule, FALSE)) <br />
				MessageBox("Res changed", "ERROR", MB_OK);<br />
			else<br />
				MessageBox("Error updating res", "ERROR", MB_OK);<br />
        <br />
		    <br />
	  }<br />
<br />
    delete [] lpBuffer;        <br />
    <br />
    CloseHandle(hFile);<br />
}

AnswerRe: Changing bitmaps using UpdateResource Pin
David Crow24-Aug-06 7:36
David Crow24-Aug-06 7:36 
GeneralRe: Changing bitmaps using UpdateResource Pin
Kharfax24-Aug-06 7:46
Kharfax24-Aug-06 7:46 

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.