Einzelnen Beitrag anzeigen

SlpLow

Registriert seit: 4. Nov 2013
28 Beiträge
 
#1

Hilfe beim Übersetzen von C zu Delphi

  Alt 18. Nov 2013, 17:47
Hallo liebe! Benötige Hilfe übersetzen bei VC++ zu Delphi!

VC++
....

Delphi-Quellcode:
void EditWIMFile(HANDLE hImg, int imgNum, LPWSTR pName, LPWSTR pDesc)
{
//Get the info and divide it into two strings
WCHAR *ImgInfoBuf, TempString[100];
DWORD ImgInfoBufSize;
WIMGetImageInformation(hImg, (LPVOID *)&ImgInfoBuf, &ImgInfoBufSize);
wsprintf(TempString, TEXT("<IMAGE INDEX=\"%d\">"), imgNum);
WCHAR *StringPointer = wcsstr(ImgInfoBuf, TempString); 
WCHAR *SecondString = wcsstr(++StringPointer, TEXT("<"));
SecondString[-1] = 0; //end the first string 

//Copy the first string to a new buffer and add our extra info
WCHAR *NewInfoBuf = (WCHAR *)LocalAlloc(LPTR, ImgInfoBufSize + 200 * sizeof(WCHAR));
lstrcpy(NewInfoBuf, ImgInfoBuf);
if (*pName) {
wsprintf(TempString, TEXT(" <NAME>%s</NAME>\n  "), pName);
lstrcat(NewInfoBuf, TempString);
}

if (*pDesc) {
if (*pName)
wsprintf(TempString, TEXT("<DESCRIPTION>%s</DESCRIPTION>\n  "), pDesc);
else
wsprintf(TempString, TEXT(" <DESCRIPTION>%s</DESCRIPTION>\n  "), pDesc);
lstrcat(NewInfoBuf, TempString);
}

//Add the second string to the new buffer and reset the info in the file
lstrcat(NewInfoBuf, SecondString);
WIMSetImageInformation(hImg, NewInfoBuf, wcslen(NewInfoBuf) * sizeof(WCHAR));

//Free the storage
LocalFree(ImgInfoBuf);
LocalFree(NewInfoBuf);
}
....

Geändert von SlpLow (19. Nov 2013 um 04:57 Uhr)
  Mit Zitat antworten Zitat