WinFileDlg problem - OS2

This is a discussion on WinFileDlg problem - OS2 ; Once I had WinFileDlg() in working order with the multiple_files-option enabled, but I actually want to process one file each time. Depending on what I try without that option, the app just seems to crash without any error message, or ...

+ Reply to Thread
Results 1 to 7 of 7

Thread: WinFileDlg problem

  1. WinFileDlg problem


    Once I had WinFileDlg() in working order with the multiple_files-option
    enabled, but I actually want to process one file each time. Depending on
    what I try without that option, the app just seems to crash without any
    error message, or it returns NULL. :-(

    When there's one file selected (and selectable), how do I get access to
    that file name?

    Here's what I hoped would work, but it fails, and I don't know why (no
    need to explain, I just want something that works :-)):

    hwndDlg=WinFileDlg(HWND_DESKTOP,HWND_DESKTOP,&fild);

    if (hwndDlg&&(fild.lReturn==DID_OK))
    {
    sprintf(filename,"%s",*(fild.papszFQFilename)[0]);



    ---

  2. Re: WinFileDlg problem

    You might want to take a look at
    http://www.laser.ru/evgen/articles/A...2/aos2p_0.html. There are loads op
    programming examples shown here.Personally I have found the following books
    to be really worthwhile.

    OS/2 Presentation Manager Programming, Petzold


    a.. Ziff-Davis Press ISBN 1-56276-123-4,

    Secrets of the OS/2 Warp Masters, Sullivan,.

    a.. Wiley, ISBN 0-471-13171-7
    "ML" wrote in message
    newsiUnDlQNARSW090yn@hotmai1.com...
    >
    > Once I had WinFileDlg() in working order with the multiple_files-option
    > enabled, but I actually want to process one file each time. Depending on
    > what I try without that option, the app just seems to crash without any
    > error message, or it returns NULL. :-(
    >
    > When there's one file selected (and selectable), how do I get access to
    > that file name?
    >
    > Here's what I hoped would work, but it fails, and I don't know why (no
    > need to explain, I just want something that works :-)):
    >
    > hwndDlg=WinFileDlg(HWND_DESKTOP,HWND_DESKTOP,&fild);
    >
    > if (hwndDlg&&(fild.lReturn==DID_OK))
    > {
    > sprintf(filename,"%s",*(fild.papszFQFilename)[0]);
    >
    >
    >
    > ---




  3. Re: WinFileDlg problem

    ML schrieb:
    > Once I had WinFileDlg() in working order with the multiple_files-option
    > enabled, but I actually want to process one file each time. Depending on
    > what I try without that option, the app just seems to crash without any
    > error message, or it returns NULL. :-(
    >
    > When there's one file selected (and selectable), how do I get access to
    > that file name?
    >
    > Here's what I hoped would work, but it fails, and I don't know why (no
    > need to explain, I just want something that works :-)):
    >
    > hwndDlg=WinFileDlg(HWND_DESKTOP,HWND_DESKTOP,&fild);
    >
    > if (hwndDlg&&(fild.lReturn==DID_OK))
    > {
    > sprintf(filename,"%s",*(fild.papszFQFilename)[0]);
    >
    >
    >
    > ---


    I think it's:

    if (hwndDlg && (fild.lReturn==DID_OK))
    {
    ...
    if (fild.papszFQFilename)
    {
    for (i=0;i {
    sprintf(filename,"%s",fild.papszFQFilename[i]);
    }
    WinFreeFileDlgList(fild.papszFQFilename);
    }
    else
    {
    /* user hacked in name of the (one) file directly */
    ...
    sprintf(filename,"%s",fild.szFullFile);
    }
    }

    Lars

  4. Re: WinFileDlg problem


    >> hwndDlg=WinFileDlg(HWND_DESKTOP,HWND_DESKTOP,&fild);


    >> if (hwndDlg&&(fild.lReturn==DID_OK))
    >> {
    >> sprintf(filename,"%s",*(fild.papszFQFilename)[0]);


    > I think it's:


    > if (hwndDlg && (fild.lReturn==DID_OK))
    > {
    > ...
    > if (fild.papszFQFilename)
    > {
    > for (i=0;i > {
    > sprintf(filename,"%s",fild.papszFQFilename[i]);
    > }
    > WinFreeFileDlgList(fild.papszFQFilename);
    > }
    > else
    > {
    > /* user hacked in name of the (one) file directly */
    > ...
    > sprintf(filename,"%s",fild.szFullFile);
    > }
    > }


    Thanks, I'll give this a try later. This "else" wasn't included in
    an old example in this ng, and I still don't understand why this
    didn't work with fild.papszFQFilename[0] when one file was
    selected. Never mind, let me first give this a try.



    ---

  5. Re: WinFileDlg problem

    In article , spamgate@hotmai1.com (ML) wrote:

    >Once I had WinFileDlg() in working order with the multiple_files-option
    >enabled, but I actually want to process one file each time. Depending on
    >what I try without that option, the app just seems to crash without any
    >error message, or it returns NULL. :-(
    >
    >When there's one file selected (and selectable), how do I get access to
    >that file name?
    >
    >Here's what I hoped would work, but it fails, and I don't know why (no
    >need to explain, I just want something that works :-)):
    >
    > hwndDlg=WinFileDlg(HWND_DESKTOP,HWND_DESKTOP,&fild);
    >
    > if (hwndDlg&&(fild.lReturn==DID_OK))
    > {
    > sprintf(filename,"%s",*(fild.papszFQFilename)[0]);



    this worked...

    if (
    WinFileDlg(HWND_DESKTOP, hwnd, &fd)
    &&
    (fd.lReturn == DID_OK)
    )
    {

    if (fd.papszFQFilename)
    {
    for (i = 0; i < fd.ulFQFCount; ++i)
    {
    insertListBoxItem(hwndListbox, LIT_SORTASCENDING,
    *fd.papszFQFilename[i], 0);
    }
    WinFreeFileDlgList(fd.papszFQFilename);
    }
    }

    --
    bye
    Alessandro

  6. Re: WinFileDlg problem


    > http://www.laser.ru/evgen/articles/A...2/aos2p_0.html.


    "Bookmarked". And too bad chapter 26 isn't completed (yet), since
    that should deal with WinFileDlg()... :-)

    All mentioned books bookmarked too, and thanks to all.



    ---


  7. Re: WinFileDlg problem

    ML wrote:
    >
    > >> hwndDlg=WinFileDlg(HWND_DESKTOP,HWND_DESKTOP,&fild);

    >
    > >> if (hwndDlg&&(fild.lReturn==DID_OK))
    > >> {
    > >> sprintf(filename,"%s",*(fild.papszFQFilename)[0]);

    >
    > > I think it's:

    >
    > > if (hwndDlg && (fild.lReturn==DID_OK))
    > > {
    > > ...
    > > if (fild.papszFQFilename)
    > > {
    > > for (i=0;i > > {
    > > sprintf(filename,"%s",fild.papszFQFilename[i]);
    > > }
    > > WinFreeFileDlgList(fild.papszFQFilename);
    > > }
    > > else
    > > {
    > > /* user hacked in name of the (one) file directly */
    > > ...
    > > sprintf(filename,"%s",fild.szFullFile);
    > > }
    > > }

    >
    > Thanks, I'll give this a try later. This "else" wasn't included in
    > an old example in this ng, and I still don't understand why this
    > didn't work with fild.papszFQFilename[0] when one file was
    > selected. Never mind, let me first give this a try.


    That's in the toolkit (4.5) reference I believe.

    --
    [Reverse the parts of the e-mail address to reply.]

+ Reply to Thread