MFC: CHtmlEditCtrl – simple HTML Editor

Static control is needed to use CHtmlEditCtrl class.

BOOL CSomeDlg::OnInitDialog()
{
    ...
    
    // TODO: Add extra initialization here
	CStatic wndStatic;
	wndStatic.SubclassDlgItem(IDC_HTMLSTATIC, this);

	CRect rect;
	wndStatic.GetWindowRect(rect);
	ScreenToClient(rect);
	if (m_ctlEditHtml.Create(NULL, WS_CHILD | WS_VISIBLE, rect, this, IDC_HTMLSTATIC) != TRUE)
        return FALSE;
    
    return TRUE;
}

By the way, there is a bug with hiding the control.
BUG: WebBrowser Control Destroyed When Hidden

How to reproduce:
Consider the following code:

m_ctlEditHtml.ShowWindow(SW_HIDE);
m_ctlEditHtml.ShowWindow(SW_SHOW);

The application crashes!

Workaround:

::ShowWindow(m_ctlEditHtml.GetSafeHwnd(), SW_HIDE);             
::ShowWindow(m_ctlEditHtml.GetSafeHwnd(), SW_SHOW);

MS DOS 6.22 Installation

MS DOS 6.22

FDISK
FORMAT C: /S

C:
MD MSDOS
COPY A:\*.* .\MSDOS /v
COPY A:\CONFIG.SYS
COPY A:\AUTOEXEC.BAT
COPY A:\HIMEM.SYS
COPY A:\CD1.SYS

TASM: ARG directive

I had the problem with the procedure:

Print PROC
    ARG pStr:WORD
    mov si, pStr
PrintLoop:
    lodsb
    cmp al, 0   ; End of line?
    je  PrintRet
    int 29h     ; Print AL byte
    jmp PrintLoop
PrintRet:
    ret
Print   endp

Calling code:

push offset FileName
call Print

Result: it does not work as expected.

I have found some info about ARG directive:

Article #19021: TP 5.0/TASM – ARG DIRECTIVE SYMBOLIC REFERENCES

 Technical Notes Database

TN4021C.txt   TP 5.0/TASM  - ARG DIRECTIVE SYMBOLIC REFERENCES
Category   : Pascal
Platform    : All
Product    : TD  1.x 2.0

Description:
Q. I am using the Arg directive to create symbolic references to
   variables on the stack.  I am not getting the correct values
   I should in the Assembler routine.  What am I doing wrong?
A. It is easier if remember a few points about the Arg directive.
   First, the Arg directive always adjusts for a near or far
   call.  If you have a proc definition like:
          myproc proc far
   the Arg directive will take into account the four (4) byte return
   address on the stack.  If your definition looks like:
          myproc proc near
   the Arg directive will adjust for a two (2) byte return
   address on the stack.  The second thing to remember is that
   the Arg directive always assumes that you will push BP onto
   the stack first and thus, will add two bytes to the size of
   the return address.  For a far return the total will be six
   bytes and for a near return the total will be four bytes.  The
   third point to remember about the Arg directive itself is that
   the leftmost symbol in the Arg list will be nearest the top of
   the stack.  Finally, remember that for each subsequent symbol
   to the right, a number equal to the number of bytes on the
   stack occupied by the symbols to the left will be added to the
   BP register.
   Consider the following examples:
          myproc proc near
          arg first:word, second:word
          push bp
          mov  bp,sp
   The distance is near, a two byte return address, and the BP is
   assumed to pushed onto the stack.  Thus, any reference to
   first is equivalent to [BP + 04H].  Since first is a word it
   occupies two bytes on the stack.  Thus second evaluates to [BP
   + 04H + 02H] or [BP + 06H].
          myproc proc far
          arg first:word, second:word
          push bp
          mov  bp,sp
   The distance is far, a four byte return address, and the BP is
   assumed to be pushed onto the stack.  Thus, any reference to
   first if equivalent to [BP + 06H].  Since first is a word, it
   occupies two bytes on the stack.  Thus, second evaluates to
   [BP + 06H + 02H] or [BP + 08H].
          myproc proc far
          arg first:near ptr word, second:word
          push bp
          mov  bp,sp
   The distance is far, a four byte return address, and the BP is
   assumed to be pushed onto the stack.  Thus any reference to
   first is equivalent to [BP + 06H].  Since first is a near
   pointer it occupies two bytes on the stack.  Thus second
   evaluates to [BP + 06H + 02H] or [BP + 08H].
          myproc proc far
          arg first:byte, second:word
          push bp
          mov  bp,sp
   The distance is far, a four byte return address, and the BP is
   assumed to be pushed onto the stack.  Thus, any reference to
   first is equivalent to [BP + 06H].  Although first is a byte
   value it occupies two bytes on the stack.  Thus, second
   evaluates to [BP + 06H + 02H] or [BP + 08H].
          myproc proc far
          arg first:byte:1, second:word
          push bp
          mov  bp,sp
   The distance is far, a four byte return address, and the BP is
   assumed to be pushed onto the stack.  Thus, any reference to
   first is equivalent to [BP + 06H].  Although first is a byte
   value it occupies two bytes on the stack.  To force it to use
   only one byte we must use the :1 after the word byte.  Second
   evaluates to {BP + 06H + 01H] or [BP + 07H].  Note that the
   type of variables must match the types of those that appear in
   the high level language call.

Reference:

7/2/98 10:45:32 AM

Last Modified: 01-SEP-99

Source note

Print PROC
    ARG pStr:WORD
    push bp          ; ADDED
    mov  bp, sp      ; ADDED
    mov	si, pStr
PrintLoop:
    lodsb
    cmp	al, 0   ; End of line?
    je	PrintRet
    int	29h		; Print AL byte
    jmp	PrintLoop
PrintRet:
    pop bp           ; ADDED
    ret
Print	endp

Firefox: How to disable New Tab Page

Navigate to about:config, type in browser.newtab.url, set the value to about:blank.


VMware Workstation: two monitors

  1. Run the virtual machine.
  2. Go to Fullscreen view.
  3. Click on the Workstation icon on the top: make sure Autofit Guest is selected.
  4. Click on the Cycle Multiple Monitors button to start using two monitors.

Visual Studio: Creating Temporary Projects

Quote from the MSDN library How to: Enable Temporary Projects:

To enable temporary projects in the IDE:

  1. On the Tools menu, click Options.
  2. Expand the Projects and Solutions node, and select the General node.
  3. Make sure Save new projects when created is cleared.
  4. Click OK.

Windows Server 2008 r2: File share without password still requires login

Open Group Policy Editor, go to:

- Computer Configuration
  – Windows Settings
    – Security Settings
      – Local Policies
        – Security Options.

Change “Network access: Let Everyone permissions apply to anonymous users” to Enabled.
Change “Network access: Sharing and security model for local account” from “Classic-local users authenticate as themselves” to “Guest only-local users authenticate as Guest”.


Follow

Get every new post delivered to your Inbox.