forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Creating a new folder
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
silicondale



Joined: 15 Mar 2007
Posts: 141
Location: Matlock, Derbyshire

PostPosted: Sun Jun 15, 2014 10:16 pm    Post subject: Creating a new folder Reply with quote

Is there a standard dialog to create a new folder? I know there is subroutine MKDIR@ but this needs a path to be already defined - it doesn't provide the dialog window to speicfy this path. To select an existing directory there is BROWSE_FOR_FOLDER@ but this doesn't seem to allow creation of a new folder.
Back to top
View user's profile Send private message Visit poster's website AIM Address
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 4698
Location: Salford, UK

PostPosted: Sun Jun 15, 2014 10:40 pm    Post subject: Reply with quote

I do not know of a standard dialog box that only creates a new folder but the standard Open and Save As dialog boxes also allow you to create new folders.
Back to top
View user's profile Send private message
silicondale



Joined: 15 Mar 2007
Posts: 141
Location: Matlock, Derbyshire

PostPosted: Sun Jun 15, 2014 11:26 pm    Post subject: Reply with quote

Many thanks for the quick reply, Paul! Yes, I know that this can be done, but it's not really a neat solution, as the prime function of these dialogs is to define file paths - it needs a right-click to select the new folder option. Not altogether sure how this path would be returned without selection of a file, which I don't want to have to do: at this point in the program it's just creation of a folder in which to save a number of new files.
- Steve
Back to top
View user's profile Send private message Visit poster's website AIM Address
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 4698
Location: Salford, UK

PostPosted: Mon Jun 16, 2014 7:06 am    Post subject: Reply with quote

In theory you could write your own dialog using ClearWin+ with %bv and possibly %lv but it would not be easy.
Back to top
View user's profile Send private message
silicondale



Joined: 15 Mar 2007
Posts: 141
Location: Matlock, Derbyshire

PostPosted: Mon Jun 16, 2014 8:10 am    Post subject: Reply with quote

Yes, that was my thought too. I think for the present I'll set up a simple text box for the user to type in the required path to the new directory, which can then be passed to MKDIR@. Primitive but workable! Can replace it later by something a bit cleverer.
Back to top
View user's profile Send private message Visit poster's website AIM Address
jalih



Joined: 30 Jul 2012
Posts: 187

PostPosted: Mon Jun 16, 2014 8:45 pm    Post subject: Re: Reply with quote

silicondale wrote:
Primitive but workable! Can replace it later by something a bit cleverer.

Hi Steve,

How about something simple like this sample.

Actually the browse for folder dialog can create folders. The easiest approach to accomplish that is to use COM-automation on the Shell.Application COM-object. The sample project I linked above includes a small DLL for that purpose.

Have fun!
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 4698
Location: Salford, UK

PostPosted: Tue Jun 17, 2014 6:51 am    Post subject: Reply with quote

Thanks for this Jalih. I now see that SHBrowseForFolder can be used create new folders. This function is called within browse_for_folder@ so presumably I could add this functionality to ClearWin+.

I will add this to the wish list.
Back to top
View user's profile Send private message
silicondale



Joined: 15 Mar 2007
Posts: 141
Location: Matlock, Derbyshire

PostPosted: Tue Jun 17, 2014 8:02 am    Post subject: Reply with quote

Many thanks, jalih - for the 'something cleverer' ! Will try it today.
-----------------
[edit] Just tried it - simply brilliant! It does exactly what I needed. Many thanks for this.
Back to top
View user's profile Send private message Visit poster's website AIM Address
silicondale



Joined: 15 Mar 2007
Posts: 141
Location: Matlock, Derbyshire

PostPosted: Mon Aug 11, 2014 12:54 pm    Post subject: Reply with quote

Hi, Jalih -- although that works brilliantly on my computer, a friend who is testing it has trouble installing. He uses BitDefender security, and it reports a trojan and refuses to load browse.dll (Gen:Trojan.Heur.GM.0144010002). I have to say that I've tried with Norton, Sophos, and Microsoft antivirus and none of these detect any problem. Could be a false positive from BitDefender but I thought I should tell you!

Just did a Metascan and 4 out of 40 antivirus programs detected this trojan - apart from Bitdefender these were F-Secure, Emsisoft, and Lavasoft. The other 36 said it was clean.
Back to top
View user's profile Send private message Visit poster's website AIM Address
jalih



Joined: 30 Jul 2012
Posts: 187

PostPosted: Fri Aug 15, 2014 4:10 pm    Post subject: Re: Reply with quote

silicondale wrote:
...a friend who is testing it has trouble installing. He uses BitDefender security, and it reports a trojan and refuses to load browse.dll (Gen:Trojan.Heur.GM.0144010002). I have to say that I've tried with Norton, Sophos, and Microsoft antivirus and none of these detect any problem. Could be a false positive from BitDefender but I thought I should tell you!

Sorry for the late reply. Anyway, browse.dll should be clean. I use Microsoft antivirus and Avast myself. Avast in particulary has a tendency to report a lot of files as malware. It even deleted most of the files during adw modula-2 compiler installation.

Below is the minibasic source code for the browse.dll:
Code:

##NOCONSOLE
##MAKEDLL

export BrowseForFolder
func BrowseForFolder(string title, string buffer)
   IUnknown *objShell
   IDispatch *objFolder, *objFolderItem
   string *path

   objShell = CreateComObject("Shell.Application", "")
   if objShell = NULL
      buffer = ""
      return
   endif

   GetComProperty(objShell, "%o", &objFolder, ".BrowseForFolder(%d,%s, %d)", 0, title, 0)
   if objFolder = NULL
      buffer = ""
   else
      GetComProperty(objFolder, "%o", &objFolderItem, ".Self")
      GetComProperty(objFolderItem, "%s", &path, ".Path")
      buffer = #path
      SysFreeString(path)
      objFolderItem->Release()
      objFolder->Release()
   endif
   objShell->Release()
endf
Back to top
View user's profile Send private message
silicondale



Joined: 15 Mar 2007
Posts: 141
Location: Matlock, Derbyshire

PostPosted: Fri Aug 15, 2014 5:32 pm    Post subject: Reply with quote

many thanks, jalih - I thought as much! I had a similar problem today loading a java update, which was rejected by Norton. Some of the antivirus programs are getting a bit too fierce.
Back to top
View user's profile Send private message Visit poster's website AIM Address
jalih



Joined: 30 Jul 2012
Posts: 187

PostPosted: Sat Aug 23, 2014 7:56 am    Post subject: Reply with quote

Hi Steve, it's time to update into this decade...

Could you test this project?

I made a quick attempt to use Windows 7 style file dialogs.
Back to top
View user's profile Send private message
silicondale



Joined: 15 Mar 2007
Posts: 141
Location: Matlock, Derbyshire

PostPosted: Sun Aug 24, 2014 2:59 pm    Post subject: Reply with quote

Hi, jalih .. getting virus warnings again. Virus.Win32.Heur.l on the browse.exe file, and Norton has just deleted the dll files for containing 'Suspicious.Cloud.7.EP"

However, I did buy the Minibasic compiler and rebuilt the one you sent before, whcih scans clean. Could do the same with this one.
Back to top
View user's profile Send private message Visit poster's website AIM Address
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 4698
Location: Salford, UK

PostPosted: Tue Feb 10, 2015 12:23 pm    Post subject: Reply with quote

It turns out that there is an existing undocumented function for this.

Here is a sample program.

Code:
program main
include <windows.ins>
logical L
character(256) path
L = browse_for_folder1@(0,"Some instructions",path,Z'40')
if(L) print*, path
end


Notes:
1) The first argument can be set to the HWND of the parent window.
2) Google search for "BROWSEINFO structure MSDN" for flags other than Z'40'.
Back to top
View user's profile Send private message
wahorger



Joined: 13 Oct 2014
Posts: 331
Location: Morrison, CO

PostPosted: Thu Dec 29, 2016 7:26 pm    Post subject: Reply with quote

This sample code now gives ne a floating point stack fault. I ran this example after my code failed.

It is interesting to note that whether or not the Z'40' or z'41' is present, the dialog always allows making a new folder.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group