0
// Obtain a handle to a reference device context.
HDC hdcRef = GetDC(hwnd);
// Determine the picture frame dimensions.
int iWidthMM = GetDeviceCaps(hdcRef, HORZSIZE);
int iHeightMM = GetDeviceCaps(hdcRef, VERTSIZE);
int iWidthPels = GetDeviceCaps(hdcRef, HORZRES);
int iHeightPels = GetDeviceCaps(hdcRef, VERTRES);
// Retrieve the coordinates of the client
// rectangle, in pixels.
RECT rect;
GetClientRect(hwnd, &rect);
// Convert client coordinates to .01-mm units.
// Use iWidthMM, iWidthPels, iHeightMM, and
// iHeightPels to determine the number of
// .01-millimeter units per pixel in the x-
// and y-directions.
rect.left = (rect.left * iWidthMM * 100)/iWidthPels;
rect.top = (rect.top * iHeightMM * 100)/iHeightPels;
rect.right = (rect.right * iWidthMM * 100)/iWidthPels;
rect.bottom = (rect.bottom * iHeightMM * 100)/iHeightPels;
// Create the metafile device context.
CreateEnhMetaFile(hdcRef, (LPTSTR)"temp.emf", &rect, NULL);
// Release the reference device context.
ReleaseDC(hwnd, hdcRef);
내가 결국 가지고 모든 일부 0 바이트 비입니다 코드 here
툭 이상하게 인코딩 된 이름을 가진 확장 파일, 정 灭 攮 sm 같은 smth.
무엇이 문제 일 수 있습니까?
P. 또한, 나는 C#에서 C++/cli 객체를 통해 혼합 모드 응용 프로그램에서 호출하고 있습니다.
EDIT 이상한 인코딩 문제는 해결되었지만 만들어진 파일은 여전히 0 바이트 길이입니다. 어떻게 해결 될 수 있습니까?
@ tube-builder 그래, 나 버그에 대한 꽤 좋은 설명 인 것 같아 놀랍다. – john
지옥, 정말 죄송합니다. 세심한주의를 기울이지 않았습니다. 이제 파일이 생성되었습니다 (여전히 비어 있습니다). 고마워요! –
btw 생성 된 파일이 여전히 0 바이트 크기 일 수있는 이유는 무엇입니까? 나는 그것에 관해 얼간이를 찾으려고 노력했다. 그러나 지금까지 실패했다. C++과 전혀 관련이 없습니다. –