|
Okay I read that documentation and I played around with stuff, but I'm really not sure how to create m_ofn and then use its member functions.
|
|
|
|
|
|
Thanks a very good example thanks. Should I just rely on example code and creating classes and objects manually rather than going through the class wizard?
|
|
|
|
|
If it is just a simple class, by all means you can do it manually. If you are creating dialog classes or any other types that deal with the windows interface, the class wizard is better and safer.
<font=arial>Weiye Chen
Life is hard, yet we are made of flesh...
|
|
|
|
|
you can use this little piece of code :-
CFileDialog m_DlgFile(TRUE);
if(m_DlgFile.DoModal()==IDOK)
{
MessageBox(m_DlgFile.GetPathName( ),"selected File Name");
}
Now My NOSE itch when i type using HAND
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
I'm trying to understand how it's done automatically when you use the wizard, so I searched for CFileDialog but I can't find it anywhere in my application. I started a MFC single window app that has the open file functionality already working. How is that working?
|
|
|
|
|
The CWinAPP class do that for you, see this Message Handller defination
BEGIN_MESSAGE_MAP(CSdiApp, CWinApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
END_MESSAGE_MAP()
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Here's what I wrote so I know this part works. I created a new class "ButtonP" which has a base class of CFileDialog, but could I have just created an object of CFileDialog instead? Also I wanted to create an "on button pressed" function but I didn't know how.
void CMy3daudioDlg::OnBrowse()
{
CDialog::OnInitDialog();
ButtonP open(TRUE);
CString mystring;
open.DoModal();
mystring = open.GetPathName();
AfxMessageBox(mystring);
}
|
|
|
|
|
nombrecinq wrote:
Also I wanted to create an "on button pressed" function but I didn't know how.
i believe you are missing basic knowledge of Windows Programming, this article will help:-
http://www.codeproject.com/cpp/Introduce_Yourself_to_VC.asp[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
nombrecinq wrote:
Can somebody tell me what I need to do to create an open document dialog box?
Does this imply that you are working on an SDI or MDI application?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Neither actually, it's a dialog based program because there's only a couple things the user can do.
|
|
|
|
|
So is CFileDialog what you are looking for then?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Yep that's it thanks, I got that working now but I have another question so I'll post it.
|
|
|
|
|
I want to serialize the CGridCtrl in order to use Keith Rule's "Simple and Easy Undo/Redo". Can anyone give an example of a Serialize routine implemented in CGridCtrl ?
Thanks.
Regards,
Cosmin Unguru
|
|
|
|
|
Hi all,i want to remove a section in ini file using VC code,but i don't how to do it.Can you help me?
i.e:
[Test]
name = example
how to remove section [Test] out of this ini file?
|
|
|
|
|
check will this api help [WritePrivateProfileSection] other wise you have manually read and delete the entry
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Ok Found it, this article will help
http://www.codeproject.com/file/CIniFile.asp[^]
Remember One thing,here people don't help person who make ANONYMOUS request
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
ThatsAlok wrote:
Remember One thing,here people don't help person who make ANONYMOUS request
But you did all the same!
|
|
|
|
|
Stlan wrote:
people don't help person who make ANONYMOUS request
But you did all the same!
I Said People not Programer
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
The documentation for WritePrivateProfileString() clearly states that if the lpKeyName parameter is NULL , the entire section, including all entries within the section, is deleted.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi all!
I have a thread problem in the following code:
(This is not the complete code..)
Somewhere in a function i have the following implementation:
/*****************************************/
// Start of thread
HANDLE hThread = CreateThread(...);
// Wait until thread ends
WaitForSingleObject(hThread, INFINITE);
...
/*****************************************/
// Thread procedure
DWORD WINAPI ThreadProc(LPVOID lpParam)
{
// My code
......
......
SendMessage() <--- The system right here is deadlock (***)
return 0;
}
(***)
The SendMessage() function sends message (LVM_INSERTITEM) to a list view control of the window that stared the thread.
The problem is that I want the SendMessage() function to work, without removing the WaitForSingleObject() function, or any other "wait" function it might need to be replaced.
Thanks for any reply!
|
|
|
|
|
This will never work !! I suppose the function which creates the Thread is not in another thread than your application ? Thus your application will freeze because of the WaitForSingleObject call. And because of that, it cannot process messages anymore (so it will not respond to user events neither).
It is not a good idea to call WaitForSingleObject in the main thread. A better idea would be that, when your secondary thread finishes, it sends a message (an owner defined message) to the main window resulting in calling a specific function that will manage every that needs to be done when your thread finishes.
|
|
|
|
|
Hello,
What you are doing is asking for trouble! The rule of thumb is: never touch the GUI from your worker thread!!!!
If you really need to do this, try the following: use PostMessage() instead of SendMessage() .
If you really need to wait for the thread to finish, use MsgWaitForMultipleObjects() instead of WaitForSingleObject() . This way, your app won't freeze because it will process messages.
Hope this helps.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
how to develop an assembler in C++
the idea that i got was
__asm {
}
but do anyone have any idea more abt that?
|
|
|
|
|
emusing wrote:
how to develop an assembler in C++
This sentence means nothing ! For me, assembler is a low-level language. So, how can you 'develop' a language ??
Otherwise, yes with __asm you will be able to use write assembler code inside your C++ code. But that does not mean you are developping an assembler.
|
|
|
|