首页 文件>

材料归档

注:“您已超过最大打开的游标ORA-01000号”[JAVA]

一天碰到错误OracleDB注意到:“你已经超过了打开游标的最大数ORA-01000”。

成为一个类似下面的代码的问题
(未经证实的操作。揭露代码的翻译工作的事情,不会去,作为样本改写)

import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; public class cursorLeakeSample { public cursorLeakeSample(List idList) { try { // Oracle JDBC Driverのロード Class.forName("oracle.jdbc.driver.OracleDriver"); // コネクション取得 Connection connection = DriverManager.getConnection( "jdbc:oracle:thin:@localhost:1521:ORCL", "scott", "tiger"); String sql = "SELECT NAME FROM ITEM WHERE ID = ?"; PreparedStatement statement = null; try { for (String id : idList) { Object[] params = new Object[] { id }; // SQLにパラメータ埋め込みと実行statement = connection.prepareStatement(sql); statement.setObject(1, params[0]); statement.executeUpdate(); connection.commit(); } } catch (SQLException e) { // SQL実行失敗 connection.rollback(); e.printStackTrace(); } finally { statement.close(); connection.close(); } } catch (SQLException e) { // コネクションの接続・切断・ロールバック、ステートメントの解放に失敗 e.printStackTrace(); } catch (ClassNotFoundException e) { // Oracle JDBC ドライバが見つからなかった e.printStackTrace(); } } }  import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; public class cursorLeakeSample { public cursorLeakeSample(List idList) { try { // Oracle JDBC Driverのロード Class.forName("oracle.jdbc.driver.OracleDriver"); // コネクション取得 Connection connection = DriverManager.getConnection( "jdbc:oracle:thin:@localhost:1521:ORCL", "scott", "tiger"); String sql = "SELECT NAME FROM ITEM WHERE ID = ?"; PreparedStatement statement = null; try { for (String id : idList) { Object[] params = new Object[] { id }; // SQLにパラメータ埋め込みと実行statement = connection.prepareStatement(sql); statement.setObject(1, params[0]); statement.executeUpdate(); connection.commit(); } } catch (SQLException e) { // SQL実行失敗 connection.rollback(); e.printStackTrace(); } finally { statement.close(); connection.close(); } } catch (SQLException e) { // コネクションの接続・切断・ロールバック、ステートメントの解放に失敗 e.printStackTrace(); } catch (ClassNotFoundException e) { // Oracle JDBC ドライバが見つからなかった e.printStackTrace(); } } } 

是其中的重点,已引起部分。
你知道为什么不呢?
首先,转而把一个空框使用一个值来创建一个变量的声明,在一个循环中获得的,在年底发布。
乍一看,它看起来这样造成泄漏是一种解脱,你可以发现问题,并按照一点点的过程。

编写的SQL隐式“的prepareStatement”将创建一个游标。
有问题的代码,光标已经产生循环,知道这是一种隐含的很多。
它已被释放“的prepareStatement”循环退出时,存储。

例如,19是,它并没有被释放的过程是20。

所以,我应该怎么写,如果

 import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; public class cursorLeakeSample { public cursorLeakeSample(List idList) { try { // Oracle JDBC Driverのロード Class.forName("oracle.jdbc.driver.OracleDriver"); // コネクション取得 Connection connection = DriverManager.getConnection( "jdbc:oracle:thin:@localhost:1521:ORCL", "scott", "tiger"); String sql = "SELECT NAME FROM ITEM WHERE ID = ?"; PreparedStatement statement = connection.prepareStatement(sql); try { for (String id : idList) { Object[] params = new Object[] { id }; // SQLにパラメータ埋め込みと実行 statement.setObject(1, params[0]); statement.executeUpdate(); connection.commit(); } } catch (SQLException e) { // SQL実行失敗 connection.rollback(); e.printStackTrace(); } finally { statement.close(); connection.close(); } } catch (SQLException e) { // コネクションの接続・切断・ロールバック、ステートメントの解放に失敗 e.printStackTrace(); } catch (ClassNotFoundException e) { // Oracle JDBC ドライバが見つからなかった e.printStackTrace(); } } }  import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; public class cursorLeakeSample { public cursorLeakeSample(List idList) { try { // Oracle JDBC Driverのロード Class.forName("oracle.jdbc.driver.OracleDriver"); // コネクション取得 Connection connection = DriverManager.getConnection( "jdbc:oracle:thin:@localhost:1521:ORCL", "scott", "tiger"); String sql = "SELECT NAME FROM ITEM WHERE ID = ?"; PreparedStatement statement = connection.prepareStatement(sql); try { for (String id : idList) { Object[] params = new Object[] { id }; // SQLにパラメータ埋め込みと実行 statement.setObject(1, params[0]); statement.executeUpdate(); connection.commit(); } } catch (SQLException e) { // SQL実行失敗 connection.rollback(); e.printStackTrace(); } finally { statement.close(); connection.close(); } } catch (SQLException e) { // コネクションの接続・切断・ロールバック、ステートメントの解放に失敗 e.printStackTrace(); } catch (ClassNotFoundException e) { // Oracle JDBC ドライバが見つからなかった e.printStackTrace(); } } } 

也许这种方式。 如果您使用“预处理”。
我认为,关闭()在声明中,所以如果你想使用它的“声明”多田野。

动态添加的Java类路径

注:现在,我们已经实现了自己的路,我期待和你要创建的Tomcat的WEB-INF/classes罐和其他系统的软化程序。
单瓶 “或” 发罐如果你认为可以回应“,并有更好的利用。
顺便说一下,操作检查证实,它的作品甚至在罐总结时JRE5。

 package jp.moonwing.net; import java.io.File; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.URL; import java.net.URLClassLoader; /** * クラスパスの動的追加 * * @author $Author: U.Yobane $ * @version $Version: v 043b2b764886 2011/06/13 01:23:25+0900(JST) $ */ public final class ApplicationClassLoader { /** クラス情報格納フィールド */ private static final Class<?>[] PARAMETERS = new Class<?>[] { URL.class }; /** * コンストラクタ */ private ApplicationClassLoader() { } /** * メイン * * @param args 起動引数文字列配列 */ public static void main(String[] args) { try { // クラスパスの追加 addClassPath( {追加したいクラスパスディレクトリ} ); addClassPath( {追加したいJAR} ); // メインプログラムを実行 Application.execute(args); } catch (IOException e) { e.printStackTrace(); } } /** * クラスローダーにクラスパスを動的追加 * * @param classPath 追加するクラスパス * @throws IOException クラスパスの動的追加に失敗 */ public static void addClassPath(String classPath) throws IOException { addClassPath(new File(classPath)); } /** * クラスパスを再帰的にたどり、追加可能パスはすべて追加 * * @param classPath 追加するファイル * @throws IOException クラスパスの動的追加に失敗 */ private static void addClassPath(File classPath) throws IOException { if (classPath.isDirectory()) { // ディレクトリを追加 addClassPath(classPath.toURL()); // ディレクトリ配下を探索 File[] child = classPath.listFiles(); for (int i = 0; i < child.length; i++) { addClassPath(child[i]); } } else { String suffix = getSuffix(classPath.getName()); // 見つかったファイルがJARもしくはZipの場合は追加 if (suffix.equalsIgnoreCase("zip") || suffix.equalsIgnoreCase("jar")) { addClassPath(classPath.toURL()); } } } /** * システムクラスローダーにクラスパスを強制的に追加 * * @param classPathUrl クラスパス * @throws IOException クラスパスの動的追加に失敗 */ private static void addClassPath(URL classPathUrl) throws IOException { URLClassLoader sysloader = (URLClassLoader) ClassLoader.getSystemClassLoader(); Class<?> sysclass = URLClassLoader.class; try { Method method = sysclass.getDeclaredMethod("addURL", PARAMETERS); method.setAccessible(true); method.invoke(sysloader, new Object[] { classPathUrl }); } catch (NoSuchMethodException e) { throw new IOException("could not add " + classPathUrl + " to classpath"); } catch (InvocationTargetException e) { throw new IOException("could not add " + classPathUrl + " to classpath"); } catch (IllegalAccessException e) { throw new IOException("could not add " + classPathUrl + " to classpath"); } } /** * ファイル名から拡張子を返却 * * @param fileName ファイル名 * @return ファイルの拡張子 */ private static String getSuffix(String fileName) { if (fileName == null) { return null; } int point = fileName.lastIndexOf("."); if (point != -1) { return fileName.substring(point + 1); } return fileName; } } 

UAC支持汇编[C#]应用

注意:如果你想改变应用端在一般及行政权利和特权的行为

  1. 从信息来看,是否开始以来WindowsVista的操作系统版本已是<br />或应用程序运行在一个(OS与UAC)和购买WindowsVista的

     using System; private bool IsUAC() { OperatingSystem osInfo = Environment.OSVersion; if (osInfo.Platform == PlatformID.Win32NT) { if (osInfo.Version.Major == 6) { if (osInfo.Version.Minor == 0) { // Windows Vista, Windows Server 2008 return true; } else if (osInfo.Version.Minor == 1) { // Windows 7, Windows Server 2008 R2 return true; } } else if (osInfo.Version.Major > 6) { // new Windows return true; } } return false; } 
  2. 当他们......“以管理员身份运行”是<br />或应用程序已经开始具有管理员权限的应用

     using System.Security.Principal; private bool IsAdministrator() { bool isAllowed = false; try { WindowsIdentity wi = WindowsIdentity.GetCurrent(); WindowsPrincipal wp = new WindowsPrincipal(wi); isAllowed = wp.IsInRole(WindowsBuiltInRole.Administrator); } catch { isAllowed = false; } return isAllowed; } 
  3. 用户启动应用程序<br />如果你想知道应用程序是否可以晋升为管理员用户开始甚至如果它已开始属于Administrators组或一般的特权

     using System.DirectoryServices.AccountManagement; private bool IsAdministrators() { bool isAllowed = false; try { PrincipalContext pc = new PrincipalContext(ContextType.Machine, null); UserPrincipal up = UserPrincipal.Current; GroupPrincipal gp = GroupPrincipal.FindByIdentity(pc, "Administrators"); if (up.IsMemberOf(gp)) { isAllowed = true; } } catch { isAllowed = false; } return isAllowed; } 

    不喜欢工作,以及在某些环境中,上面的代码吗? 可确保下面的代码。

     using System.DirectoryServices.AccountManagement; private bool IsAdministrators() { bool isAllowed = false; try { PrincipalContext pc = new PrincipalContext(ContextType.Machine, null); UserPrincipal up = UserPrincipal.Current; foreach (GroupPrincipal gp in up.GetGroups()) { try { if (gp.Name.ToLower().Equals("Administrators".ToLower())) { isAllowed = true; } } finally { gp.Dispose(); } } } catch { isAllowed = false; } return isAllowed; } 
  4. 具有管理员权限的重新启动,如果行政机关需要处理<br />重新启动具有管理员权限的应用

     using System; using System.Diagnostics; private void RestartApplication() { ProcessStartInfo psi = new ProcessStartInfo(); psi.UseShellExecute = true; psi.WorkingDirectory = Environment.CurrentDirectory; psi.FileName = Application.ExecutablePath; psi.Verb = "runas"; try { Process p = Process.Start(psi); } catch { return; } Application.Exit(); } 
  5. 要在按钮上显示的图标来通知用户,将需要管理权限才能继续操作,必须具有管理员权限的按钮,以显示一个图标<br />(垂直)的UAC(垂直)的UAC (盾牌图标和WIN32API盾牌图标SystemIcons.Shield财产是有区别的,它已被作为标准的Windows 7。这是多个Win32 API)

     using System; using System.Windows.Forms; using System.Runtime.InteropServices; namespace Sample { public partial class Form1 : Form { [DllImport("user32.dll")] private static extern IntPtr SendMessage(HandleRef hWnd, uint Msg, IntPtr wParam, IntPtr lParam); // 第2パラメータ:盾アイコンを設定するフラグ uint BCM_SETSHIELD = 0x0000160C; public Form1() { InitializeComponent(); // ボタンの外観を「System」にする必要がある button1.FlatStyle = FlatStyle.System; } private void checkBox1_CheckedChanged(object sender, EventArgs e) { // 第1パラメータ:ボタンのウィンドウ・ハンドル HandleRef hwnd = new HandleRef(button1, button1.Handle); if (checkBox1.Checked) { SendMessage(hwnd, BCM_SETSHIELD, new IntPtr(0), new IntPtr(1)); } else { SendMessage(hwnd, BCM_SETSHIELD, new IntPtr(0), new IntPtr(0)); } } } } 

PSP的背光更换保险丝

PSPのバックライトヒューズの位置
PSP-1000屏幕不再突然出现。
我听到的声音,听到的声音也是一个按钮。

凝视一直硬,薄ー图形显示。

来真正的先驱,并检查在网络上的信息,然后猜测背光已过期这种情况。

立即,分解,然后尝试的导火索,这是我发布背光保险丝的位置仔细检查的连续性。

用数字万用表,但没有任何反应,保险丝本身并不知道什么是正确的1005尺寸的片式保险丝的方形。
例如,它不会被测量或有表面上的薄膜。

我决定更换规范。
更换保险丝0.5A为F4501。
首先,我想放弃不融化的焊料,但被认为是作为一个政策取代。
因此,我们决定把并行。
(如果现有的导火线是活着的,因为目前被分割),如果这样,严格地说,但它也并不好,
它被认为是恢复,如果在这项工作中的背光,保险丝是不为过相同,
另外,如果有是消除好,所以没有很好的事业。

,恢复工作进行了安全背光。
PSP再次发挥。

权力KuroBox维修

玄箱の電源回路のヒューズ リード付きヒューズ
电源插头仍然KuroBox妹妹,不小心碰到了电源,请注意,因为维修工作不得不关掉保险丝

根是无商标的方块的第一件事。
但实际上它去拉另一个电源插头的电源插头拔出,功率KuroBox是不会错过。
蓝色火花已经死了,会触及阻力,由于失踪的工作电源保险丝的脚。

电源没有进入预计也适用于电源的手去睡觉是在一个没有眼睛的匆忙,以确保你没有失败。
是的,如果电源是去KuroBox尾巴。 如果发生这种情况为时已晚。

有恢复和更换保险丝,绝不能有让人看起来就像是净短信息凹痕。

但现在,即使自己的保险丝熔断? 用数字万用表来验证(F1)保险丝的连续性和思考。
结果尚未进行。 这意味着,已过期的导火索。
这可能是幸运的。
保险丝的电路意味着切断,为了不损坏电路,当它变得过度的电流或电压过高,温度异常保护电路,是有什么其他部分没有损坏的可能性,因为可能是幸运的。
和你可以看到相反的导火索的连续性,将其他损坏的部分,它是很难找出原因。

以及,广播中心大沼是寻找在秋叶原3A铅网的信息为基础的保险丝。
是150日元两种。 被发现的问题与回程,而我认为秋叶原的确,做的工作,并立即交换

因为它是书面2A保险丝,如果你看看在原来的紧密合作。
但是,从3A移动融合本身,而是变得正常3A的唯一连接的电路,即使它是2A过流保护。
这是诞生过电流时,熔断器,交流新的人的其他部分的潜在损害,因为喜欢买2A。

应当指出的是能改造,没有您所购买的保险丝的铅含量问题,但有点厚。
,并确保您可以成功地开始当您打开电源。

如果你找到一个试图取代含铅2A保险丝···

[VS]软件发行商的证书创建和签署

注意:如何创建和签署证书创建的东西的方法签名。

如果你想使用ClickOnce安装了VSTO或自签名的证书,该证书应Oreore和他所做的,你需要什么。
您使用的工具在WindowsSDK

  • 如何创建
     rem 1.==== rem CA:Certificate Authority:認証局証明書rem 会社名 : MoonWing rem 組織名 : MoonWing Authority Root CA rem 県 名 : Tokyo rem 国 名 : JP rem 有効期限: 2012.12.31 "%ProgramFiles%\Microsoft SDKs\Windows\v7.1\Bin\makecert" -r -n "C=JP, S=Tokyo, OU=MoonWing Authority Root CA, O=MoonWing" -e 12/31/2012 -a sha1 -cy authority -sv moonwingCA.pvk moonwingCA.cer rem 秘密キーのパスワードの作成:Subject Key: rootCA rem 秘密キーのパスワードの入力:Subject Key: rootCA rem 2.==== rem EE:End Entity:署名用証明書rem コモン名: MoonWing rem 会社名 : MoonWing rem 組織名 : MoonWing Development rem 県 名 : Tokyo rem 国 名 : JP rem 有効期限: 2012.12.31 "%ProgramFiles%\Microsoft SDKs\Windows\v7.1\Bin\makecert" -n "CN=MoonWing, C=JP, S=Tokyo, O=MoonWing, OU=MoonWing Development" -e 12/31/2012 -sv moonwing.pvk -ic moonwingCA.cer -iv moonwingCA.pvk -nscp -cy end moonwing.cer rem 秘密キーのパスワードの作成:Subject Key: endEntity rem 秘密キーのパスワードの入力:Subject Key: endEntity rem 秘密キーのパスワードの入力:Issuer Signature: rootCA rem 3.==== rem SPC:Software Publisher's Certificate:ソフトウェア発行元証明書"%ProgramFiles%\Microsoft SDKs\Windows\v7.1\Bin\Cert2SPC" moonwing.cer moonwingCA.cer moonwing.spc rem 4.==== rem PFX:Personal Information Exchange:PKCS#12 rem -pi(pvkpassword):endEntity rem -po(pfxpassword):SPC "%ProgramFiles%\Microsoft SDKs\Windows\v7.1\Bin\pvk2pfx" -pvk moonwing.pvk -pi endEntity -spc moonwing.spc -pfx moonwing.pfx -po SPC 
  • 签名的方法
     rem 5.==== rem target.exeへ署名rem -t(time stamp server):http://timestamp.verisign.com/scripts/timstamp.dll rem -p(pfxpassword):SPC "%ProgramFiles%\Microsoft SDKs\Windows\v7.1\Bin\signtool" sign /f moonwing.pfx /a /t http://timestamp.verisign.com/scripts/timstamp.dll /p SPC target.exe 

[VS] PIA的总结兼容版本

表的版本。NetFramework版本的PIA版本的Office和VSTO的表在通过创建。
PIA是... 更多 PrimaryInteropAssembly 微软请问。

PIA的 办事处的支持 。NetFramework支持 Windows支持
XP中 XP中 1.1 XP中
2003 2003 1.1 2000 SP3的XP,Server 2003中
2007 2007 1.1 2000 SP4,Windows XP SP2,Server 2003中
2010 2010 2.0或更高 2000 SP4,XP SP2中,Server 2003中,Vista中,7,Server 2008的

摘要兼容版本[VS]的VSTO

因为要创建表的一个版本。NetFramework版本和版本的Office和VSTO。
VSTO的是和

  • 微软Visual Studio 2005工具为Office第二版运行时
  • 微软Visual Studio 2005工具2007 Microsoft Office系统
  • 微软的Visual Studio工具为Microsoft Office系统(版本3.0运行时)
  • 微软Visual Studio 2010 Microsoft Office System的工具(4.0版运行时)

延长组件的办公室,这个名字已经发生了微妙变化。
基本上不应该是一个问题,如果以下三个以上两只眼睛被省略。
(或者说,我也省略了前三,但将无法对应的两个终端,在2003,2007,2010)

VSTO 办事处的支持 。NetFramework支持 支持VisualStduio Windows支持
2005 SE的 2003年,2007年 2.0 2005年 2000年,XP,Server 2003中,Vista中,7,Server 2008中
3.0 2007 3.5 SP1中 2008 2000年,XP,Server 2003中,Vista中,7,Server 2008中
4.0 2007,2010 3.5 SP1中 2010 XP,Server 2003中,Vista中,7,Server 2008中

指令

注意隔离部分的编写跨平台的代码依赖于平台的预处理器指令。

  • 编译器
    • 海湾合作委员会
      • #IFDEF _ GNUC__
        • 或以上#如果__ GNUC__> = 3 / / GCC3.0
    • 用Borland C + +
      • #IFDEF _ BORLANDC__
    • 英特尔编译器
      • #IFDEF _ INTEL_COMPILER
    • 微软的编译器
      • #IFDEF _MSC_VER
        • 以后如果_MSC_VER> = 600 / / C编译器6.0 +包括#的VC
        • 以后如果_MSC_VER> = 700 / /的C / C + +编译器7.0 +包括#的VC
        • #后来如果_MSC_VER> = 800 / / VC + +1.0
        • #后来_MSC_VER> = 900 / / VC + +2.0
        • #后来如果_MSC_VER> = 1000 / / VC + + 4.0
        • #后来如果_MSC_VER> = 1010 / / VC + +4.1
        • #后来如果_MSC_VER> = 1020 / / VC + + 4.2
        • #后来如果_MSC_VER> = 1100 / / VC + +5.0
        • #后来如果_MSC_VER> = 1200 / / VC + + 6.0
        • #如果_MSC_VER> = 1300 / / VC2002(VC7.0)
        • #如果_MSC_VER> = 1310 / / VC2003(VC7.1)
        • #如果_MSC_VER> = 1400 / / VC2005(VC8.0)
        • #如果_MSC_VER> = 1500 / / VC2008(VC9.0)
        • #如果_MSC_VER> = 1600 / / VC2010后(VC10.0)
  • UNIX系统
    • UNIX的
      • #IFDEF _ UNIX
      • #IFDEF _ unix__
    • Linux的
      • #IFDEF _ LINUX
      • #IFDEF _ linux__
    • FreeBSD的
      • #IFDEF _ FreeBSD__
    • NetBSD的
      • #IFDEF _ NetBSD__
    • Cygwin的
      • #IFDEF _ CYGWIN__
      • #Cygwin的版本IFDEF __ CYGWIN32__ / / 32位
    • MinGW的(MNO-cygwin的)
      • #IFDEF _ MINGW32__
  • Windows系统
      • #IFDEF _CONSOLE
    • 图形用户界面
      • #IFDEF _WINDOWS
    • 32位Windows
      • #IFDEF WIN32的
      • #IFDEF _WIN32
    • 64位Windows
      • #IFDEF _WIN64
    • Windows版本
      • #IFDEF的WINVER
        • 由于#(WINVER> = 0x030a)/ / Windows 3.1的
        • #自95 / NT 4.0(WINVER> = 0×0400)/ / Windows的如果
        • 由于#(WINVER> = 0×0410)/ / Windows 98中
        • 由于#(WINVER> = 0×0500)/ /视窗ME / 2000
        • 由于#(WINVER> = 0×0501)/ /的Windows XP / Server 2003中
        • #自2003年以来SP1(WINVER> = 0×0502)/ /的Windows XP SP2中/服务器,如果
        • 由于#(WINVER> = 0×0600)/ /的Windows Vista / Server 2008中
        • 由于#(WINVER> = 0×0601)/ / Windows 7的
      • #IFDEF _WIN32_WINDOWS / /在Windows9x
        • #如果以后(_WIN32_WINDOWS> = 0×0400)/ / Windows 95中
        • #如果以后(_WIN32_WINDOWS> = 0×0410)/ / Windows 98的
        • #如果以后(_WIN32_WINDOWS> = 0×0500)/ / Windows的我
      • #IFDEF _WIN32_WINNT / / WindowsNTx的
        • 由于Windows 2000 / /(0×0500)
          #如果(_WIN32_WINNT> = _WIN32_WINNT_WIN2K)
        • / /由于2003年的Windows XP /服务器(0×0501)
          #如果(_WIN32_WINNT> = _WIN32_WINNT_WINXP)
        • / /自2003 SP1的Windows XP SP2中/服务器(0×0502)
          #如果(_WIN32_WINNT> = _WIN32_WINNT_WS03)
        • / /从Windows Vista(0×0600)
          #如果(_WIN32_WINNT> = _WIN32_WINNT_VISTA)
        • / /从Windows Server 2008(0×0600)
          #如果(_WIN32_WINNT> = _WIN32_WINNT_WS08)
        • / /从Windows 7(0×0601)
          #如果(_WIN32_WINNT> = _WIN32_WINNT_WIN7)
      • #IFDEF _WIN32_WCE / / WindowsCE的
        • #如果(_WIN32_WCE> = 0×0420)/ /的Windows Mobile 2003(PPC2003)
        • #如果(_WIN32_WCE> = 0×0421)/ /的Windows Mobile 2003 SE上(PPC2003SE)
        • #如果(_WIN32_WCE> = 0×0501)/ /的Windows Mobile 5.0
        • #如果(_WIN32_WCE> = 0×0502)/ /的Windows Mobile 6专业版/经典
        • #如果(WINCEOSVER> = 0×0300)/ / WindowsCE3.0(PPC2002)
        • #如果(WINCEOSVER> = 0×0420)/ / WindowsCE4.2后(PPC2003)
        • #如果(WINCEOSVER> = 0×0500)/ / WindowsCE5.0(WM5.0)
    • Internet Explorer版本
      • #IFDEF _WIN32_IE
        • #如果(_WIN32_IE> = 0×0200)/ /的Windows 95/NT 4.0(4.00的Comctl32.dll,Shell32.dll的4.00)
        • #如果(_WIN32_IE> = 0×0300)/ /的Internet Explorer 3.0,3.01,3.02
        • #如果(_WIN32_IE> = 0×0400)/ / Internet浏览器4.0
        • #如果(_WIN32_IE> = 0×0401)/ /互联网浏览器4.01
        • #如果(_WIN32_IE> = 0×0500)/ /的Internet Explorer 5.0,5.0A,5.0b
        • #如果(_WIN32_IE> = 0×0501)/ / Internet Explorer的5.01
        • #如果(_WIN32_IE> = 0×0550)/ /因特网浏览器5.5
        • #如果(_WIN32_IE> = 0×0600)/ / Internet浏览器6.0
        • #如果(_WIN32_IE> = 0×0601)/ /互联网浏览器6.0 SP1的
        • #如果(_WIN32_IE> = 0×0603)/ /互联网浏览器6.0 SP2
        • #如果(_WIN32_IE> = 0×0700)/ /因特网浏览器7.0
        • #如果(_WIN32_IE> = 0×0800)/ / Internet Explorer的8.0

注意<br />预处理,视为0未定义的标识符,#如果__ GNUC__> = 3或更多,但可以作为GCC3
如果您尝试确定#__ GNUC__ <3是否系统GCC2,包括那些不海合会。
参考

获取的Windows版本

但我不认为我可以使用,初步注意。
如果编译器可以编译没有问题,我想系统的Windows。
暂定,编译,并确认在MinGW进行操作。

 #include <windows.h> #include <stdio.h> int main(void) { unsigned int GV = GetVersion(); printf("GetVersion API(GV) = %08X\n\n", GV); printf("_winver = %08X\n", _winver); printf("_winmajor = %08X\n", _winmajor); printf("_winminor = %08X\n", _winminor); printf("_osver = %08X\n\n", _osver); printf("(( GV << 8 ) | (( GV >> 8 ) & 0XFF)) & 0XFFFF = %08X (= _winver)\n", (( GV << 8 ) | (( GV >> 8 ) & 0XFF)) & 0XFFFF ); printf("GV & 0XFF = %08X (= _winmajor)\n", GV & 0XFF ); printf("( GV >> 8 ) & 0XFF = %08X (= _winminor)\n", (( GV >> 8 ) & 0XFF)); printf("GV >> 16 = %08X (= _osver)\n\n\n", (GV >> 16) ); // Windows version(_winmajor, _winminor, _osver) printf("This system is ["); if ( _osver < 0X8000 ) { // NT Group (_osver LowWORD MSB = 0) switch (_winmajor) { case 3: case 4: printf ("Windows NT %u.%u Build %u", _winmajor, _winminor, _osver); break; case 5: switch (_winminor) { case 0: printf ("Windows 2000 Build %u", _osver); break; case 1: printf ("Windows XP Build %u", _osver); break; case 2: printf ("Windows Server 2003 family Build %u", _osver); break; default: printf ("NT Group Windows Build %u", _osver); } break; case 6: switch (_winminor) { case 0: printf ("Windows Vista or Windows Server 2008 Build %u", _osver); break; case 1: printf ("Windows 7 Build %u", _osver); break; default: printf ("NT Group Windows Build %u", _osver); } break; default: printf ("NTGroup Windows Build %u", _osver); } } else { switch (_winmajor ) { case 0: //Win32s Group case 1: case 2: case 3: printf ("Win32s Build %u", _osver & 0X7FFF); break; case 4: // 9X Group (_osver is invalid.) switch (_winminor) { case 0: printf ("Windows 95 Build ----"); break; case 10: printf ("Windows 98 Build ----"); break; case 90: printf ("Windows Me Build ----"); break; default: // To make sure printf ("Newer than Windows Me"); } break; default: // To make sure printf ("Newer than Windows Me"); } } printf("]"); return 0; } 
1 2 3

首页 文件>

搜索
翻译
Japanese flagItalian flagKorean flagChinese (Simplified) flagChinese (Traditional) flagEnglish flagGerman flagFrench flagRussian flagVietnamese flagThai flag

回到页面顶部