LRESULT CALLBACK ScreensaverProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { MATRIX* matrix = GetMatrix(hwndDlg); switch(uMsg) { case WM_NCCREATE: _ShowCursor(0); matrix = CreateMatrix(hwndDlg, ((CREATESTRUCT*)lParam)->cx, ((CREATESTRUCT*)lParam)->cy); if(!matrix) { MessageBox(hwndDlg, L"Ошибка работы скринсейвера", L"Ошибка", MB_OK | MB_ICONSTOP); return 0; } SetMatrix(hwndDlg, matrix); SetTimer(hwndDlg, 0xdeadbeef, ((SPEED_MAX - g_nMatrixSpeed) + SPEED_MIN) * 10, 0); return 1; case WM_TIMER: DecodeMatrix(hwndDlg, matrix); break; case WM_KEYDOWN: if(wParam == VK_ESCAPE) SendMessage(hwndDlg, WM_CLOSE, 0, 0); break; case WM_CLOSE: _ShowCursor(1); DestroyMatrix(matrix); DestroyWindow(hwndDlg); PostQuitMessage(0); break; default: return DefWindowProc(hwndDlg, uMsg, wParam, lParam); } return 0; }
int main(int argc, char **argv) { char dcname[40]; if( argc < 2 ) { printf("usage: %s objects...\n",argv[0]); exit(1); } argv++; for( ; *argv != NULL; argv++ ) { char *name = *argv; char *s; ObjInfo info; char *type; char tt[20]; if( ObjectInfo(CurrentDir,name,(byte *)&info) != 0 ) { fprintf(stderr,"could not locate %s : %x\n",name,Result2(CurrentDir)); continue; } switch( info.DirEntry.Type ) { case Type_Directory: type = "d"; break; case Type_File: type = "f"; break; case Type_Link: type = "l"; break; default: type = tt; sprintf(tt,"%x",info.DirEntry.Type); break; } DecodeMatrix(dcname,info.DirEntry.Matrix,info.DirEntry.Type); printf("%s %s %s\n",type,dcname,info.DirEntry.Name); } return 0; }