Develoment with Visual C++

I was trying to write a simple dialog program with Visual C++ just to refresh my C++ knowledge and Windows Programming. C++ is the language that I truly wanted to master, but yet I don't really have any time to sit down and to use it to write program, not even in my work, where I'm using C# most of the time because it is easier and faster to develop a program with it.

Yet, I still find that it's very fun to write a program with C++ because of all the extra procedures and rules that we need to follow. During the course of writing that simple program, I encountered 2 things that I need to note it down, otherwise I'd have forgotten about it again.

1 - Adding DDX (Data Exchange) member variable that associated with a control when developing the dialog box program

What happened previously when I was learning to write a windows application with MFC from Ivor Horton's Beginning Visual C++, I learned about the usage of DDX member. Yet, over here, I couldn't get any value at all from the DDX member even though I have associated that member with a control, and the message mapping has been done. It makes me wonder that DDX member will be used to store the value only when the dialog exited. So, it means that there's no point for me to use it when I'm developing a dialog box based program.

2 - CFileDialog.GetFolderPath() will always throw assertion whenever it is called

I was dump founded when this happened, 'coz I have no idea on how to make this function work. Thank goodness that there's a lot of explanation on the net to explain this situation. From MSDN, it is shown that this function will have to be used in conjunction with OFN_EXPLORER (something like this) flag in order to avoid the assertion being thrown. So I've tried that and to no avail I could get it work either because I created the CFileDialog wrongly for not adding the other default flags too. It was also mentioned on the net that GetFolderPath() can only be used when the CFileDialog object is still valid, meaning that CFileDialog cannot be NULL when GetFolderPath() is called. I wanted to use GetFolderPath() to get the folder directory because CFileDialog::FileName will only return the name of the file; not the full path. I was totally dump because there is another function in CFileDialog that could be used to get the full path, which is CFileDialog::FilePath if I'm not mistaken.

Comments

Popular posts from this blog

Yahoo! Messenger voice call & video call disabled, why?

Sport's Injuries - Treatment for bruises

Web Development: Disable, Validate, & Enable Buttons