Delete all cookies

This is a discussion on Delete all cookies within the Windows Programming forums, part of the Platform Specific Boards category; Is there a code that delete all the users cookies in one time (like the reecycle bin : SHEmptyRecycleBin(NULL, "", ...

  1. #1
    Registered User
    Join Date
    Sep 2006
    Posts
    70

    Lightbulb Delete all cookies

    Is there a code that delete all the users cookies in one time

    (like the reecycle bin : SHEmptyRecycleBin(NULL, "", 0))

    because the path is different on every windows


    thnx in advance (i searched already in wininet.h , but dindt found something)

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,533
    There's probably some registry key which will tell you where the current users' cookies are stored.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Sep 2006
    Posts
    70
    Code:
    	LPTSTR strCookiesPath;
    
    	// get the coockies folder
    	strCookiesPath = SHGetFolderPath(NULL, CSIDL_COOKIES, 
                                      NULL, SHGFP_TYPE_CURRENT, MAX_PATH);	
    	MessageBox(NULL, strCookiesPath , "Path", MB_OK );
    gives error while application runs

  4. #4
    Registered User
    Join Date
    Sep 2006
    Posts
    70
    i get this warnings
    Code:
    warning C4047: 'function' : 'LPSTR' differs in levels of indirection from 'int'
    warning C4024: 'SHGetFolderPathA' : different types for formal and actual parameter 5
    warning C4047: '=' : 'LPTSTR' differs in levels of indirection from 'HRESULT'

  5. #5
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    Code:
    	LPTSTR strCookiesPath;
    
    	// get the coockies folder
    	strCookiesPath = (LPTSTR)SHGetFolderPath(NULL, CSIDL_COOKIES, 
                                      NULL, SHGFP_TYPE_CURRENT, MAX_PATH);	
    	MessageBox(NULL, strCookiesPath , "Path", MB_OK );

  6. #6
    Registered User
    Join Date
    Sep 2006
    Posts
    70
    doesnt make any different , same warnings , still crashing at that point

  7. #7
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    SHGetFolderPath is deprecated, but this works using LCC. For whatever reason the header shlobj.h for MinGW that I have doesn't have SHGFP_TYPE_CURRENT defined, so that's kind of interesting.

    Code:
    #include <windows.h>
    #include <shlobj.h>
    
    int main(void)
    {
    	char strCookiesPath[MAX_PATH];
    
    	SHGetFolderPath(NULL, CSIDL_COOKIES, NULL, SHGFP_TYPE_CURRENT,strCookiesPath);
    	MessageBox(NULL, strCookiesPath, "Path", MB_OK );
    	
    	return 0;
    }

  8. #8
    Registered User Joelito's Avatar
    Join Date
    Mar 2005
    Location
    Tijuana, BC, México
    Posts
    308
    For portability on Win9x, I use this on my apps:
    Code:
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
    {
    	LPITEMIDLIST lpidl;
    	char pszPath[MAX_PATH];
    	if (SUCCEEDED(SHGetSpecialFolderLocation(NULL, CSIDL_COOKIES, &lpidl))) {
    		SHGetPathFromIDList(lpidl, pszPath);
    		MessageBox(NULL, pszPath, "My Cookie jar", MB_OK);
    		CoTaskMemFree(lpidl);
    	}
    	return 0;
    }
    * PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with xfce4.
    * Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with xfce4.

  9. #9
    Registered User
    Join Date
    Sep 2006
    Posts
    70
    thnx

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. BST delete again, but this time I think I'm close
    By tms43 in forum C++ Programming
    Replies: 9
    Last Post: 11-05-2006, 05:24 PM
  2. First party tracking cookies Meow!
    By kryptkat in forum Tech Board
    Replies: 13
    Last Post: 08-12-2006, 06:29 PM
  3. delete and delete []
    By Lionel in forum C++ Programming
    Replies: 8
    Last Post: 05-19-2005, 01:52 PM
  4. why is this prog crashing on delete?
    By Waldo2k2 in forum Windows Programming
    Replies: 2
    Last Post: 12-04-2002, 10:17 PM
  5. Problem need help
    By Srpurdy in forum C++ Programming
    Replies: 1
    Last Post: 07-24-2002, 12:45 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21