CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9

Threaded View

  1. #6
    Join Date
    Mar 2004
    Location
    (Upper-) Austria
    Posts
    2,899

    Re: open file window (open...)

    Code:
    ofn.lStructSize       = sizeof(ofn);
    ofn.hwndOwner         = 0;
    ofn.hInstance         = 0;
    ofn.lpstrFilter       = 0;
    ofn.lpstrCustomFilter = 0;
    ofn.nMaxCustFilter    = 0;
    ofn.nFilterIndex      = 0;
    ofn.lpstrFile         = szExtBuffer;
    ofn.nMaxFile          = MAX_PATH;
    ofn.lpstrFileTitle    = 0;
    ofn.nMaxFileTitle     = 0;
    ofn.lpstrInitialDir   = 0;
    ofn.lpstrTitle        = "Open file";
    ofn.Flags             = 0;
    ofn.nFileOffset       = 0;
    ofn.nFileExtension    = 0;
    ofn.lpstrDefExt       = 0;
    ofn.lCustData         = 0;
    ofn.lpfnHook          = 0;
    ofn.lpTemplateName    = 0;
    This is too much code in my eyes, since it would go easier:

    Code:
    ZeroMemory(&ofn, sizeof(ofn));
    
    ofn.lStructSize       = sizeof(ofn);
    ofn.lpstrFile         = szExtBuffer;
    ofn.nMaxFile          = MAX_PATH;
    ofn.lpstrTitle        = "Open file";
    Or even better:

    Code:
    OPENFILENAME ofn = { 0 };
    
    ofn.lStructSize       = sizeof(ofn);
    ofn.lpstrFile         = szExtBuffer;
    ofn.nMaxFile          = MAX_PATH;
    ofn.lpstrTitle        = "Open file";
    Last edited by NoHero; February 3rd, 2005 at 10:56 AM.
    I am not offering technical guidiance via email or IM
    Come on share your photo with us! CG members photo album!
    Use the Code Tags!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured