Name DataType Subtype Length ShellControl Automation 'Microsoft Shell Controls And Automation'.Shell Folder Automation 'Microsoft Shell Controls And Automation'.Folder3 FolderItems Automation 'Microsoft Shell Controls And Automation'.FolderItems3 FolderItem Automation 'Microsoft Shell Controls And Automation'.FolderItem2 Foldertxt Text 1024 if isclear(ShellControl) then create(ShellControl); Folder := ShellControl.BrowseForFolder(0,'Ordner suchen',0); FolderItems := Folder.Items(); FolderItem := FolderItems.Item; Foldertxt := format(FolderItem.Path); clear(ShellControl);
Comments
I've immediatly added it to my "Tools Collection" ;-)
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
Where can i see the "Tools Collection" :?: Maybe there is some interesting things for me
Microsoft Dynamics NAV Developer
I have tried the code given by u.But when I run the codeunit contained ur code then it is not running.It compiled fine...but run just for a moment.Can u give me the complete solution for it.
Unfortunatelly this DLL may not be present in the client Windows System folder and then your application will fail.
D365 Business Central Solutions Architect
BC AL/NAV C/AL Developer
BC Repositories.com
In some situations however the browser window disappears to the background. A workarround for this is to provide the current window hWnd as the first parameter of the 'BrowseForFolder' function.
But i can only obtain this hWnd by writing a DLL that uses API functions to get the hWnd of the current active window. Which brings us back to the root, we didn't want to distribute extra automation objects.
Anyone got any code that obtains the hWnd of the current active window by only using excisting windows/internet explorer automation objects? :-s
Yes, here it is:
ActiveWindow Automation 'CSideWindowCheck'.WindowCheck
or (if you don't have that Automation)
ActiveWindow Automation 'C/SIDE Utility Classes'.ActiveWindow
(I've optimized the code a little bit and it still works ;-) )
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
So my conclusion is you won't be able to do this properly without adding automation.
Ehm Timo your code might look better this way but i think it will return an error if the user cancels the browse for folder window.
The most efficient working code is in my opinion:
(lclsWindowMgt is my own class you can use the one in the download above as well)
(Guess who made it?)
From your application add the following code to browse for a directory:
[/i]
After more then a year
Don't forget to thank everybody else.
This topic is a good example where combined knowledge leads towards a sollution.
if the code from GARAK doesnt suite you because of error when cancelling the window, just change it like:
IF ISCLEAR(ShellControl_Au_Loc) THEN
CREATE(ShellControl_Au_Loc);
Folder_Au_Loc := ShellControl_Au_Loc.BrowseForFolder(0,'Chose Folder',0);
:roll: IF ISCLEAR(Folder_Au_Loc) THEN
:roll: EXIT('');
FolderItems_Au_Loc := Folder_Au_Loc.Items();
FolderItem_Au_Loc := FolderItems_Au_Loc.Item;
FolderText_Te_Loc := FORMAT(FolderItem_Au_Loc.Path);
EXIT(FolderText_Te_Loc);
Ishwar Sharma
My Blogs: Dynamics Community Blog | Blogspot
Connect: Google + | Twitter