Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Haiku OS rightclick menu file finder thingy for windows made in dark basic

Author
Message
zero32
7
Years of Service
User Offline
Joined: 28th Jul 2016
Location:
Posted: 21st May 2017 14:45 Edited at: 22nd May 2017 07:32
Hey, does anyone of you know BeOS / Zeta / Haiku?

it has a nice feature that i don't know what it's called. well you can open any folder from the right click menu. (screenshot attached)
i think that is really nice but the closest thing i've seen that comes close to this is the reactOS explorer.
now i made my own attempt at this. there are no icons and it isn't the nicest looking, but i want to make it useable first. (screenshot and app attached)
i called it pathWalker. FileWalker was already taken...

but i need your help.
i don't want to run the app as administrator. but there are folders where i would need admin rights to read from them. without admin rights the app is crashing because it cannot open the folder/file. how would i check the permissions before i access the folders/files?

and for the icon display, i would need to get the ExtractAssociatedIconA function running with dark basic pro. i use the matrix1 plugin.
here is a messy test code i made to test the function



maybe someone experienced with the win api can help me?

EDIT: added source for those who are interested
EDIT2: added comments to source.
EDIT3: deleted app, because of a bug that causes the skinfile to write to the current directory opened, instead of the app's exe directory. i'm now cleaning my hard drive.

Attachments

Login to view attachments
WickedX
15
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 21st May 2017 17:54
Not too bad. The error itself is caused by not passing lpiIcon as a pointer. I have commented this snippet with some additional suggestions.

zero32
7
Years of Service
User Offline
Joined: 28th Jul 2016
Location:
Posted: 21st May 2017 19:27 Edited at: 21st May 2017 19:29
oh that is really nice, i appreciate your help

i changed the "ExtractAssociatedIconA" to the "SHGetFileInfoA" because the "ExtractAssociatedIconA" only retrieves the middle sized icon and i changed the "DrawIcon" to the "DrawIconEx" command to draw the icon the right size
i applied your suggestion with the memory to get the structure working "SHGetFileInfoA" needs.

new code:


i noticed you added "ReleaseDC" to the code. i didn't know about that. do i need some extra cleanup stuff after the "SHGetFileInfoA" call to keep things clean, before i add this to my app?
WickedX
15
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 21st May 2017 20:35
SHGetFileInfo needs no cleanup. In fact DestroyIcon is only needed for icons created with CreateIconIndirect.
zero32
7
Years of Service
User Offline
Joined: 28th Jul 2016
Location:
Posted: 22nd May 2017 07:17
cool, icons work now. screenshot attached
thank you.

i have to work out some bugs. it's somewhat slow and flickery right now, because i have to redraw all icons after every sync command.
and i create a new bitmap for the skin everytime a new box opens or an open box closes. i guess that's not the best option for hdds and it slows down my app.

WickedX wrote: "In fact DestroyIcon is only needed for icons created with CreateIconIndirect."

seems not to be the case:
https://msdn.microsoft.com/en-us/library/windows/desktop/bb762179(v=vs.85).aspx
Quote: "If SHGetFileInfo returns an icon handle in the hIcon member of the SHFILEINFO structure pointed to by psfi, you are responsible for freeing it with DestroyIcon when you no longer need it."


https://msdn.microsoft.com/en-us/library/windows/desktop/ms648067(v=vs.85).aspx
Quote: "You must destroy the icon handle returned by ExtractAssociatedIcon by calling the DestroyIcon function."

Attachments

Login to view attachments
zero32
7
Years of Service
User Offline
Joined: 28th Jul 2016
Location:
Posted: 22nd May 2017 22:16 Edited at: 22nd May 2017 22:24
i made some changes. now the code that draws the icons is much cleaner. also it doesn't need a skin file anymore as i got SetLayeredWindowAttributes working and it makes the app much faster. that command has a rather strange problem in dbpro as it doesn't work correctly with some colors.

right now my app has the following known bugs:
-icons that should be on a box in the back will be drawn on top of the box in the front. i don't know how i can work around that, because i must first draw the boxes, then call sync and then draw the icons, or the icons will disappear with each sync call.
-there is no scroll option for folders with too many files in them.
-the app cannot check if a file/folder is a system/hidden file/folder
-the app cannot check if it has the sufficent rights to open a folder. as example, if you hover over "$Recycle.bin" on the c: drive, the app will most likely crash.
-you must need a certain amount of space between the x coordinate and the right side of the screen or else the app will display no window at start.

i added 2 .reg files to "install" the app so it sits in the context menu like in the screenshots. tested only with windows 10.
if you know what you are doing you can change the path. as a default, the exe file will be assumed to be located at "c:\tools\pathWalker\pathWalker.exe"

note: the app will exit it looses focus.

Attachments

Login to view attachments
WickedX
15
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 23rd May 2017 01:21 Edited at: 23rd May 2017 01:35
My Windows SDK Reference is a little dated and DestroyIcon is returning successfully. MSDN would seem to be correct.

I'll have to take a look at my source archive. I believe, I have worked through some of your other issues before.

Edit:

Quote: "i got SetLayeredWindowAttributes working and it makes the app much faster. that command has a rather strange problem in dbpro as it doesn't work correctly with some colors."


Don't know if this is the issue. But, Windows uses 0x00bbggrr color reference.
zero32
7
Years of Service
User Offline
Joined: 28th Jul 2016
Location:
Posted: 29th May 2017 15:47
WickedX wrote: "I'll have to take a look at my source archive. I believe, I have worked through some of your other issues before."

that would be great

WickedX wrote: "Windows uses 0x00bbggrr color reference."

i remember it stated that it uses 0x00rrggbb color reference, but you are right. i somehow got confused. well it seems it uses kind of both. when i pass 0x00ff0000 then everything that is red will stay red, but i can klick through. when i pass 0x000000ff then everything that is red will be transparent, but i cannot click through, instead the window will just loose focus and the underlying window will not gain it. i used 0x00ff00ff and that seems to be working fine.

Login to post a reply

Server time is: 2024-03-28 10:32:13
Your offset time is: 2024-03-28 10:32:13