Opening/Activating current sourcefile folder, even in Windows 11

Just starting out? Need help? Post your questions and find answers here.
User avatar
Blue
Addict
Addict
Posts: 964
Joined: Fri Oct 06, 2006 4:41 am
Location: Canada

Re: Opening/Activating current sourcefile folder, even in Windows 11

Post by Blue »

AZJIO wrote: Tue Jul 01, 2025 2:15 pm viewtopic.php?t=84380
What’s your point exactly ? I fail to see how that linked topic relates to the current topic.
PB Forums : Proof positive that 2 heads (or more...) are better than one :idea:
AZJIO
Addict
Addict
Posts: 2141
Joined: Sun May 14, 2017 1:48 am

Re: Opening/Activating current sourcefile folder, even in Windows 11

Post by AZJIO »

You mention that you use the text in the title. I suggest taking the text from the address bar.
The window class is different in different versions of Windows. I don't see a Windows version request in your code.
User avatar
Blue
Addict
Addict
Posts: 964
Joined: Fri Oct 06, 2006 4:41 am
Location: Canada

Re: Opening/Activating current sourcefile folder, even in Windows 11

Post by Blue »

Denis wrote: Tue Jul 01, 2025 6:20 am […]
firstly - hwin is alway equal to 0, so test 'If hWin is never true.

secondly - I do prefer use API ShellExecute_() instead of RunProgram.
hWin is expected to be zero if there is no opened Explorer window titled with whatever folder you’re using. On subsequent calls — if the window is still opened of course — hWin will provide the handle for the opened window and move that window to the foreground.

The darn code is so simple that I don’t understand why it won’t work on your machine, especially given that your system and mine are the same. On my machine, it works flawlessly and every time, so I’ll leave it at that. If you ever figure out why it fails on yours, let me know.
PB Forums : Proof positive that 2 heads (or more...) are better than one :idea:
AZJIO
Addict
Addict
Posts: 2141
Joined: Sun May 14, 2017 1:48 am

Re: Opening/Activating current sourcefile folder, even in Windows 11

Post by AZJIO »

SetForegroundWindow_
Try this one: viewtopic.php?t=7424
Keep in mind that the PureBasic option not only opens the folder, but also highlights the file within it.
User avatar
Blue
Addict
Addict
Posts: 964
Joined: Fri Oct 06, 2006 4:41 am
Location: Canada

Re: Opening/Activating current sourcefile folder, even in Windows 11

Post by Blue »

Again, what’s your point exactly?
The tool presented in this topic uses the code you’re referring to to bring the window to the forefront. So what’s there to change ? My code is not worded the same, but it calls upon the same API function.
Apparently, the whole thing fails for you, and you haven’t shown me why and where.
So, keep tinkering with it if you want. For me, it’s just perfect as it is.
PB Forums : Proof positive that 2 heads (or more...) are better than one :idea:
Denis
Enthusiast
Enthusiast
Posts: 778
Joined: Fri Apr 25, 2003 5:10 pm
Location: Doubs - France

Re: Opening/Activating current sourcefile folder, even in Windows 11

Post by Denis »

Blue wrote: hWin is expected to be zero if there is no opened Explorer window titled with whatever folder you’re using. On subsequent calls — if the window is still opened of course — hWin will provide the handle for the opened window and move that window to the foreground.
On my computer it's not the case, hWin is always equal to 0, even with the correct folder is open in Explorer.
bizarre ce comportement avec le même OS
Blue wrote: The darn code is so simple that I don’t understand why it won’t work on your machine, especially given that your system and mine are the same. On my machine, it works flawlessly and every time, so I’ll leave it at that. If you ever figure out why it fails on yours, let me know.
Ok
A+
Denis
User avatar
Blue
Addict
Addict
Posts: 964
Joined: Fri Oct 06, 2006 4:41 am
Location: Canada

Re: Opening/Activating current sourcefile folder, even in Windows 11

Post by Blue »

Merci pour le suivi intéressant.
Je demeure très intéressé et curieux de savoir pourquoi du code correct et fonctionnel sur un système ne fonctionne pas sur un système pratiquement identique. Bizarre de mystère qui m’intrigue.

Malheureux que ça me coûterait si cher de me déplacer jusque chez toi.
Je serais volontiers allé voir ça de plus près. :D
PB Forums : Proof positive that 2 heads (or more...) are better than one :idea:
Denis
Enthusiast
Enthusiast
Posts: 778
Joined: Fri Apr 25, 2003 5:10 pm
Location: Doubs - France

Re: Opening/Activating current sourcefile folder, even in Windows 11

Post by Denis »

C'est pas trop le moment de venir en France (même si j'habite dans l'est vers la frontière suisse), les températures sont caniculaires!
A+
Denis
User avatar
Blue
Addict
Addict
Posts: 964
Joined: Fri Oct 06, 2006 4:41 am
Location: Canada

Re: Opening/Activating current sourcefile folder, even in Windows 11

Post by Blue »

Si j’en crois ce que raconte la télé, le mot « caniculaires » est faible pour décrire les températures qui vous tombent dessus. Vous vivez ces jours-ci dans un véritable four. Bon courage !
Va vite piquer une tête dans le Lac Léman. C’est beau, c’est frais, et c’est pas tellement loin de chez toi…
PB Forums : Proof positive that 2 heads (or more...) are better than one :idea:
AZJIO
Addict
Addict
Posts: 2141
Joined: Sun May 14, 2017 1:48 am

Re: Opening/Activating current sourcefile folder, even in Windows 11

Post by AZJIO »

Blue wrote: Tue Jul 01, 2025 3:16 pm Again, what’s your point exactly?
The SetForegroundWindow_ function gave me an error 9 times out of 10 in the programs I was using. The option I suggested gave me an error 0 times out of 10. Therefore, I permanently switched to the new function.
Denis wrote: Tue Jul 01, 2025 3:41 pm les températures sont caniculaires!
I googled the temperature in France - 38°, and in Russia-Ural it's 26°. Since the beginning of summer, the temperature has been normal, with a couple of days at 31° and then back to 22-26°.
Denis
Enthusiast
Enthusiast
Posts: 778
Joined: Fri Apr 25, 2003 5:10 pm
Location: Doubs - France

Re: Opening/Activating current sourcefile folder, even in Windows 11

Post by Denis »

AZJIO wrote: Tue Jul 01, 2025 3:51 pm
Denis wrote: Tue Jul 01, 2025 3:41 pm les températures sont caniculaires!
I googled the temperature in France - 38°, and in Russia-Ural it's 26°. Since the beginning of summer, the temperature has been normal, with a couple of days at 31° and then back to 22-26°.
22-26, These are very good temperatures (I don't really like heat).
A+
Denis
AZJIO
Addict
Addict
Posts: 2141
Joined: Sun May 14, 2017 1:48 am

Re: Opening/Activating current sourcefile folder, even in Windows 11

Post by AZJIO »

Denis wrote: Tue Jul 01, 2025 4:00 pm I don't really like heat
I think no one likes the heat. A couple of years ago, we had 36° heat all summer, all the grass was dry, and the fields were yellow. This summer, there's been a lot of rain, and even the cucumbers are growing, even though they need heat. The forecast for July is 23-26°.
User avatar
Blue
Addict
Addict
Posts: 964
Joined: Fri Oct 06, 2006 4:41 am
Location: Canada

Re: Opening/Activating current sourcefile folder, even in Windows 11

Post by Blue »

AZJIO wrote: Tue Jul 01, 2025 4:10 pm […]
A couple of years ago, we had 36° heat all summer, all the grass was dry, and the fields were yellow.
[…]
The forecast for July is 23-26°.
At temperatures like that, even people would turn yellow in Montreal (Canada) !
So, where is that ? You mention Russia/Ural before, but that’s a mega large territory. Give me a precise point I can locate on Google Map or Google Earth. Maybe I can even see you ("Oh, look ! there’s a guy coding in PureBasic down there…")
PB Forums : Proof positive that 2 heads (or more...) are better than one :idea:
Olli
Addict
Addict
Posts: 1194
Joined: Wed May 27, 2020 12:26 pm

Re: Opening/Activating current sourcefile folder, even in Windows 11

Post by Olli »

In west-France, there is small bled named "Bretagne". Do you know the "french riviera" ? Well, the "Bretagne" (english Britain), it is the "french delugia". Everybody in the hemisphere is feeling the high heats, warned by media to be careful, but in Britain, it rains standing between 18° and 22°.
We had the same recent maxima (28°, 30° and 33°) but it is far shorter than away actually. The nights are often near 17°.
I hope it will stay like that this summer. Not easy, as in 2022, when the nights were hot also...

From here, I think AZJIO lives a little bit further behind Saint-Malo (east part).
Post Reply