-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathmain.cpp
79 lines (73 loc) · 1.75 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include <stdio.h>
#include <windows.h>
#include <commctrl.h>
#include <shlwapi.h>
#include "resource.h"
#define MAXLEN 1024
#define LISTFILE "files1149761294.txt"
#define RAWCMD "ffmpeg -f concat -safe 0 -i files1149761294.txt -c copy \"%s\[merged]%s\""
HINSTANCE hInst;
int ProcessFiles(HWND hwndDlg,char (*files)[MAXLEN],int dropcount){
FILE *fp=fopen(LISTFILE,"w");
char cmd[MAXLEN],path[MAXLEN],*filename;
int i;
if(!fp){
MessageBox(hwndDlg,"创建临时文件失败!","错误",MB_ICONERROR);
return -1;
}
for(i=0;i<dropcount;i++){
fprintf(fp,"file '%s'\n",files[i]);
}
fclose(fp);
filename=PathFindFileName(files[0]);
strncpy(path,files[0],filename-files[0]);
path[filename-files[0]]=0;
sprintf(cmd,RAWCMD,path,filename);
system(cmd);
DeleteFile(LISTFILE);
return 0;
}
BOOL CALLBACK DlgMain(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
//初始化对话框
case WM_INITDIALOG:
{
}
return TRUE;
//关闭对话框
case WM_CLOSE:
{
EndDialog(hwndDlg, 0);
}
return TRUE;
//丢文件
case WM_DROPFILES:
{
char files[100][MAXLEN];
char buf[MAXLEN];
HDROP hdrop=(HDROP)wParam;
int i,dropcount=DragQueryFile(hdrop,-1,0,0);
for(i=0;i<dropcount;i++){
DragQueryFile(hdrop,i,files[i],MAXLEN);
}
ProcessFiles(hwndDlg,files,dropcount);
}
return TRUE;
case WM_COMMAND:
{
switch(LOWORD(wParam))
{
}
}
return TRUE;
}
return FALSE;
}
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
hInst=hInstance;
InitCommonControls();
return DialogBox(hInst, MAKEINTRESOURCE(DLG_MAIN), NULL, (DLGPROC)DlgMain);
}