Click here to Skip to main content
16,008,010 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: index of selected item in listctrl Pin
Tomasz Sowinski12-Sep-02 9:05
Tomasz Sowinski12-Sep-02 9:05 
GeneralRe: index of selected item in listctrl Pin
danag12-Sep-02 9:17
danag12-Sep-02 9:17 
GeneralRe: index of selected item in listctrl Pin
Tomasz Sowinski12-Sep-02 9:23
Tomasz Sowinski12-Sep-02 9:23 
GeneralRe: index of selected item in listctrl Pin
danag12-Sep-02 9:24
danag12-Sep-02 9:24 
GeneralUnhandled exception when writing to allocated memory. Pin
12-Sep-02 8:26
suss12-Sep-02 8:26 
GeneralRe: Unhandled exception when writing to allocated memory. Pin
Tomasz Sowinski12-Sep-02 8:43
Tomasz Sowinski12-Sep-02 8:43 
GeneralRe: Unhandled exception when writing to allocated memory. Pin
Redeemer-dk12-Sep-02 8:53
Redeemer-dk12-Sep-02 8:53 
GeneralRe: Unhandled exception when writing to allocated memory. Pin
TyMatthews12-Sep-02 8:52
TyMatthews12-Sep-02 8:52 
LocalAlloc() does not return a pointer, it returns a handle, aka HLOCAL. Your memset fails because the address you're sending is not really an address at all. In order to translate that HLOCAL into a valid pointer to physical memory, call LocalLock(). LocalLock will return an actual pointer to physical memory which you can then use. BTW, you wouldn't have to call memset there and initialize the buffer to zero, since you're specifying LMEM_ZEROINIT in the call to LocalAlloc()... it's redundant Smile | :)


DWORD dwBufferSize = 176400;
HLOCAL hBuffer = NULL;
LPVOID lpBuffer = NULL;

__try
{
   hBuffer = LocalAlloc( LMEM_MOVEABLE | LMEM_ZEROINIT, dwBufferSize );
   if( hBuffer )
   {
      lpBuffer = LocalLock( hBuffer );

      if( lpBuffer )
      {
          // Do some stuff with the pointer
      }
   }
}
__finally
{
   if( hBuffer )
   {
      LocalUnlock( hBuffer );
      LocalFree( hBuffer );
   }
}

</code>



Ty

GeneralRe: Unhandled exception when writing to allocated memory. Pin
Joaquín M López Muñoz12-Sep-02 8:53
Joaquín M López Muñoz12-Sep-02 8:53 
GeneralThanks all, now i see :) Pin
Anonymous12-Sep-02 9:01
Anonymous12-Sep-02 9:01 
GeneralWin2K and Multilink Pin
Tili12-Sep-02 8:20
Tili12-Sep-02 8:20 
GeneralStill Dialog menu problems Pin
DarrollWalsh12-Sep-02 8:10
DarrollWalsh12-Sep-02 8:10 
GeneralRe: Still Dialog menu problems Pin
Tomasz Sowinski12-Sep-02 8:22
Tomasz Sowinski12-Sep-02 8:22 
GeneralRe: Still Dialog menu problems Pin
DarrollWalsh12-Sep-02 8:42
DarrollWalsh12-Sep-02 8:42 
GeneralRe: Still Dialog menu problems Pin
Tomasz Sowinski12-Sep-02 8:47
Tomasz Sowinski12-Sep-02 8:47 
GeneralRe: Still Dialog menu problems Pin
DarrollWalsh12-Sep-02 8:56
DarrollWalsh12-Sep-02 8:56 
GeneralRe: Still Dialog menu problems Pin
Tomasz Sowinski12-Sep-02 9:06
Tomasz Sowinski12-Sep-02 9:06 
GeneralRe: Still Dialog menu problems Pin
DarrollWalsh12-Sep-02 9:24
DarrollWalsh12-Sep-02 9:24 
GeneralRe: Still Dialog menu problems Pin
Tomasz Sowinski12-Sep-02 9:28
Tomasz Sowinski12-Sep-02 9:28 
Generalheight of title bar of modeless CDialog Pin
ns12-Sep-02 8:09
ns12-Sep-02 8:09 
GeneralRe: height of title bar of modeless CDialog Pin
Tomasz Sowinski12-Sep-02 8:19
Tomasz Sowinski12-Sep-02 8:19 
GeneralHandle WM in CDialog derived class Pin
Ludovic Balogh12-Sep-02 7:56
sussLudovic Balogh12-Sep-02 7:56 
GeneralRe: Handle WM in CDialog derived class Pin
Tomasz Sowinski12-Sep-02 8:17
Tomasz Sowinski12-Sep-02 8:17 
GeneralHighliting items in list control Pin
Shay Harel12-Sep-02 7:28
Shay Harel12-Sep-02 7:28 
GeneralRe: Highliting items in list control Pin
Tomasz Sowinski12-Sep-02 7:38
Tomasz Sowinski12-Sep-02 7:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.