Re: ShellExecuteでExcelファイルを起動した際の戻り値について


[コメントツリー表示を見る] [発言時刻順表示を見る]

Posted by Uz on 1999/11/10 23:33:22

In Reply to: ShellExecuteでExcelファイルを起動した際の戻り値について Posted by ごりぽん on 1999/11/10 18:56:39


    > ごりぽん@名古屋の初心者です。
    はじめまして。Uzです。

    > 質問なんですが、ShellExecuteの戻り値として数値が帰ってきます
    > が、これはいったい何を意味しているのでしょうか?
    インスタンスハンドルがかえってきましゅね。

    > ファイルが存在しない場合には、どうやら'2'が帰ってくるみたい
    > ですが、正しいでしょうか?またその他のエラーケースでの戻り値
    > についてもご存知の方いらっしゃればご教授願います。

    MSDNライブラリ(Article ID: Q119513)には

    ----引用-------
    Returns
    The return value is the instance handle of the application that was opened or printed, if the function is successful. (This handle could also be the handle of a DDE server application.) A return value less than or equal to 32 specifies an error.



    Errors
    The ShellExecute() function returns the value 31 if there is no association for the specified file type or if there is no association for the specified action within the file type. The other possible error values are as follows:


    Value Meaning


    0 System was out of memory, executable file was corrupt, or
    relocations were invalid.

    2 File was not found.

    3 Path was not found.

    5 Attempt was made to dynamically link to a task, or there was
    a sharing or network-protection error.

    6 Library required separate data segments for each task.

    8 There was insufficient memory to start the application.

    10 Windows version was incorrect.

    11 Executable file was invalid. Either it was not a Windows
    application or there was an error in the .EXE image.

    12 Application was designed for a different operating system.

    13 Application was designed for MS-DOS 4.0.

    14 Type of executable file was unknown.

    15 Attempt was made to load a real-mode application (developed
    for an earlier version of Windows).

    16 Attempt was made to load a second instance of an executable
    file containing multiple data segments that were not marked
    read-only.

    19 Attempt was made to load a compressed executable file. The
    file must be decompressed before it can be loaded.

    20 Dynamic-link library (DLL) file was invalid. One of the DLLs
    required to run this application was corrupt.

    21 Application requires Microsoft Windows 32-bit extensions.

    ----引用終わり-------

    とあります。
    "2"は"File was not found."とあるのでその通りでしょう。
    APIはMSDN関連で調べられるのでAPIを使用するときは活用しましょう。
    APIを使うときは逆にこれがないと辛いですね。
    確か、インターネットでも調べられたような気がします。

    では、またわからないことがあればどうぞ。
    (僕にわからないことは無理ですけど(^^;;;)


記事スレッド一覧