Changeset 3511 for trunk/src


Ignore:
Timestamp:
May 10, 2000, 3:12:46 PM (25 years ago)
Author:
sandervl
Message:

GetOpenFileNameW fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/comdlg32/filedlg95.c

    r3363 r3511  
    1 /* $Id: filedlg95.c,v 1.8 2000-04-10 17:48:06 cbratschi Exp $*/
     1/* $Id: filedlg95.c,v 1.9 2000-05-10 13:12:46 sandervl Exp $*/
    22/*
    33 * COMMDLG - File Open Dialogs Win95 look and feel
     
    350350  LPCSTR lpstrFilter = NULL;
    351351  LPSTR lpstrCustomFilter = NULL;
     352  LPWSTR lpstrFile = NULL;
     353  LPWSTR lpstrInitialDir = NULL;
     354  LPWSTR lpstrTitle = NULL;
    352355  DWORD dwFlags;
    353356
     
    420423  fodInfos->DlgInfos.dwDlgProp = 0;
    421424
     425  /* allocate ansi filename buffer */
     426  lpstrFile = ofn->lpstrFile; 
     427  ofn->lpstrFile = MemAlloc(ofn->nMaxFile);
     428
     429  // convert initial dir & title (if necessary)
     430  lpstrInitialDir = (LPWSTR)ofn->lpstrInitialDir;
     431  if(lpstrInitialDir) {
     432        ofn->lpstrInitialDir = MemAlloc(lstrlenW(ofn->lpstrInitialDir)+1);
     433        lstrcpyWtoA((LPSTR)ofn->lpstrInitialDir, lpstrInitialDir);
     434  }
     435  lpstrTitle = (LPWSTR)ofn->lpstrTitle;
     436  if(lpstrTitle) {
     437        ofn->lpstrTitle = MemAlloc(lstrlenW(ofn->lpstrTitle)+1);
     438        lstrcpyWtoA((LPSTR)ofn->lpstrTitle, lpstrTitle);
     439  }
     440
    422441  switch(iDlgType)
    423442  {
     
    452471  fodInfos->ofnInfos->hInstance = hInstance;
    453472  MemFree((LPVOID)(fodInfos));
     473
     474  /* filename */
     475  lstrcpynAtoW(lpstrFile, (LPCSTR)ofn->lpstrFile, ofn->nMaxFile);
     476  MemFree(ofn->lpstrFile);
     477  ofn->lpstrFile = lpstrFile;
     478
     479  //free converted initial dir & title strings
     480  if(lpstrInitialDir) {
     481        MemFree((LPVOID)ofn->lpstrInitialDir);
     482        ofn->lpstrInitialDir = (LPCWSTR)lpstrInitialDir;
     483  }
     484  if(lpstrTitle) {
     485        MemFree((LPVOID)ofn->lpstrTitle);
     486        ofn->lpstrTitle = (LPCWSTR)lpstrTitle;
     487  }
    454488  return ret;
    455489}
Note: See TracChangeset for help on using the changeset viewer.