Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] How I Can Access Recycle Bin Files?

[SOLVED] How I Can Access Recycle Bin Files?

Scheduled Pinned Locked Moved General and Desktop
recycle bin
4 Posts 3 Posters 2.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mjzarrin
    wrote on last edited by mjzarrin
    #1

    hello dears
    i want to develop a wiping program with a feature that can wipe recycle bin.
    i coudlnt find any example with qt and i tried to dir "C:$Recycle.Bin" and find directory of recycle bin , but dir on this directory didn't get files in recycle bin, but windows show that correctly.
    i find a c++ solution in the bellow link.
    Recycle Bin Information with c++
    but when i use this in qt , it has many errors. some of them is for using "_tprintf". changing that with "wprintf", caused that errors gone but new linker errors appear like bellow:
    "main.obj:-1: error: LNK2019: unresolved external symbol __imp_CoTaskMemFree referenced in function "long __cdecl BindToCsidl(int,struct _GUID const &,void * *)" (?BindToCsidl@@YAJHAEBU_GUID@@PEAPEAX@Z)
    File not found main.obj"
    can anyone help me please,and tell how i can develop these code on my qt program. i was java developer and not familiar with to these problems.
    thank you all.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on last edited by
      #2

      Hi,

      usually unresolved symbol means you have to link some library.

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      1 Reply Last reply
      0
      • Chris KawaC Offline
        Chris KawaC Offline
        Chris Kawa
        Lifetime Qt Champion
        wrote on last edited by Chris Kawa
        #3

        When using functions from external libraries you need to link to them first.

        If you're using qmake then you do that by adding them to the LIBS variable in the .pro file.

        To give you an example: the linker in the error message you posted complains about missing CoTaskMemFree symbol. Go to the docs for that function on MSDN, in this case it's CoTaskMemFree. Scroll down to the Requirements section and you'll see a name of the library that has this function. In this case it's Ole32.lib. Pass it to the LIBS variable in the .pro file like this: LIBS += -lOle32 (that's a minus and lower case L). Repeat the process for any other missing symbols. There should only be like 2 or 3 of them.

        As for the _t* functions - that's part of Microsoft's unicode abstraction layer. Nowadays when you're using any of the Windows libraries (e.g. include "windows.h" like you did) you should define UNICODE, so that the _t* macros get resolved to their unicode versions, as opposed to the ANSI defaults. This will fix your errors. You can add the define in your .pro file like this: DEFINES += UNICODE. The less attractive alternative is to substitute the macros manually to their unicode versions(like you did with _tprintf to wprintf).

        M 1 Reply Last reply
        4
        • Chris KawaC Chris Kawa

          When using functions from external libraries you need to link to them first.

          If you're using qmake then you do that by adding them to the LIBS variable in the .pro file.

          To give you an example: the linker in the error message you posted complains about missing CoTaskMemFree symbol. Go to the docs for that function on MSDN, in this case it's CoTaskMemFree. Scroll down to the Requirements section and you'll see a name of the library that has this function. In this case it's Ole32.lib. Pass it to the LIBS variable in the .pro file like this: LIBS += -lOle32 (that's a minus and lower case L). Repeat the process for any other missing symbols. There should only be like 2 or 3 of them.

          As for the _t* functions - that's part of Microsoft's unicode abstraction layer. Nowadays when you're using any of the Windows libraries (e.g. include "windows.h" like you did) you should define UNICODE, so that the _t* macros get resolved to their unicode versions, as opposed to the ANSI defaults. This will fix your errors. You can add the define in your .pro file like this: DEFINES += UNICODE. The less attractive alternative is to substitute the macros manually to their unicode versions(like you did with _tprintf to wprintf).

          M Offline
          M Offline
          mjzarrin
          wrote on last edited by
          #4

          @Chris-Kawa
          thank you very much.
          it works perfectly with adding all you mentioned.
          I am glad after 3 days, thank you.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved