Posts Tagged c

自定义WebBrowser版本

Posted by on 星期六, 1 4月, 2017

当在应用程序中嵌入WebBrowser控件时,会遇到使用系统IE没有问题,而WebBrowser浏览却不正常的现象。
当你在排除了跨域、可信站点、IE设置等问题却依然不正常的时候,例如CSS失效、JS错误;则可能是由于安全原因WebBrowser被限制版本了。

问题描述:http://stackoverflow.com/questions/4612255/will-the-ie9-webbrowser-control-support-all-of-ie9s-features-including-svg/5357168#5357168

可以尝试通过设置Browser Emulation来解决,如下:

原文:https://msdn.microsoft.com/en-us/library/ee330730(VS.85).aspx#browser_emulation

WebBrowser 介绍:https://msdn.microsoft.com/en-us/library/aa752040(v=vs.85).aspx

Browser Emulation

Windows Internet Explorer 8 and later. The FEATURE_BROWSER_EMULATION feature defines the default emulation mode for Internet Explorer and supports the following values.

Value Description
11001 (0x2AF9 Internet Explorer 11. Webpages are displayed in IE11 edge mode, regardless of the declared !DOCTYPE directive. Failing to declare a !DOCTYPE directive causes the page to load in Quirks.
11000 (0x2AF8) IE11. Webpages containing standards-based !DOCTYPE directives are displayed in IE11 edge mode. Default value for IE11.
10001 (0x2711) Internet Explorer 10. Webpages are displayed in IE10 Standards mode, regardless of the !DOCTYPE directive.
10000 (0x02710) Internet Explorer 10. Webpages containing standards-based !DOCTYPE directives are displayed in IE10 Standards mode. Default value for Internet Explorer 10.
9999 (0x270F) Windows Internet Explorer 9. Webpages are displayed in IE9 Standards mode, regardless of the declared !DOCTYPE directive. Failing to declare a !DOCTYPE directive causes the page to load in Quirks.
9000 (0x2328) Internet Explorer 9. Webpages containing standards-based !DOCTYPE directives are displayed in IE9 mode. Default value for Internet Explorer 9.

Important  In Internet Explorer 10, Webpages containing standards-based !DOCTYPE directives are displayed in IE10 Standards mode.
8888 (0x22B8) Webpages are displayed in IE8 Standards mode, regardless of the declared !DOCTYPE directive. Failing to declare a !DOCTYPE directive causes the page to load in Quirks.
8000 (0x1F40) Webpages containing standards-based !DOCTYPE directives are displayed in IE8 mode. Default value for Internet Explorer 8

Important  In Internet Explorer 10, Webpages containing standards-based !DOCTYPE directives are displayed in IE10 Standards mode.
7000 (0x1B58) Webpages containing standards-based !DOCTYPE directives are displayed in IE7 Standards mode. Default value for applications hosting the WebBrowser Control.

 

For more information, see Defining Document Compatibility.

To control the value of this feature by using the registry, add the name of your executable file to the following setting and set the value to match the desired setting.

HKEY_LOCAL_MACHINE (or HKEY_CURRENT_USER)
   SOFTWARE
      Microsoft
         Internet Explorer
            Main
               FeatureControl
                  FEATURE_BROWSER_EMULATION
                     contoso.exe = (DWORD) 00009000


其中contoso.exe为你的应用程序名

			

c/c++ 带参数(列表)的宏定义

Posted by on 星期六, 12 4月, 2014

引用互联网的资料,首先介绍几个宏:

1)  __VA_ARGS__ 是一个可变参数的宏。宏前面加上##的作用在于,当可变参数的个数为0时,这里的##起到把前面多余的”,”去掉的作用,否则会编译出错。
2) __FILE__ 宏在预编译时会替换成当前的源文件名
3) __LINE__宏在预编译时会替换成当前的行号
4) __FUNCTION__宏在预编译时会替换成当前的函数名称

#define ERRMSG1(fmt,…) sprintf(m_errMsg, fmt, ##__VA_ARGS__)  //按一定格式将字符串放入m_errMsg,使用例子:ERRMSG1(“[debug]i=%d”,i);
#define ERRMSG2(fmt,args…) sprintf(m_errMsg, “[%s 第 %d 行 ]; “fmt”\r\n” , __FILE__, __LINE__, ##args)  //将固定格式的字符串格式化到m_errMsg,将生成“[sqliteHelper.c第2行];”的固定格式,fmt会按args去格式化。

参考:

  1. http://blog.chinaunix.net/uid-22878837-id-2110544.html
  2. http://bbs.csdn.net/topics/390755688

ws-c2950g-48-EI 端口镜像(分析端口)

Posted by on 星期日, 15 8月, 2010

  今天研究在cisco 2950上做了个端口分析,用于抓包。同时想到锐捷CLI与Cisco基本一致,所以经过试验,在锐捷2724G上成功执行并创建分析(镜像)端口,用于接网吧的绿网(下例中绿网接在分析端口,也就是f0/48口上),如果是千兆口,将f0/48 中的f换成g,即gigabitEthernet,如g0/48。

  以下红色部分为输入部分。

sw_wolf#conf t
Enter configuration commands, one per line. End with CNTL/Z.
sw_wolf(config)#monitor session 1 destination interface f0/48 !设置分析端口
sw_wolf(config)#monitor session 1 source interface f0/1 – 47 !设置被监控端口,注意“-”符两边有空格。
sw_wolf(config)#^Z
sw_wolf#show monitor !验证结果
Session 1
———
Type : Local Session
Source Ports :
Both : Fa0/1-47
Destination Ports : Fa0/48
Encapsulation : Native
Ingress: Disabled