Results 1 to 4 of 4

Thread: How to declare a cotaskmemfree

  1. #1
    Join Date
    May 2009
    Posts
    60

    How to declare a cotaskmemfree

    I am working on old COM project. Here there is a file in the project which gives two function. The first on is allcoate memory and the second one is free memory. Nothing happen here when I call cotaskmemfree function. I do not understand weather I am doing right or wrong. Some one can please give steps to call the function.

  2. #2
    Join Date
    Oct 2005
    Posts
    2,393

    Re: How to declare a cotaskmemfree

    CoTaskMemFree Function is called to free some types of blocks in allocated memory. It clears up the memory related with a pointer to an itemidlist structure. This is created by windows shell api function. Once the function is called it does not return any value. You can get any simple example over the net. It shows you detail list of function to call and codes required.

  3. #3
    Join Date
    May 2008
    Posts
    2,389

    Re: How to declare a cotaskmemfree

    It is mainly used to frees a block of task memory which is previously allocated. It is allocated when CoTaskMemAlloc and CoTaskMemRealloc function is called. See the example below.
    The syntax below is used in C++ -
    Code:
    void CoTaskMemFree(
      __in_opt  LPVOID pv
    );
    Parameters required. -- pv [in, optional]. Here you will need a pointer to the memory block which require to be freed. If the parameter is null then you get no effect.

  4. #4
    Join Date
    Feb 2008
    Posts
    1,852

    Re: How to declare a cotaskmemfree

    From the above reply you can understand the exact function and the way to call cotaskmemfree function. The number of bytes which he frees is equal to the number of bytes that were allocated. Then after the call the memory block pointed to by pv is not valid. It cannot be used any longer. A defualt OLE allocator is used by it. Any invalid function can result in unexpected crash of application.

Similar Threads

  1. What is the Declare Construct in PHP?
    By Rob Dizzle in forum Software Development
    Replies: 5
    Last Post: 06-03-2010, 03:51 AM
  2. How to declare the header() function in php?
    By Joko in forum Software Development
    Replies: 3
    Last Post: 10-09-2009, 03:28 PM
  3. How to declare const variable in C++
    By AZUL in forum Software Development
    Replies: 3
    Last Post: 02-09-2009, 06:36 PM
  4. How to declare print function in PHP
    By Aanand in forum Software Development
    Replies: 3
    Last Post: 29-05-2009, 12:28 PM
  5. When to Declare a static method in JAVA
    By Aamin in forum Software Development
    Replies: 2
    Last Post: 04-02-2009, 07:25 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,537,446.65174 seconds with 16 queries