User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 456,488 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,734 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums
Views: 8738 | Replies: 1
Reply
Join Date: Aug 2004
Posts: 1
Reputation: Milan is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Milan Milan is offline Offline
Newbie Poster

Help Common Open dialog box

  #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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2004
Posts: 604
Reputation: freesoft_2000 is an unknown quantity at this point 
Rep Power: 6
Solved Threads: 6
freesoft_2000 freesoft_2000 is offline Offline
Practically a Master Poster

Re: Common Open dialog box

  #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  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb C++ Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the C++ Forum

All times are GMT -4. The time now is 3:07 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC