Skip to content
This repository was archived by the owner on Feb 9, 2021. It is now read-only.

Latest commit

 

History

History
<!--TO READ THIS HELP FILE, RIGHT-CLICK ON THE FILE NAME IN THE
    SOLUTION EXPLORER PANE AND SELECT "VIEW IN BROWSER"-->

<html><head><title>ATLBUTTON Attributes Sample: Demonstrates a Button with Bitmaps for Different States</title></head><body><h1>ATLBUTTON Attributes Sample: Demonstrates a Button with Bitmaps for Different States</h1><div id="mainSection"><div id="mainBody"><div id="allHistory" class="saveHistory" onsave="saveAll()" onload="loadAll()"></div><p /><p>The ATLBUTTON attributes sample creates a button that displays itself with one of three different bitmaps, depending on its state. The button has a bitmap for the unpushed state, the hover state (when the mouse moves over the button), and the pushed state. Default bitmaps are included with the sample, but you can override these properties to use your own bitmaps.</p><p>This sample also demonstrates the use of several IDL, COM, and compiler attributes. The dispinterface attribute is used to place the dispatch interface _ATLButton in the atlbutn.idl file. The propputref attribute is used to allow references to be used instead of values in the PictureStatic, PictureHover, and PicturePush functions. The version attribute is demonstrated, among other commonly used attributes.</p><p>The <MSHelp:link keywords="9387F763-3535-4447-AD5F-4ABD346FB96D" tabindex="0" >ATLBUTTON sample</MSHelp:link> is the nonattributed version of this sample.</p><div class="alert"><table width="100%" cellspacing="0" cellpadding="0"><tr><th align="left">Security Note </th></tr><tr><td><p>This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices.</p></td></tr></table></div><h1 class="heading">Building and Running the Sample</h1><div id="sectionSection0" class="seeAlsoNoToggleSection"><h4 class="subHeading">To build and run this sample</h4><div class="subSection"><ol><li><p>Open the solution file atlbutn.sln.</p></li><li><p>From the <b>Build</b> menu, click <b>Build Solution</b>.</p></li><li><p>Open the ActiveX Control Test Container and insert the control (CAtlButton Object). For details on accessing Test Container and using it to test a control, see <MSHelp:link keywords="626867CF-FE53-4C30-8973-55BB93EF3917" tabindex="0" >Testing Properties and Events with Test Container</MSHelp:link>.</p></li><li><p>Open the Properties dialog box for the control, then associate an image with each of the listed properties, by browsing to the sample folder, selecting a BMP file, and clicking <b>Apply</b>.</p></li><li><p>Note how the image displayed in the control changes if the pointer hovers over it, or if the control is clicked.</p></li></ol></div></div><h1 class="heading">Attributes</h1><div id="sectionSection1" class="seeAlsoNoToggleSection"><p>This sample uses the following attributes:</p><p>coclass, default, dispinterface, dll, dual, event_source, helpstring, id, implements_category, in, module, name, object, out, pointer_default, progid, propget, propput, propputref, registration_script, retval, support_error_info, uuid, version, vi_progid</p></div><h1 class="heading">Keywords</h1><div id="sectionSection2" class="seeAlsoNoToggleSection"><p>This sample uses the following keywords:</p><p>Apartment; ATLTRACE; AtlWaitWithMessageLoop; BEGIN_COM_MAP; BEGIN_CONNECTION_POINT_MAP; BEGIN_MSG_MAP; BEGIN_OBJECT_MAP; BEGIN_PROPERTY_MAP; CComCoClass; CComControl; CComControl::FireViewChange; CComControl::InPlaceActivate; CComModule::GetClassObject; CComModule::GetLockCount; CComModule::Init; CComModule::RegisterServer; CComModule::Term; CComModule::UnregisterServer; CComObjectRoot; CloseHandle; CoGetInterfaceAndReleaseStream; CoInitialize; COleControl::OnClick; COM_INTERFACE_ENTRY; COM_INTERFACE_ENTRY_IMPL_IID; CoMarshalInterThreadInterfaceInStream; CONNECTION_POINT_ENTRY; CProxy_ATLButton; CreateDIBPalette; CreatePalette; CreateThread; CTimer; DECLARE_HANDLE; DECLARE_REGISTRY_RESOURCEID; DIBNumColors; DisableThreadLibraryCalls; DLL_PROCESS_DETACH; END_COM_MAP; END_CONNECTION_POINT_MAP; END_MSG_MAP; END_OBJECT_MAP; END_PROPERTY_MAP; GetCursorPos; GetFileSize; GetWindow; GlobalAlloc; GlobalFree; GlobalLock; GlobalSize; GlobalUnlock; IConnectionPointContainerImpl; IConnectionPointImpl; IDispatchImpl; IObjectSafetyImpl; IOleControlImpl; IOleInPlaceActiveObjectImpl; IOleInPlaceObjectWindowlessImpl; IOleInPlaceObjectWindowlessImpl::InPlaceDeactivate; IOleObjectImpl; IPersistPropertyBagImpl; IPersistStreamInitImpl; IProvideClassInfo2Impl; IViewObjectExImpl; LPLOGPALETTE; MESSAGE_HANDLER; OBJECT_ENTRY; PaintDIB; PaletteSize; PROP_ENTRY; PtInRect; PutImage; ReadDIBFile; ReadFile; RealizePalette; ScreenToClient; SelectPalette; SetDIBitsToDevice; SetStretchBltMode; Sleep; StretchDIBits; TimerOff; TimerOn; Unlock; USES_CONVERSION</p><div class="alert"><table width="100%" cellspacing="0" cellpadding="0"><tr><th align="left">Note </th></tr><tr><td><p>Some of the samples, such as this one, have not been modified to reflect the changes in the Visual C++ wizards, libraries, and compiler, but still demonstrate how to complete your desired task. </p></td></tr></table></div></div></div><div id="footer"><div class="footerLine"></div>
          © Microsoft Corporation. All rights reserved.  Send <a href="mailto:DevDocs@microsoft.com?subject=Documentation Feedback :ATLBUTTON Attributes Sample: Demonstrates a Button with Bitmaps for Different States">comments</a> about this topic to Microsoft.
      </div></div></body></html>