Advertisement
3_2004-2005 Files/ File Controls/ Input/ Output #145827

C/C++ Win32 Platform SDK, Windows,Chilld Controls,and Menus.

Just a skeleton to look out when building yours. So you can remember how each part goes into the window skeleton using the platform SDK. My friend asked for this.

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
Upload
Upload
//
// This code is translated to VB.Net at
// http://www.jondavis.net/files/misc/GetEmbeddedResource_VB.txt
//
using System;
// TODO: Set the following line.
namespace MyProjectNamespace {
public class App
{
	public static System.Reflection.Assembly Assembly {
		get {
			return ClassType.Assembly;
		}
	}
	public static Type ClassType {
		get {
			return typeof(App);
		}
	}
	/// <summary>
	/// The type of object is determined by the filename extension.
	/// For example, ".txt", ".htm[l]" are strings, ".xml" is an 
	/// XmlDocument, ".ico" is an Icon, ".bmp", ".gif", ".jpg", 
	/// ".tif", and ".png" are Bitmaps. Anything else is just a 
	/// stream.
	/// </summary>
	/// <param name="resName">The filename of the embedded resource.</param>
	/// <returns>If recognized, a String, XmlDocument, Icon, or Bitmap. 
	/// Otherwise, a Stream object.</returns>
	public static object GetEmbeddedResource(string resName) {
		resName = resName.Replace("/", ".").Replace("\\", ".");
		if (resName.IndexOf(App.ClassType.Namespace) != 0) {
			resName = App.ClassType.Namespace + "." + resName;
		}
		Stream s = App.Assembly.GetManifestResourceStream(resName);
		if (s != null) {
			string ext = resName.Substring(resName.LastIndexOf(".") + 1);
			switch (ext.ToLower()) {
				case "txt":
				case "htm":
				case "html":
					StreamReader sr = new StreamReader(s);
					return sr.ReadToEnd();
				case "xml":
				case "config":
					StreamReader sr2 = new StreamReader(s);
					XmlDocument xDoc = new XmlDocument();
					xDoc.LoadXml(sr2.ReadToEnd());
					return xDoc;
				case "ico":
					return new System.Drawing.Icon(s);
				case "bmp":
				case "gif":
				case "jpg":
				case "jpeg":
				case "exif":
				case "wmf":
				case "emf":
				case "png":
				case "tif":
				case "tiff":
					return new System.Drawing.Bitmap(s);
				default:
					return s;
			}
		}
		return null;
	}
}
}
Original Comments (3)
Recovered from Wayback Machine