监视压缩器和解压缩器进度
以下示例演示如何使用 ICSetStatusProc 函数向压缩器或解压缩器通知回调函数地址:
ICSetStatusProc(compvars.hic, 0, (LPARAM) (UINT) hwndApp,
&PreviewStatusProc);
以下示例演示由上一个片段安装的回调函数:
LONG CALLBACK export PreviewStatusProc(LPARAM lParam,
UINT message, LONG l)
{
switch (message)
{
MSG msg;
case ICSTATUS_START:
// Create and display status dialog box.
break;
case ICSTATUS_STATUS:
ProSetBarPos((int) l); // sets status bar positions
// Watch for abort message
while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
if (msg.message == WM_KEYDOWN && msg.wParam ==
VK_ESCAPE)
return 1;
if (msg.message == WM_SYSCOMMAND &&
(msg.wParam & 0xFFF0) == SC_CLOSE)
return 1;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
break;
case ICSTATUS_END:
// Close and destroy status dialog box.
break;
case ICSTATUS_YIELD:
break;
}
return 0;
}