- Install ffdshow
- Install flvsplitter
- Install Flash Video decoders
- Download dpgtools.
- Extract the dpgtools131.zip. Run dpgenc.exe, drag the flv file into it.
Reference : FLVをDPGに変換する方法
use 'SHFileOperation', which copies, removes, renames or deletes a file system object
C++:
#include <tchar.h>
#include <shellapi.h>
bool DeleteDirectory(LPCTSTR lpszDir, bool noRecycleBin = true)
{
int len = _tcslen(lpszDir);
TCHAR *pszFrom = new TCHAR[len+2];
_tcscpy(pszFrom, lpszDir);
pszFrom[len] = 0;
pszFrom[len+1] = 0;
SHFILEOPSTRUCT fileop;
fileop.hwnd = NULL; // no status display
fileop.wFunc = FO_DELETE; // delete operation
fileop.pFrom = pszFrom; // source file name as double null terminated string
fileop.pTo = NULL; // no destination needed
fileop.fFlags = FOF_NOCONFIRMATION|FOF_SILENT; // do not prompt the user
if(!noRecycleBin)
fileop.fFlags |= FOF_ALLOWUNDO;
fileop.fAnyOperationsAborted = FALSE;
fileop.lpszProgressTitle = NULL;
fileop.hNameMappings = NULL;
int ret = SHFileOperation(&fileop);
delete [] pszFrom;
return (ret == 0);
}
int main()
{
DeleteDirectory("d:\\Test", false);
return 0;
}
reference : How to delete a directory and subdirectories?
在 winxp 遇到一個檔案大小為 0,沒有副檔名的檔案,用del 指令砍不掉,用 unlocker 程式也顯示沒被其它程式佔用。解決的方法就到dos下,執行 dir/x 指令查看此檔案的短檔名,再執行「 del 短檔名」 即可刪除。
先用 spy 得到 wmp 的 windows class 及 caption,並只觀察「WM_COMMAND」message,可發現當 pause、stop、resume 時,wParam 參數
會隨之變化。
C++:
#include <windows.h>
void main(int argc, char** argv)
{
if (argc> 1)
{
int n = atoi(argv[1]);
HWND wmp = FindWindow("WMPlayerApp", "Windows Media Player");
switch(n)
{
case 0: //pause,play
SendMessage(wmp, WM_COMMAND, 18808, 0);
break;
case 1: //stop
SendMessage(wmp, WM_COMMAND, 18809, 0);
break;
case 2: //next
SendMessage(wmp, WM_COMMAND, 18811, 0);
break;
case 3: //prev
SendMessage(wmp, WM_COMMAND, 18810, 0);
break;
case 4: //random
SendMessage(wmp, WM_COMMAND, 18842, 0);
break;
}
}
}
若有一數列為
CODE:
1.0,
0.0,
0.0,
4.2,
3.1,
4.8,
0.0,
7.1,
0.0,
1.0,
2.0,
0.0,
0.0,
1.5,
0.0,
1,1
欲尋找此數列 不為零的群組,並計算此群組的平均
例如
CODE:
1 1.0, avg = 1.0
0.0,
0.0,
2 4.2,
2 3.1, avg = (4.2+3.1+4.8)/3
2 4.8,
0.0,
3 7.1, avg = 7.1
0.0,
4 1.0, avg = (1.0 + 2.0) /2
4 2.0,
0.0,
0.0,
5 1.5, avg = 1.5
0.0,
6 1,1 avg = 1.1
C++:
#include <stdio.h>
void main()
{
int i = 0, preFlag = 0, curFlag = 0;
float fsum = 0.0f;
int n = 0, nReg = 0;
float af[16] = {
1.0,
0.0,
0.0,
4.2,
3.1,
4.8,
0.0,
7.1,
0.0,
1.0,
2.0,
0.0,
0.0,
1.5,
0.0,
1.1
};
for (i = 0 ; i <16; i++)
{
curFlag = (af[i] == 0.0 ? 0 : 1);
if (preFlag == 0 && curFlag == 1)
{
nReg++;
}
if (curFlag == 1)
{
fsum += af[i];
n++;
printf("reg %d : %.2f\n", nReg, af[i]);
}
if (preFlag == 1 && curFlag == 0 || (curFlag == 1 && (i == 15)))
{
printf("avg:%.2f\n", fsum/n);
fsum = 0;
n = 0;
}
preFlag = curFlag;
}
printf("Total Regions:%d\n", nReg);
}
輸出
CODE:
reg 1 : 1.00
avg:1.00
reg 2 : 4.20
reg 2 : 3.10
reg 2 : 4.80
avg:4.03
reg 3 : 7.10
avg:7.10
reg 4 : 1.00
reg 4 : 2.00
avg:1.50
reg 5 : 1.50
avg:1.50
reg 6 : 1.10
avg:1.10