Microsoft KB Archive/103036: Difference between revisions

From BetaArchive Wiki
(stage1)
 
m (Text replacement - """ to """)
 
(One intermediate revision by the same user not shown)
Line 31: Line 31:


</div></blockquote>
</div></blockquote>
This error occurs if the first AddAtom call in the application passes a string containing a # as the first character, and passes non-numeric characters in the rest of the string. For example, the first call to AddAtom with the string &quot;#string&quot; will cause the error to occur.
This error occurs if the first AddAtom call in the application passes a string containing a # as the first character, and passes non-numeric characters in the rest of the string. For example, the first call to AddAtom with the string "#string" will cause the error to occur.


<br />
<br />
Line 52: Line 52:
== MORE INFORMATION ==
== MORE INFORMATION ==


Atoms with names begin with the # character are strongly discouraged. The # character serves a special purpose for atoms. If the string that is passed to AddAtom has the form &quot;#1234&quot;, AddAtom returns an integer atom whose value is the 16-bit value representation of the decimal number specified in the string. If the decimal value specified is 0 (zero) or a value in the range 0xC000 through 0xFFFF, the return value is zero, indicating an error.
Atoms with names begin with the # character are strongly discouraged. The # character serves a special purpose for atoms. If the string that is passed to AddAtom has the form "#1234", AddAtom returns an integer atom whose value is the 16-bit value representation of the decimal number specified in the string. If the decimal value specified is 0 (zero) or a value in the range 0xC000 through 0xFFFF, the return value is zero, indicating an error.


=== Sample Code ===
=== Sample Code ===
Line 62: Line 62:
  ATOM at;
  ATOM at;


  at = AddAtom(&quot;#string&quot;);    // causes error to occur
  at = AddAtom("#string");    // causes error to occur


}
}
Line 74: Line 74:
  // or call AddAtom with a false string
  // or call AddAtom with a false string


  AddAtom(&quot;false&quot;);
  AddAtom("false");


  at = AddAtom(&quot;#string&quot;);    // no error occurs
  at = AddAtom("#string");    // no error occurs


} </pre>
} </pre>

Latest revision as of 09:26, 20 July 2020

BUG: AddAtom Causes Divide by Zero Error

Q103036



The information in this article applies to:


  • Microsoft Windows Software Development Kit (SDK) 3.1





SYMPTOMS

Calling the AddAtom function in the Windows 3.x environment with a string that begins with the pound (#) character causes the system to display the following error message in a system modal dialog:

Application Error

integer divide by 0

This error occurs if the first AddAtom call in the application passes a string containing a # as the first character, and passes non-numeric characters in the rest of the string. For example, the first call to AddAtom with the string "#string" will cause the error to occur.



RESOLUTION

If it is necessary to have atom strings beginning with the # character, first call AddAtom with a false string that contains no # characters. Alternatively, call InitAtomTable before adding the first atom string beginning with the # character.



STATUS

Microsoft has confirmed this to be a bug in Windows versions 3.0 and 3.1. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.



MORE INFORMATION

Atoms with names begin with the # character are strongly discouraged. The # character serves a special purpose for atoms. If the string that is passed to AddAtom has the form "#1234", AddAtom returns an integer atom whose value is the 16-bit value representation of the decimal number specified in the string. If the decimal value specified is 0 (zero) or a value in the range 0xC000 through 0xFFFF, the return value is zero, indicating an error.

Sample Code

/* Compile options needed:  /Zp /GA or /GD or /Gw */ 

// errant code
{
 ATOM at;

 at = AddAtom("#string");     // causes error to occur

}

// corrected code
{
 ATOM at;

 InitAddTable(17);

 // or call AddAtom with a false string

 AddAtom("false");

 at = AddAtom("#string");     // no error occurs

} 

Additional query words: 3.00 3.10

Keywords :
Issue type :
Technology : kbAudDeveloper kbWin3xSearch kbSDKSearch kbWinSDKSearch kbWinSDK310


Last Reviewed: November 6, 1999
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.