Opening a file from C/C++ application 
Author Message
 Opening a file from C/C++ application

Hi
I would like to know how I can open a Microsoft Access
file from a C/C++ application.
I used the function "spawnl" and managed to launch Access
but cannot open a particular .mdb file.
How can I do it? or any other ways to open the file?
Thanks!


Wed, 02 Mar 2005 23:01:56 GMT  
 Opening a file from C/C++ application
The ShellExecute or ShellExecuteEx functions should do what you want.

Documentation on the ShellExecute function can be found at the following
link
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shel...
tform/Shell/reference/functions/shellexecute.asp

If you call ShellExecute with the path to the .mdb file as its its
lpOperation parameter and "open" as its lpVerb parameter Windows will open
the file with it's associated application ie Access.

eg.
ShellExecute( NULL,  "open", "C:\My Documents\MyDatabase.mdb", NULL, "C:\My
Documents", SW_SHOWNORMAL);

There is a link to the ShellExecuteEx function in the ShellExecute
documentation.

Hope this helps,
Daniel


Quote:
> Hi
> I would like to know how I can open a Microsoft Access
> file from a C/C++ application.
> I used the function "spawnl" and managed to launch Access
> but cannot open a particular .mdb file.
> How can I do it? or any other ways to open the file?
> Thanks!



Wed, 02 Mar 2005 23:32:05 GMT  
 Opening a file from C/C++ application
It works. Thanks!
Bu with ShellExecute, is it possible to ask the system to
wait till the application is closed before executing the
rest of the code?

Quote:
>-----Original Message-----
>The ShellExecute or ShellExecuteEx functions should do
what you want.

>Documentation on the ShellExecute function can be found
at the following
>link
>http://msdn.microsoft.com/library/default.asp?

url=/library/en-us/shellcc/pla
Quote:
>tform/Shell/reference/functions/shellexecute.asp

>If you call ShellExecute with the path to the .mdb file
as its its
>lpOperation parameter and "open" as its lpVerb parameter
Windows will open
>the file with it's associated application ie Access.

>eg.
>ShellExecute( NULL,  "open", "C:\My

Documents\MyDatabase.mdb", NULL, "C:\My
Quote:
>Documents", SW_SHOWNORMAL);

>There is a link to the ShellExecuteEx function in the
ShellExecute
>documentation.

>Hope this helps,
>Daniel



>> Hi
>> I would like to know how I can open a Microsoft Access
>> file from a C/C++ application.
>> I used the function "spawnl" and managed to launch
Access
>> but cannot open a particular .mdb file.
>> How can I do it? or any other ways to open the file?
>> Thanks!

>.



Sat, 05 Mar 2005 09:35:32 GMT  
 Opening a file from C/C++ application
It is possible with ShellExecuteEx. Specify SEE_MASK_NOCLOSEPROCESS
flag, and you will get a handle to the new process. Use
WaitForSingleObject to wait on this handle.
--
With best wishes,
    Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken


Quote:
> It works. Thanks!
> Bu with ShellExecute, is it possible to ask the system to
> wait till the application is closed before executing the
> rest of the code?

> >-----Original Message-----
> >The ShellExecute or ShellExecuteEx functions should do
> what you want.

> >Documentation on the ShellExecute function can be found
> at the following
> >link
> >http://msdn.microsoft.com/library/default.asp?
> url=/library/en-us/shellcc/pla
> >tform/Shell/reference/functions/shellexecute.asp

> >If you call ShellExecute with the path to the .mdb file
> as its its
> >lpOperation parameter and "open" as its lpVerb parameter
> Windows will open
> >the file with it's associated application ie Access.

> >eg.
> >ShellExecute( NULL,  "open", "C:\My
> Documents\MyDatabase.mdb", NULL, "C:\My
> >Documents", SW_SHOWNORMAL);

> >There is a link to the ShellExecuteEx function in the
> ShellExecute
> >documentation.

> >Hope this helps,
> >Daniel



> >> Hi
> >> I would like to know how I can open a Microsoft Access
> >> file from a C/C++ application.
> >> I used the function "spawnl" and managed to launch
> Access
> >> but cannot open a particular .mdb file.
> >> How can I do it? or any other ways to open the file?
> >> Thanks!

> >.



Sun, 06 Mar 2005 01:34:29 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Newbie: separate big .cs file into small .cs files

2. resx files needed for cs - files ??

3. CS files display in VS6 like CPP files ?

4. Form1.cs on new applications

5. Include code in other Cs files

6. Reuse of cs files, namespace, arch advice pls

7. How to Generate .cs file at Runtime

8. Two CS files (using namespaces)

9. My .cs files were deleted!?

10. manipulating server controls in the Codebehind .cs file

11. *.~cs files

12. Custom Class.cs default file

 

 
Powered by phpBB® Forum Software