|
What value does g_hIcon have? What does SendMessage() return?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
g_hIcon has Value 0x7c076be4
SendMessage returns -2146982652
hWnd=0x7c076c50
|
|
|
|
|
Iam using MFC .I have a problem about it .I want to question about event or funtion after clik "open" button in dialog "Open,Save,Save as".Please.
Thanks
|
|
|
|
|
nvphap wrote: I want to question about event or funtion after clik "open" button...
You need to assign a handler to the BN_CLICKED message. If you have VS6, use ClassWizard (Ctrl+W).
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Is that possible? I mean he is talking about CFileDialog ...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
I assumed he was talking about the button that would construct a CFileDialog object. In any case, a hook can be provided to handle the clicking of the OK or Open button before the Open dialog is dismissed.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: In any case, a hook can be provided to handle the clicking of the OK or Open button before the Open dialog is dismissed.
Actually I thought about that solution. Probably he can also roll his own class derived by CFileDialog and then override whatever he needs.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
please,give me a way to post images .I think that it will easier for we understand together
|
|
|
|
|
There are tons of Web sites that allow this. Have you searched for one?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
nvphap wrote: I want to question about event or funtion after clik "open" button in dialog "Open,Save,Save as".
When you click the Open button on such a dialog, DoModal() will return. You then have access to whatever file was selected by the user.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
If you need to get access to this "event" BEFORE the file dialog is dismissed, you may need to hook the dialog. Look up the OFN_ENABLEHOOK flag for more information.
Peace!
-=- James Please rate this message - let me know if I helped or not!<hr></hr> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
An easier solution was already presented to you in your previous post
(not by me).
Why make it more difficult by having to hook the dialog?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi, I'm trying to create an MFC application to read and process an xml file (count elements, identify elements, etc). I'm working with vc++05 and I wanted to know if exists any class or some way to open and read an xml file. Do you have any examples or ideas?? (I'm a complete beginner in this field)
Thanks for your time!
|
|
|
|
|
Google & CodeProject search engines are you best friends, for instance see
http://www.codeproject.com/KB/XML/ce_xml.aspx[^]
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
I would recommend TinyXml[^]. I have been using it for a while and find it easy to use.
-Saurabh
|
|
|
|
|
Hi I am using the following PreTranslateMessage and it works just fine in debug mode but the ::TranslateAccelerator fails in release. What seems to be worng here ?
BOOL CLeftTabSheet1::PreTranslateMessage(MSG* pMsg) <br />
{<br />
if (pMsg->message == WM_KEYDOWN && ((CMainFrame *)AfxGetMainWnd())!=NULL)<br />
{<br />
<br />
int nVirtKey = (int) pMsg->wParam;<br />
CString str;<br />
str.Format("%d",nVirtKey);<br />
AfxMessageBox("In - PreTranslate VirtKey=" + str);<br />
if (::TranslateAccelerator( ((CMainFrame *)AfxGetMainWnd())->m_hWnd,((CMainFrame *)AfxGetMainWnd())->m_hAccelTable,pMsg))<br />
{<br />
<br />
AfxMessageBox("Out - PreTranslate");<br />
return TRUE;<br />
<br />
}<br />
}<br />
<br />
<br />
return CPropertyPage::PreTranslateMessage(pMsg);<br />
}
sdancer75
|
|
|
|
|
Do you know about GetLastError function?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Yes I know. In release mode i get "invalid acceleration table". Its strange because i use the default acceleration table IDR_MAINFRAME that doc/view wizard creates. This works just fine in the debug mode but in release mode, the member m_hAccelTable is Null.
Anyway i didn't find any solution for that, so I created a new acceleration table and I loaded manually. In this way it works but I was curious for the problem I described above.
Regards,
George
sdancer75
|
|
|
|
|
Hi,
In my win32 application i open a working thread using _beginThread(...). This thread preforms a certain work and when it's done it has to notify the main application thread. I'm implementing this by having the working thread to post a message (that will be processed by the main thread) and commit suicide (_endthread()).
For some reason the posted messages of the working thread are not received in the other threads message proc.
Does anyone have an idea?
Thanks in advance.
Snir Yarom.
|
|
|
|
|
Maybe posting the relevant code will help.
BTW why doesn't the worker thread just return?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Here's the relevant code:
void RunAuthenticate(LPVOID pThreadId);
<br />
void MyClass::Authenticate(std::string userName, std::string password, int *balance, HWND hwnd)<br />
{<br />
m_threadNum++; <br />
HANDLE hThrd = (HANDLE)_beginthread(RunAuthenticate, 0, &m_threadNum);<br />
}<br />
void RunAuthenticate(LPVOID pThreadId)<br />
{<br />
HWND hwnd = CComManager::GetInstance()->GetCallingWnd(pThreadId);
long proc;<br />
DWORD hThread = ::GetWindowThreadProcessId(hwnd,(LPDWORD)&proc);<br />
if(hThread != NULL)<br />
::PostThreadMessage((DWORD) hThread,(UINT)THREAD_FINISHED, (WPARAM)status, NULL);<br />
}
Thanks.
|
|
|
|
|
More Clarifications:
The calling thread returns right after initializing the working thread.
The working thread should notify the main thread asynchly when his job was done.
The notification message (::PostThreadMessage(...)) isn't caught in the main thread message proc.
Thanks again.
Snir_ya
|
|
|
|
|
What is CComManager (is your?)?
Why don't you simply pass the Main Window handle to the working thread so that the latter can post a message to?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Thanks for your reply.
1.
Yes, CComManager is mine. In my code it returns the HWND of the (login) dialog that called the working thread.
The (login) dialog was intialized by the main thread. The working thread needs to post a message to this dialog. But all the messages sent by the working thread are lost.
2.
It's a win32 application. How do i get the Main window handle?
Thanks again for your help.
Snir_ya.
|
|
|
|
|
Post the message to the main window.
When you create the main window (i.e.e inside InitInstance in the wizard-generated code), you have the great opportunity to store its handle for later use.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|