/// <summary>
 /// Write the resource to a binary stream.
 /// </summary>
 /// <param name="w">Binary stream.</param>
 public virtual void Write(BinaryWriter w)
 {
     // menu
     DialogTemplateUtil.WriteResourceId(w, _menuId);
     // window class
     DialogTemplateUtil.WriteResourceId(w, _windowClassId);
     // caption
     w.Write(Encoding.Unicode.GetBytes(Caption));
     w.Write((UInt16)0);
     // point size
     if ((Style & (uint)User32.DialogStyles.DS_SETFONT) > 0 ||
         (Style & (uint)User32.DialogStyles.DS_SHELLFONT) > 0)
     {
         w.Write((UInt16)PointSize);
     }
 }
        /// <summary>
        /// Write the dialog control to a binary stream.
        /// </summary>
        /// <param name="w">Binary stream.</param>
        public virtual void Write(BinaryWriter w)
        {
            // control class
            DialogTemplateUtil.WriteResourceId(w, _controlClassId);
            // caption
            DialogTemplateUtil.WriteResourceId(w, _captionId);

            if (_creationData == null)
            {
                w.Write((UInt16)0);
            }
            else
            {
                ResourceUtil.PadToWORD(w);
                w.Write((UInt16)_creationData.Length);
                w.Write(_creationData);
            }
        }