var pbCancel: PLongBool;
pbCancel = nil;
...
pbCancel = PLongBool(LParam);
pbCancel^ = false;
이창수 님이 쓰신 글 :
: 참고:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd834943.aspx
:
: 위에 있는 코드를 델파이로 포팅 중에 제대로 작동이 되는 부분이 있어서 도움을 요청드립니다.
:
: #include <stdio.h>
: #include <windows.h>
: #include "wimgapi.h"
: #pragma comment(lib, "wimgapi.lib")
: //
: // Callback function:
: //
: DWORD
: WINAPI
: SampleCaptureCallback(
: DWORD dwMsgId, // Message ID
: WPARAM wParam, // Usually a file name
: LPARAM lParam, // Usually an error code
: PVOID pvIgnored // Used to maintain caller context. Not used in this code sample.^
: )
: {
: PBOOL pbCancel = NULL;
:
: // BOOL *msg_back = (BOOL *)lParam;
:
: switch (dwMsgId)
: {
: case WIM_MSG_PROCESS:
: if ( wcsstr((PWSTR)wParam, TEXT("\\hiberfil.sys")) ||
: wcsstr((PWSTR)wParam, TEXT("\\pagefile.sys")) ||
: wcsstr((PWSTR)wParam, TEXT("\\System Volume Information")) ||
: wcsstr((PWSTR)wParam, TEXT("\\$Recycle.Bin")) ||
: wcsstr((PWSTR)wParam, TEXT("\\Windows\\CSC")) )
: {
: wprintf(L">>>> FilePath: %s\n", (PWSTR)wParam);
: // *msg_back = FALSE;
: pbCancel = (PBOOL)lParam;
: *pbCancel = FALSE;
: break;
: }
: wprintf(L"FilePath: %s\n", (PWSTR)wParam);
:
: // To cancel processing on this file, use:
: //
: // pbCancel = (PBOOL)lParam;
: // *pbCancel = TRUE;
:
: break;
:
: case WIM_MSG_ERROR:
:
: // This message is sent when an error is reported.
: //
: wprintf(L"ERROR: %s [err = %d]\n", (PWSTR)wParam, (DWORD)lParam);
: break;
:
: case WIM_MSG_RETRY:
:
: // This message is sent when the file is being reapplied because of a
: // network timeout. Retry is attempted up to five times.
: //
: wprintf(L"RETRY: %s [err = %d]\n", (PWSTR)wParam, (DWORD)lParam);
: break;
:
: case WIM_MSG_INFO:
:
: // This message is sent when an informational message is available.
: //
: wprintf(L"INFO: %s [err = %d]\n", (PWSTR)wParam, (DWORD)lParam);
: break;
:
: case WIM_MSG_WARNING:
:
: // This message is sent when a warning message is available.
: //
: wprintf(L"WARNING: %s [err = %d]\n", (PWSTR)wParam, (DWORD)lParam);
: break;
: }
:
: //
: // To abort image processing, return WIM_MSG_ABORT_IMAGE. Not all message types
: // check for this status. When you decide to cancel an image, it may take repeated
: // returns of this status before WIMGAPI can perform the cancelation.
: //
:
: return WIM_MSG_SUCCESS;
: }
:
: 위의 컬백함수에서
: 지금 제게 문제가 되는 부분은 코드 중에...
:
: pbCancel = (PBOOL)lParam;
: *pbCancel = FALSE;
: 이 부분입니다.
: 이미지로 캡처를 하려는 원본에 지정한 파일이 있으면 제외하고 캡처를 하는 부분인데...
: VC++로 빌드를 해보면 원하는대로 잘 처리가 됩니다.
: 참고로 pbCancel을 주석 처리하고 지금 주석처리 되어있는
:
: BOOL *msg_back = (BOOL *)lParam;
: *msg_back = FALSE;
:
: 이렇게 해도 되고, 두 개가 다 잘 작옹을 합니다.
:
: 그런데 델파이에서는 제가 포인터의 타입캐스팅에 문외한이라 그런지 별 짓을 다 해봐도 원하는 결과를 얻을 수가 없습니다.
: 어떻게 해야할지 부디 도움을 요청드립니다.
:
: 감사합니다.