News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Have a doubt................

Started by shaikkareem, March 06, 2014, 03:09:43 PM

Previous topic - Next topic

shaikkareem

i noticed that without a file name we can't move, copy, cut, view the properties of that file, delete, etc,. but how windows manages those operations with just selecting the file with mouse cursor and getting the file name for those operations.  you all know that just clicking on desired file and double click it to open and right click it for some operations. ok it is windows thing then how the third party programs were able to receive from windows the information required for their operations from just clicking with mouse on desired file.........?


can any body explain me this , just get a curious about it.................

Mark44

Quote from: shaikkareem on March 06, 2014, 03:09:43 PM
i noticed that without a file name we can't move, copy, cut, view the properties of that file, delete, etc,. but how windows manages those operations with just selecting the file with mouse cursor and getting the file name for those operations.  you all know that just clicking on desired file and double click it to open and right click it for some operations. ok it is windows thing then how the third party programs were able to receive from windows the information required for their operations from just clicking with mouse on desired file.........?


can any body explain me this , just get a curious about it.................
When you click or double-click the mouse, the event loop that runs all the time captures information about where on the screen the mouse pointer was when the click event was generated. If a file is listed in Windows Explorer or as an icon on the desktop, or whatever, the location of the file name or icon is available to Windows, so it can associated a file with that location. Windows and other operating systems are extendable via an application programming interface (or API), so third-parties can create applications that work like underlying operating system.

hutch--

It tends to be why the software that runs a computer is called Disk Operating System. Part of its capacity is to provide an interface to such objects as disk files and this has ranged from an ancient DosShell to Winfile and more recently Explorer. They are operating system components that provide an interface to disk files. When you use a Windows API to access a file you are using the location provided by the operating system to find and process that file.

dedndave

in DOS days, you could move a file by using the rename function
it did not make a copy of the file in the process
it would be nice to know if that's possible with win-32   :biggrin:

TWell

Quote from: dedndave on March 06, 2014, 09:55:11 PM
in DOS days, you could move a file by using the rename function
it did not make a copy of the file in the process
it would be nice to know if that's possible with win-32   :biggrin:
MoveFile perhaps ;)

dedndave

thanks Timppa   :t

didn't see that one   :biggrin:

shaikkareem

yeah............ i always wonder how interfaces provided by the core level or something else of windows os to interact with them ........ and i want to knw that is there any way to study about explorer.exe and doing experiments on it(not deeply)...i know that the explorer.exe is the program doing every thing showing icons,folder,etc..., where do i find about this kind of things...............

Vortex

Quote from: dedndave on March 06, 2014, 09:55:11 PM
in DOS days, you could move a file by using the rename function
it did not make a copy of the file in the process
it would be nice to know if that's possible with win-32   :biggrin:

Hi Dave,

It's like UNIX\Linux's mv command.

GoneFishing

Quote from: shaikkareem on March 07, 2014, 07:34:36 PM
yeah............ i always wonder how interfaces provided by the core level or something else of windows os to interact with them ........ and i want to knw that is there any way to study about explorer.exe and doing experiments on it(not deeply)...i know that the explorer.exe is the program doing every thing showing icons,folder,etc..., where do i find about this kind of things...............
go to MSDN and look for Shell programming

TouEnMasm

The explorer is just a window showing what is write in the FAT.
Just made a search on msdn with FAT and you have all that you need.
Fa is a musical note to play with CL

TWell

Is Shell Extensions what are you looking for ?
Look here

hutch--

Dave,

The normal technique in Win32 is if you "move" a file from one directory to another on the same partition, it is just renamed with a different path whereas if you move a file from one partition to another it must be physically copied to the new partition.

dedndave

i guess i haven't played with these methods because i haven't had much need yet   :biggrin:

jj2007

Quote from: hutch-- on March 08, 2014, 07:54:11 PMThe normal technique in Win32 is if you "move" a file from one directory to another on the same partition, it is just renamed with a different path whereas if you move a file from one partition to another it must be physically copied to the new partition.

Note it's not the coder who does the copying; what Hutch means is that the OS will copy the file, and afterwards delete the old one. Renaming is much faster because it's just changing an entry in the disk directory, without touching the content of the file.

MoveFileEx:
QuoteWhen moving a file, the destination can be on a different file system or volume. If the destination is on another drive, you must set the MOVEFILE_COPY_ALLOWED flag in dwFlags.

MoveFile:
QuoteA new file may be on a different file system or drive. A new directory must be on the same drive.

Mark44

As a bit of historic trivia, back in the DOS 3.x days about 20 years ago, I used to teach a variety of programming courses at a community college. One of the courses I didn't teach was a basic computer literacy course whose goal was to familiarize students with DOS and several common applications such as Word and Excel.

One of the topics in that course was how to rename a disk directory. The basic steps were:

  • Create a directory with the new name (using md - "make directory").
  • Copy all the files from the old directory to the new one (using copy).
  • Delete all the files in the old directory (using del).
  • Delete the old directory (using rd - "remove directory").

This seemed unbelievably clunky, so I set out to find a better way. After some searching through my DOS and BIOS Function Quick Reference, I found that the low-level DOS (int 21h) function 56h Rename File could be used not only to rename a file, but to rename a directory. My reference didn't document the fact that this function also included directories, but I figured out that it did apply to directories. After all, the only difference between a file and a directory is that a directory has a subdirectory name bit set in the file attributes, and an ordinary file does not.

At the time, there was no command-line support in DOS 3.x to rename a directory, but you could do it using the int 21h DOS interface. Along about DOS 5.0 or so, as I recall, functionality was added to the REN command to work with directories as well as files.