Common Open dialog box

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Aug 2004
Posts: 1
Reputation: Milan is an unknown quantity at this point 
Solved Threads: 0
Milan Milan is offline Offline
Newbie Poster

Common Open dialog box

 
0
  #1
Aug 5th, 2004
Hi.
How can I call common open dialog box in MS Visual C++ 6.0 ?
I tried to use getOpenFileName() and CreateFile(). But my function doesn't work.
There is tehe body:
void FlashProgram::OnButtonPOpen()
{
// TODO: Add your control notification handler code here

OPENFILENAME ofn; // common dialog box structure
char szFile[260]; // buffer for file name
HWND hwnd; // owner window
HANDLE hf; // file handle

// I nitialize OPENFILENAME
ZeroMemory(&ofn, sizeof(OPENFILENAME));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hwnd;
ofn.lpstrFile = szFile;
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = "All\0*.*\0Text\0*.hex\0";
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;

// Display the Open dialog box.

if (GetOpenFileName(&ofn)==TRUE)
hf = CreateFile(ofn.lpstrFile, GENERIC_READ,0, (LPSECURITY_ATTRIBUTES) NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,(HANDLE) NULL);

}


Can You give me any helps or hints
Or example? :o
More Thanks
Milan
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 609
Reputation: freesoft_2000 is an unknown quantity at this point 
Solved Threads: 8
freesoft_2000 freesoft_2000 is offline Offline
Practically a Master Poster

Re: Common Open dialog box

 
0
  #2
Aug 8th, 2004
hi everyone,
This is the way to do it
void FlashProgram::OnButtonPOpen( )
{
// TODO: Add your control notification handler code here
CFileDialog m_a (true);
if (m_a.DoModal = = IDOK)
{
//Do whatever you want
UpdateData(false);
}
}

Yours Sincerely

Richard West
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC