473,653 Members | 2,968 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

File extensions in Windows

Is there a standard way that Windows programs open files? You know how
you can associate a file type with a program, by telling Windows to
always open a type with a program? Is the filename always passed as a
command line argument to the program? How does that work?

(I'm new to Windows programming and part of a program I'd like to write
involves opening a document with another program.)

Thanks.

Jun 25 '06 #1
1 1125
"Jane" <co***********@ gmail.com> wrote in message
news:11******** **************@ c74g2000cwc.goo glegroups.com.. .
Is there a standard way that Windows programs open files? You know how
you can associate a file type with a program, by telling Windows to
always open a type with a program? Is the filename always passed as a
command line argument to the program? How does that work?

(I'm new to Windows programming and part of a program I'd like to write
involves opening a document with another program.)


It usually is. Some applications, like MS Word for example, publish details
of the dynamic data exchange (DDE) transaction that a shell can use as well.
So, if the user clicks on a .doc file, the shell checks to see if the
associated application is running. If it is not, it checks the registry for
information on the associated application and the format of the command line
required by the process. Then it launches it. If the application is already
running, the shell sends a message to the application to open another
document in the context of the same application which often uses a multiple
document interface (MDI).

Some applications forgo the use of the DDE messages. They are smart enough
to know if a second (or subsequent) instance of itself is being started. In
that case, they send their command line parameters (typically the file name
and perhaps an option like "/print") via a convenient method (window message
etc) to the first instance and quickly exit.

Some other applications, like Notepad, simply make no provision for opening
multiple documents. With no DDE info in the registry, and no special
processing on the part of Notepad, what you get is a new instance of the
application for every document.

I have just scratched the surface of this topic. More detail is here:

http://msdn.microsoft.com/library/de.../fileassoc.asp

though it is written from an operating system rather than .Net perspective.

If you need to launch an application programmaticall y check the docs for the
ProcessStartInf o class and its UseShellExecute property.

(Just by the way, ShellExecute is the name of the unmanaged function that
the shell and applications use to launch applications via an associated
file).

Regards,
Will

Jun 25 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2469
by: Daniel | last post by:
Hello I am developing a Java application for MacOS X, Windows and Linux. So far easy with Java. But when it comes to file types, the platfrom-specific handling knocks my application-created files out on a MacOS X. The idea was to save text files with a specific extension (*.ust) on all systems. Exchange of files is done by email. I did not register a specific file type or creator to the MacOS X. When attaching the file
1
1327
by: Ocean | last post by:
Helo, anybody know how you can secure file; so give permissons for some users any take everyone to off? Example: I have server extension folders and in many cases in more debth. (d:\wwwroot\inetpub\test\abcd\file\) ... test and abcd are server extensions web(make with IIS manager), folder file is jsut folder make with Explorer..
29
3386
by: Tola | last post by:
In my case of study, my teacher gave me a project, after I analysed the problem I found that I had to used open the file on the other machine? Please help? Thank you in advance. Tola CHROUK
6
5290
by: Kiran | last post by:
Hi, I have program, which opens file at the startup and logs error messages to the file, file handle is closed at the end of the program. However if file is deleted in-between, program do not report any error while writing to the open file handle. On Windows, file shows-up again in explorer and automatically deleted finally when program ends. On Unix, same thing happens if file is on nfs mounted drive, but in this case, actual file is...
3
3161
by: Shapper | last post by:
Hello, I created a script to upload a file. To determine the file type I am using userPostedFile.ContentType. For example, for a png image I get "image/png". My questions are: 1. Where can I find a list of all the types which can be returned? For example, if it is a Word document will it return "document/doc".
1
2417
by: iwdu15 | last post by:
hi, how can i get the icon associated with a certain file type? thanks -- -iwdu15
1
6476
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting" setting to be "E_ALL", notices are still not getting reported. The perms on my file are 664, with owner root and group root. The php.ini file is located at /usr/local/lib/php/php.ini. Any ideas why the setting does not seem to be having an effect? ...
38
5057
by: ted | last post by:
I have an old link that was widely distributed. I would now like to put a link on that old page that will go to a new page without displaying anything.
26
3595
by: Don Calloway | last post by:
I have created a <filename>.db1 (where <filenameis the name given to the database) Access database that is being used in multi-user mode. When the <filename>.db1 file is opened by a user, the corresponding locking file appears in the Windows Explorer view pane as well as expected. Occasionally, a "bare" db1 file (extension only without a filename) appears in the Windows Explorer window. Can anyone tell me what that file is and what it...
3
6092
by: Mark | last post by:
Hello This might be an odd question. I have an Excel VBA program that searches through a folder for any .htm or .html file, searches the file for any 'hrefs' and prints them to the spreadsheet. For some reason I have noticed that some of the files are HTML Documents, and some are HTML Files, and the program is only searching through the HTML Files. I'm not sure if there is a difference between the two. The only thing that I can...
0
8283
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8704
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8470
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8590
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5620
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4147
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4291
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1914
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1591
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.