Click here to Skip to main content
15,921,212 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to read image files with extensions which are not predefined in C# Pin
Kiran Satish24-Sep-04 6:16
Kiran Satish24-Sep-04 6:16 
GeneralActiveX C++ Button ctrl Pin
Andy H24-Sep-04 5:49
Andy H24-Sep-04 5:49 
GeneralRAS fucntions problem Pin
Muhammad Asif Khan24-Sep-04 4:57
Muhammad Asif Khan24-Sep-04 4:57 
GeneralRe: RAS fucntions problem Pin
vcplusplus24-Sep-04 9:01
vcplusplus24-Sep-04 9:01 
GeneralRe: RAS fucntions problem Pin
Alexander M.,24-Sep-04 12:26
Alexander M.,24-Sep-04 12:26 
GeneralRe: RAS fucntions problem Pin
Muhammad Asif Khan26-Sep-04 21:54
Muhammad Asif Khan26-Sep-04 21:54 
GeneralRe: RAS fucntions problem Pin
Ken Andrews27-Sep-04 7:15
Ken Andrews27-Sep-04 7:15 
Questionwould someone tell me if this is OK? Pin
BlackDice24-Sep-04 3:33
BlackDice24-Sep-04 3:33 
I posted a couple of questions yesterday about a BYTE array created on the heap. After creating it I use SafeArrayAccessData() and SafeArrayUnAccessData() after puttin the info in the array. This is the exact same method I've seen used in countless examples when I googled this stuff. However, I was getting a memory leak because I didn't call 'delete' on the pointer. When I tried to call delete on the pointer, my program ASSERTed in _CrtIsValidHeapPointer(). I never wrote to the array after that and can't figure out why it's doing that, so here's what I did:

UINT nAddress = 0;
BYTE* pBuf = NULL;

//some other stuff

pBuf = new BYTE[nLength];
nAddress = (UINT)pBuf;  //to hold initial address.

//continue with code, and catch handler

if(nAddress)
{
    pBuf = (BYTE*)nAddress;
    delete [] pBuf;
    pBuf = NULL;
}

It's been working so far, and not MEMORY LEAKS, but...
Is this okay?

[insert witty comment here]

bdiamond Sleepy | :zzz:
AnswerRe: would someone tell me if this is OK? Pin
Antony M Kancidrowski24-Sep-04 3:58
Antony M Kancidrowski24-Sep-04 3:58 
GeneralRe: would someone tell me if this is OK? Pin
BlackDice24-Sep-04 4:12
BlackDice24-Sep-04 4:12 
GeneralRe: would someone tell me if this is OK? Pin
Antony M Kancidrowski24-Sep-04 4:37
Antony M Kancidrowski24-Sep-04 4:37 
GeneralRe: would someone tell me if this is OK? Pin
David Crow24-Sep-04 4:42
David Crow24-Sep-04 4:42 
GeneralRe: would someone tell me if this is OK? Pin
BlackDice24-Sep-04 4:57
BlackDice24-Sep-04 4:57 
GeneralRe: would someone tell me if this is OK? Pin
David Crow24-Sep-04 5:02
David Crow24-Sep-04 5:02 
GeneralRESOLVED Pin
BlackDice24-Sep-04 5:10
BlackDice24-Sep-04 5:10 
AnswerRe: would someone tell me if this is OK? Pin
David Crow24-Sep-04 4:34
David Crow24-Sep-04 4:34 
GeneralRe: would someone tell me if this is OK? Pin
BlackDice24-Sep-04 4:43
BlackDice24-Sep-04 4:43 
Questionhow to merge cell in word by VC Pin
yingkou24-Sep-04 2:41
yingkou24-Sep-04 2:41 
GeneralDetect default language 'en' or 'de' Pin
Moak24-Sep-04 2:29
Moak24-Sep-04 2:29 
GeneralRe: Detect default language 'en' or 'de' Pin
Antony M Kancidrowski24-Sep-04 3:25
Antony M Kancidrowski24-Sep-04 3:25 
GeneralRe: Detect default language 'en' or 'de' Pin
Moak24-Sep-04 3:43
Moak24-Sep-04 3:43 
GeneralGet / Set Windows Title Bar Font, Text Colour and Size Pin
Tristan Rhodes24-Sep-04 2:26
Tristan Rhodes24-Sep-04 2:26 
GeneralRe: Get / Set Windows Title Bar Font, Text Colour and Size Pin
Ravi Bhavnani24-Sep-04 3:17
professionalRavi Bhavnani24-Sep-04 3:17 
GeneralRe: Get / Set Windows Title Bar Font, Text Colour and Size Pin
Tristan Rhodes24-Sep-04 4:25
Tristan Rhodes24-Sep-04 4:25 
GeneralRe: Get / Set Windows Title Bar Font, Text Colour and Size Pin
David Crow24-Sep-04 4:39
David Crow24-Sep-04 4:39 

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.