flagset(flagset73034)
如何使用vc制作dos的外部命令
如果是获得命令行的话用
GetCommandlLine
详细,看msdn
顺便给个notepad-mod 例子
//=============================================================================
//
// ParseCommandLine()
//
//
void ParseCommandLine()
{
LPWSTR lp1,lp2,lp3;
BOOL bContinue = TRUE;
BOOL bIsFileArg = FALSE;
BOOL bIsNotepadReplacement = FALSE;
LPWSTR lpCmdLine = GetCommandLine();
if (lstrlen(lpCmdLine) == 0)
return;
// Good old console can also send args separated by Tabs
StrTab2Space(lpCmdLine);
lp1 = LocalAlloc(LPTR,sizeof(WCHAR)*(lstrlen(lpCmdLine) + 1));
lp2 = LocalAlloc(LPTR,sizeof(WCHAR)*(lstrlen(lpCmdLine) + 1));
lp3 = LocalAlloc(LPTR,sizeof(WCHAR)*(lstrlen(lpCmdLine) + 1));
// Start with 2nd argument
ExtractFirstArgument(lpCmdLine,lp1,lp3);
while (bContinue ExtractFirstArgument(lp3,lp1,lp2))
{
// options
if (!bIsFileArg lstrcmp(lp1,L"+") == 0) {
flagMultiFileArg = 2;
bIsFileArg = TRUE;
}
else if (!bIsFileArg lstrcmp(lp1,L"-") == 0) {
flagMultiFileArg = 1;
bIsFileArg = TRUE;
}
else if (!bIsFileArg ((*lp1 == L'/') || (*lp1 == L'-')))
{
// LTrim
StrLTrim(lp1,L"-/");
// Encoding
if (lstrcmpi(lp1,L"ANSI") == 0 || lstrcmpi(lp1,L"A") == 0 || lstrcmpi(lp1,L"MBCS") == 0)
flagSetEncoding = IDM_ENCODING_ANSI-IDM_ENCODING_ANSI + 1;
else if (lstrcmpi(lp1,L"UNICODE") == 0 || lstrcmpi(lp1,L"W") == 0)
flagSetEncoding = IDM_ENCODING_UNICODE-IDM_ENCODING_ANSI + 1;
else if (lstrcmpi(lp1,L"UNICODEBE") == 0 || lstrcmpi(lp1,L"UNICODE-BE") == 0)
flagSetEncoding = IDM_ENCODING_UNICODEREV-IDM_ENCODING_ANSI + 1;
else if (lstrcmpi(lp1,L"UTF8") == 0 || lstrcmpi(lp1,L"UTF-8") == 0)
flagSetEncoding = IDM_ENCODING_UTF8-IDM_ENCODING_ANSI + 1;
else if (lstrcmpi(lp1,L"UTF8SIG") == 0 || lstrcmpi(lp1,L"UTF-8SIG") == 0 ||
lstrcmpi(lp1,L"UTF8SIGNATURE") == 0 || lstrcmpi(lp1,L"UTF-8SIGNATURE") == 0 ||
lstrcmpi(lp1,L"UTF8-SIGNATURE") == 0 || lstrcmpi(lp1,L"UTF-8-SIGNATURE") == 0)
flagSetEncoding = IDM_ENCODING_UTF8SIGN-IDM_ENCODING_ANSI + 1;
// EOL Mode
else if (lstrcmpi(lp1,L"CRLF") == 0 || lstrcmpi(lp1,L"CR+LF") == 0)
flagSetEOLMode = IDM_LINEENDINGS_CRLF-IDM_LINEENDINGS_CRLF + 1;
else if (lstrcmpi(lp1,L"LF") == 0)
flagSetEOLMode = IDM_LINEENDINGS_LF-IDM_LINEENDINGS_CRLF + 1;
else if (lstrcmpi(lp1,L"CR") == 0)
flagSetEOLMode = IDM_LINEENDINGS_CR-IDM_LINEENDINGS_CRLF + 1;
// Shell integration
else if (StrCmpNI(lp1,L"appid=",CSTRLEN(L"appid=")) == 0) {
StrCpyN(g_wchAppUserModelID,lp1+CSTRLEN(L"appid="),COUNTOF(g_wchAppUserModelID));
StrTrim(g_wchAppUserModelID,L" ");
if (lstrlen(g_wchAppUserModelID) == 0)
lstrcpy(g_wchAppUserModelID,L"(default)");
}
else if (StrCmpNI(lp1,L"sysmru=",CSTRLEN(L"sysmru=")) == 0) {
WCHAR wch[8];
StrCpyN(wch,lp1+CSTRLEN(L"sysmru="),COUNTOF(wch));
StrTrim(wch,L" ");
if (*wch == L'1')
flagUseSystemMRU = 2;
else
flagUseSystemMRU = 1;
}
else switch (*CharUpper(lp1))
{
case L'N':
flagReuseWindow = 0;
flagNoReuseWindow = 1;
if (*CharUpper(lp1+1) == L'S')
flagSingleFileInstance = 1;
else
flagSingleFileInstance = 0;
break;
case L'R':
flagReuseWindow = 1;
flagNoReuseWindow = 0;
if (*CharUpper(lp1+1) == L'S')
flagSingleFileInstance = 1;
else
flagSingleFileInstance = 0;
break;
case L'F':
if (*(lp1+1) == L'0' || *CharUpper(lp1+1) == L'O')
lstrcpy(szIniFile,L"*?");
else if (ExtractFirstArgument(lp2,lp1,lp2)) {
StrCpyN(szIniFile,lp1,COUNTOF(szIniFile));
TrimString(szIniFile);
PathUnquoteSpaces(szIniFile);
}
break;
case L'I':
flagStartAsTrayIcon = 1;
break;
case L'O':
if (*(lp1+1) == L'0' || *(lp1+1) == L'-' || *CharUpper(lp1+1) == L'O')
flagAlwaysOnTop = 1;
else
flagAlwaysOnTop = 2;
break;
case L'P':
{
WCHAR *lp = lp1;
if (StrCmpNI(lp1,L"POS:",CSTRLEN(L"POS:")) == 0)
lp += CSTRLEN(L"POS:") -1;
else if (StrCmpNI(lp1,L"POS",CSTRLEN(L"POS")) == 0)
lp += CSTRLEN(L"POS") -1;
else if (*(lp1+1) == L':')
lp += 1;
else if (bIsNotepadReplacement) {
if (*(lp1+1) == L'T')
ExtractFirstArgument(lp2,lp1,lp2);
break;
}
if (*(lp+1) == L'0' || *CharUpper(lp+1) == L'O') {
flagPosParam = 1;
flagDefaultPos = 1;
}
else if (*CharUpper(lp+1) == L'D' || *CharUpper(lp+1) == L'S') {
flagPosParam = 1;
flagDefaultPos = (StrChrI((lp+1),L'L')) ? 3 : 2;
}
else if (StrChrI(L"FLTRBM",*(lp+1))) {
WCHAR *p = (lp+1);
flagPosParam = 1;
flagDefaultPos = 0;
while (*p) {
switch (*CharUpper(p)) {
case L'F':
flagDefaultPos = ~(4|8|16|32);
flagDefaultPos |= 64;
break;
case L'L':
flagDefaultPos = ~(8|64);
flagDefaultPos |= 4;
break;
case L'R':
flagDefaultPos = ~(4|64);
flagDefaultPos |= 8;
break;
case L'T':
flagDefaultPos = ~(32|64);
flagDefaultPos |= 16;
break;
case L'B':
flagDefaultPos = ~(16|64);
flagDefaultPos |= 32;
break;
case L'M':
if (flagDefaultPos == 0)
flagDefaultPos |= 64;
flagDefaultPos |= 128;
break;
}
p = CharNext(p);
}
}
else if (ExtractFirstArgument(lp2,lp1,lp2)) {
int itok =
swscanf(lp1,L"%i,%i,%i,%i,%i",wi.x,wi.y,wi.cx,wi.cy,wi.max);
if (itok == 4 || itok == 5) { // scan successful
flagPosParam = 1;
flagDefaultPos = 0;
if (wi.cx 1) wi.cx = CW_USEDEFAULT;
if (wi.cy 1) wi.cy = CW_USEDEFAULT;
if (wi.max) wi.max = 1;
if (itok == 4) wi.max = 0;
}
}
}
break;
case L'T':
if (ExtractFirstArgument(lp2,lp1,lp2)) {
StrCpyN(szTitleExcerpt,lp1,COUNTOF(szTitleExcerpt));
fKeepTitleExcerpt = 1;
}
break;
case L'C':
flagNewFromClipboard = 1;
break;
case L'B':
flagPasteBoard = 1;
break;
case L'E':
if (ExtractFirstArgument(lp2,lp1,lp2)) {
if (lpEncodingArg)
LocalFree(lpEncodingArg);
lpEncodingArg = StrDup(lp1);
}
break;
case L'G':
if (ExtractFirstArgument(lp2,lp1,lp2)) {
int itok =
swscanf(lp1,L"%i,%i",iInitialLine,iInitialColumn);
if (itok == 1 || itok == 2) { // scan successful
flagJumpTo = 1;
}
}
break;
case L'M':
{
BOOL bFindUp = FALSE;
BOOL bRegex = FALSE;
BOOL bTransBS = FALSE;
if (StrChr(lp1,L'-'))
bFindUp = TRUE;
if (StrChr(lp1,L'R'))
bRegex = TRUE;
if (StrChr(lp1,L'B'))
bTransBS = TRUE;
if (ExtractFirstArgument(lp2,lp1,lp2)) {
if (lpMatchArg)
GlobalFree(lpMatchArg);
lpMatchArg = StrDup(lp1);
flagMatchText = 1;
if (bFindUp)
flagMatchText |= 2;
if (bRegex) {
flagMatchText = ~8;
flagMatchText |= 4;
}
if (bTransBS) {
flagMatchText = ~4;
flagMatchText |= 8;
}
}
}
break;
case L'L':
if (*(lp1+1) == L'0' || *(lp1+1) == L'-' || *CharUpper(lp1+1) == L'O')
flagChangeNotify = 1;
else
flagChangeNotify = 2;
break;
case L'Q':
flagQuietCreate = 1;
break;
case L'S':
if (ExtractFirstArgument(lp2,lp1,lp2)) {
if (lpSchemeArg)
LocalFree(lpSchemeArg);
lpSchemeArg = StrDup(lp1);
flagLexerSpecified = 1;
}
break;
case L'D':
if (lpSchemeArg) {
LocalFree(lpSchemeArg);
lpSchemeArg = NULL;
}
iInitialLexer = 0;
flagLexerSpecified = 1;
break;
case L'H':
if (lpSchemeArg) {
LocalFree(lpSchemeArg);
lpSchemeArg = NULL;
}
iInitialLexer = 1;
flagLexerSpecified = 1;
break;
case L'X':
if (lpSchemeArg) {
LocalFree(lpSchemeArg);
lpSchemeArg = NULL;
}
iInitialLexer = 2;
flagLexerSpecified = 1;
break;
case L'U':
flagRelaunchElevated = 1;
break;
case L'Z':
ExtractFirstArgument(lp2,lp1,lp2);
flagMultiFileArg = 1;
bIsNotepadReplacement = TRUE;
break;
case L'?':
flagDisplayHelp = 1;
break;
default:
break;
}
}
// pathname
else
{
LPWSTR lpFileBuf = LocalAlloc(LPTR,sizeof(WCHAR)*(lstrlen(lpCmdLine) + 1));
cchiFileList = lstrlen(lpCmdLine) - lstrlen(lp3);
if (lpFileArg)
GlobalFree(lpFileArg);
lpFileArg = GlobalAlloc(GPTR,sizeof(WCHAR)*(MAX_PATH+2)); // changed for ActivatePrevInst() needs
StrCpyN(lpFileArg,lp3,MAX_PATH);
PathFixBackslashes(lpFileArg);
if (!PathIsRelative(lpFileArg) !PathIsUNC(lpFileArg)
PathGetDriveNumber(lpFileArg) == -1 /* PathGetDriveNumber(g_wchWorkingDirectory) != -1*/) {
WCHAR wchPath[MAX_PATH];
lstrcpy(wchPath,g_wchWorkingDirectory);
PathStripToRoot(wchPath);
PathAppend(wchPath,lpFileArg);
lstrcpy(lpFileArg,wchPath);
}
StrTrim(lpFileArg,L" \"");
while (cFileList 32 ExtractFirstArgument(lp3,lpFileBuf,lp3)) {
PathQuoteSpaces(lpFileBuf);
lpFileList[cFileList++] = StrDup(lpFileBuf);
}
bContinue = FALSE;
LocalFree(lpFileBuf);
}
// Continue with next argument
if (bContinue)
lstrcpy(lp3,lp2);
}
LocalFree(lp1);
LocalFree(lp2);
LocalFree(lp3);
}
pflag命令行参数
本文讲解如何在go程序中使用命令行参数包pflag来获取gong语言编写的命令行程序的传入参数。
为了支持go语言flag包,go flags需要添加到pflag的flagset。
例如:我们想添加go flags到CommandLine flagset
ligerui mergecell怎么用
/**
* 获取页面参数
*/
function getPageSize(){
var xScroll, yScroll;
if (window.innerHeight window.scrollMaxY) {
xScroll = window.innerWidth + window.scrollMaxX;
yScroll = window.innerHeight + window.scrollMaxY;
} else if (document.body.scrollHeight document.body.offsetHeight) { // all but Explorer Mac
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
}else {
xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight;
}
var windowWidth, windowHeight;
if (self.innerHeight) {
if (document.documentElement.clientWidth) {
windowWidth = document.documentElement.clientWidth;
}
else {
windowWidth = self.innerWidth;
}
windowHeight = self.innerHeight;
}else if (document.documentElement document.documentElement.clientHeight) { // Explorer 6 Strict Mode
windowWidth = document.documentElement.clientWidth;
windowHeight = document.documentElement.clientHeight;
}else if (document.body) { // other Explorers
windowWidth = document.body.clientWidth;
windowHeight = document.body.clientHeight;
}
if (yScroll windowHeight) {
pageHeight = windowHeight;
}
else {
pageHeight = yScroll;
}
if (xScroll windowWidth) {
pageWidth = xScroll;
}
else {
pageWidth = windowWidth;
}
arrayPageSize = new Array(pageWidth, pageHeight, windowWidth, windowHeight);
return arrayPageSize;
}
/**
* 自适应iframe
* @param {Object} down
*/
function dyniframesize(down){
var pTar = null;
if (document.getElementById) {
pTar = document.getElementById(down);
}
else {
eval('pTar = ' + down + ';');
}
if (pTar !window.opera) {
pTar.style.display = "block"
if (pTar.contentDocument pTar.contentDocument.body.offsetHeight) {
pTar.height = pTar.contentDocument.body.offsetHeight + 20;
pTar.width = pTar.contentDocument.body.scrollWidth + 20;
}
else
if (pTar.Document pTar.Document.body.scrollHeight) {
pTar.height = pTar.Document.body.scrollHeight;
pTar.width = pTar.Document.body.scrollWidth;
}
}
}
/**
* 判断iframe是否加载完毕
*/
function frameIsReady(iframe){
if (!/*@cc_on!@*/0) { //if not IE
iframe.onload = function(){
return true;
};
}
else {
iframe.onreadystatechange = function(){
if (iframe.readyState == "complete") {
return true;
}
};
}
return false;
}
/**
* 如果iframe还没有加载完成则延迟几秒后加载
*/
function delayLoad(s,call){
window.setTimeout(call,s);
}
//重置grid
function resizeGrid(){
if (jQuery(".l-panel-body").find(".l-grid-body2").css("height") != undefined) {
var viewHeightTemp = window.parent.jQuery('#gridFrame').parent().height();
var viewHeight = viewHeightTemp - 184;
jQuery(".l-panel-body").find(".l-grid-body2").css("height", viewHeight);
var viewWidth = 0;
var grid = jQuery("#dg_pastbusicustInfo").ligerGrid();
for (i = 0; i grid.columns.length; i++) {
if (grid.columns[i]._hide != true grid.columns[i]._hide != "true") {
viewWidth = viewWidth + grid.columns[i]._width;
}
}
viewWidth = viewWidth - 1;
jQuery(".l-panel-body").find(".l-grid-header-inner").css("width", viewWidth);
jQuery(".l-panel-body").find(".l-grid-body-inner").css("width", viewWidth);
}
}
/**
* 合并单元格
* @param {Object} gridid
* @param {Object} columnid
*/
function mergecell(gridid, columnid){ //参数:表格id和列索引关键字,根据表格具体值来动态合并单元格
var i, j, k, x;
i = -1;
k = 1;
j = "";
x = 0;
var cellname = "";
jQuery("td[idjQuery='|" + columnid + "']", gridid).each(function(){
if (j == jQuery("div", this).text() || jQuery("div", this).text() == '') {
jQuery(this).addClass("l-remove");
k++;
jQuery("td[id='" + cellname + "']", gridid).attr("rowspan", k.toString());
}
else {
j = jQuery("div", this).text();
var a = jQuery(this);
cellname = a.attr("id"); //得到点击处的id
k = 1;
x = i;
}
i++;
});
jQuery(".l-remove").remove();
}
/**
*模拟map
*/
Map = function(){
var mapAddM = {
/**
* entry函数
* @param {Object} key
* @param {Object} val
*/
entry: function(key, val, flag){
this.key = key;
this.value = val;
this.flag = flag;
},
//put方法
put: function(key, val, flag){
this.store[this.store.length] = new this.entry(key, val, flag);
},
//get方法
get: function(key){
for (var i = 0; i this.store.length; i++) {
if (this.store[i].key === key)
return this.store[i].value;
}
},
//get方法
getFlag: function(key){
for (var i = 0; i this.store.length; i++) {
if (this.store[i].key === key)
return this.store[i].flag;
}
},
//remove方法
remove: function(key){
for (var i = 0; i this.store.length; i++) {
this.store[i].key === key this.store.splice(i, 1);
}
},
//keyset
keySet: function(){
var keyset = new Array;
for (var i = 0; i this.store.length; i++)
keyset.push(this.store[i].key);
return keyset;
},
//valset
valSet: function(){
var valSet = new Array;
for (var i = 0; i this.store.length; i++)
valSet.push(this.store[i].value);
return valSet;
},
//flagSet
flagSet: function(){
var flagSet = new Array;
for (var i = 0; i this.store.length; i++)
flagSet.push(this.store[i].flag);
return flagSet;
},
//clear
clear: function(){
this.store.length = 0;
},
//size
size: function(){
return this.store.length;
},
/**
* 迭代子
*/
iterator: function(){
//TODO 待实现
var obj = this.keySet();//所有的key集合
var idx = 0;
var me = {
/**
* 当前key
*/
current: function(){
return obj[idx - 1];
},
/**
* 第一个key
*/
first: function(){
return obj[0];
},
/**
* 最后一个key
*/
last: function(){
return obj[obj.length - 1];
},
/**
* 是否还有下一个元素
*/
hasNext: function(){
idx++;
if (idx obj.length || null == obj[obj.length - 1])
return false;
return true;
}
};
return me;
}
};
for (var method in mapAddM) {
this.store = new Array;
Map.prototype[method] = mapAddM[method];
}
}
/**
* 生成column
* @param {Object} map
*/
function createColumns(map,gridWidth){
var columns = [];
var i = 0;
for (var it = map.iterator(); it.hasNext();) {
var currentKey = it.current();//本次循环的key
var currentVal = map.get(currentKey);//当前value
var currentFlag = map.getFlag(currentKey);//判断是否隐藏该列
var columni = {};
columni.name = currentKey;
columni.display = currentVal;
columni.align = 'center';
columni.width = gridWidth?gridWidth:120;
if ((currentFlag (currentFlag == "hide"))) {
columni.hide = 'true';
columni.width = 0.1;
}
columns.push(columni);
i++;
}
return columns;
}
/**
* 请求数据之前
*/
function beforeLoad(){
}
/**
* 数据渲染完成后
*/
function afterDataRend(){
jQuery.ligerDialog.closeWaitting();
}
有哪些著名的兵人/人偶品牌?
hottoys,flagset,damtoys,DID,这些都比较著名。
HOTTOYS,曾经只被兵人爱好者所知晓的名字,但随着近些年的影视动漫产业的辉煌,玩具模型等周边收藏的升温以及爱好者的增多,HOTTOYS也被推到了时尚的前沿。
HOTTOYS有限公司成立于2000年,总部位于中国香港。我们致力于面向世界市场设计,开发,制造高细节仿真玩具产品。公司已由最初生产1:6模拟战场的特种部队兵人,发展到深入研究1:6的各类可动人偶。
HOTTOYS,曾经只被兵人爱好者所知晓的名字,但随着近些年的影视动漫产业的辉煌,玩具模型等周边收藏的升温以及爱好者的增多,HOT TOYS也被推到了时尚的前沿。
产品内容:
HOT TOYS现在不仅仅生产1:6的战场兵人,同时还扩展产品思路与香港人物设计师们,包括Brothersworker(铁人兄弟)和ERIC SO(香港著名公仔设计师)等深度合作,生产他们设计的独特收藏品。
HOT TOYS一直都强调产品的多样化。除了展现高品质的12"可动人偶外,HOT TOYS也同时从事着不同尺寸(4" 8" 12")以及不同结构、质地(卡扣类、 毛绒类、树脂类等)的人偶产品。