|
How can I do to include ActiveX Controls to a MFC DLL Project, because when I do that in a dialog and execute this, the dialog isn`t show, thanks
|
|
|
|
|
|
|
# Improve performance and ability to work directly with hardware
# Fit into the real world
This two are more important for me as i work in Embedded domain
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
|
Hello there,
I have a dialog based application which has two classes, CMainWindow and CChildWindow. I want to create the ChildWindow from the MainWindow, from inside a thread.
My code snippet.
static UINT CMainWindow::_ShowChildWindow(LPVOID parameter)
{
CMainWindow *mainWind = (CMainWindow*) parameter;
mainWind->ShowChildWindow();
return 0;
}
CMainWindow::ShowChildWindow()
{
m_childwindow = new CChildWindow();
m_childwindow->Create(IDD_CHILDWINDOW);
m_childwindow->ShowWindow(SW_SHOW);
}
CMainWindow::OnButtonShow()
{
AfxBeginThread(_ShowChildWindow,this);
}
The newly created window just blinks and vanishes.
Please help me!
Regards
|
|
|
|
|
you need a message loop. See CWinThread::Run for more information.
My blogs:
http://blog.joycode.com/jiangsheng
http://blog.csdn.net/jiangsheng
http://bloglines.com/public/jiangsheng
Command what is yours
Conquer what is not
---Kane
|
|
|
|
|
Hello there,
I have a dialog based application which has two classes, CMainWindow and CChildWindow. I want to create the ChildWindow from the MainWindow, from inside a thread.
My code snippet.
static UINT CMainWindow::_ShowChildWindow(LPVOID parameter)
{
CMainWindow *mainWind = (CMainWindow*) parameter;
mainWind->ShowChildWindow();
return 0;
}
CMainWindow::ShowChildWindow()
{
m_childwindow = new CChildWindow();
m_childwindow->Create(IDD_CHILDWINDOW);
m_childwindow->ShowWindow(SW_SHOW);
}
CMainWindow::OnButtonShow()
{
AfxBeginThread(_ShowChildWindow,this);
}
The newly created window just blinks and vanishes.
Please help me!
Regards
|
|
|
|
|
you dont have the message pump in the _ShowChildWindow
i.e.
MSG msg;<br />
<br />
while (GetMessage(&msg, NULL, 0, 0)) <br />
{<br />
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) <br />
{<br />
TranslateMessage(&msg);<br />
DispatchMessage(&msg);<br />
}<br />
}
-Prakash
|
|
|
|
|
Hello Prakash,
It works the window pops up and stays. But it does not receive any key events. what could be the problem?
Regards
|
|
|
|
|
Can you dump the code in the thread funtion here?
Probably the keyboard events are not translated.
-Prakash
|
|
|
|
|
Hello Prakash,
Here is the code snippet.
m_chatWindow = new CChatWindow(this);
m_chatWindow->Create(IDD_DIALOG1,GetDesktopWindow());
m_chatWindow->ShowWindow(SW_SHOW);
MSG msg;
HACCEL haccel;
LoadAccelerators(AfxGetInstanceHandle(),AfxGetAppName());
while (GetMessage(&msg, NULL, 0, 0))
{
if (!TranslateAccelerator(m_hWnd, haccel, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
Regards
|
|
|
|
|
Hello Prakash,
Here is the code snippet.
m_chatWindow = new CChatWindow(this);
m_chatWindow->Create(IDD_DIALOG1,GetDesktopWindow());
m_chatWindow->ShowWindow(SW_SHOW);
MSG msg;
HACCEL haccel;
haccel =
LoadAccelerators(AfxGetInstanceHandle(),AfxGetAppName());
while (GetMessage(&msg, NULL, 0, 0))
{
if (!TranslateAccelerator(m_hWnd, haccel, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
Regards
|
|
|
|
|
vyjesh wrote: if (!TranslateAccelerator(m_hWnd, haccel, &msg))
The problem is with the m_hWnd, i guess i overlooked that.
replace m_hWnd with m_chatWindow->m_hWnd
and let me know if it worked.
-Prakash
|
|
|
|
|
Hello prakash,
It did not work. But I got the problem solved by this way
m_chatWindow = new CChatWindow(this); m_chatWindow->Create(IDD_DIALOG1,GetDesktopWindow());
m_chatWindow->ShowWindow(SW_SHOW);
m_chatWindow->RunModalLoop(); //this solved problem.
Regards
|
|
|
|
|
oh cool, I am kinda more conversant with win32. Good that you solved it.
RunModalLoop() kinda does what we were doing before but maybe in a correct way.
-Prakash
|
|
|
|
|
Hello,
I've just installed Visual Studio 2005 and eagerly I converted the C++ project I'm working on, from Studio 2003 project format to Studio 2005 one.
But I can't get the project to compile. Visual Studio 2005 compiler has been made more ISO compliant so it no longer accepts implicit int declaration.
Thus, I need to convert my project back to Studio 2003 format. But I don't know how.
Can someone help?
Thanks
|
|
|
|
|
Your 2003 sln file should still be in your directory. I think all you need to do is load that instead of the converted 2005 sln file (and delete it altogether if you don't want to eventually upgrade) and you should be go to go.
|
|
|
|
|
In the updrade log generated by VC 2005 it is said there is a backup sln file in the project directory.
It is called myproject.sln.old but I can't find it even in the hidden files.
Do you have any idea?
|
|
|
|
|
|
Thanks for your reply.
I wish I had read that article before upgrading.
Now I just cant compile my project.
|
|
|
|
|
Allad wrote: Visual Studio 2005 compiler has been made more ISO compliant so it no longer accepts implicit int declaration.
So why don't you go ahead and fix it? Why leave bad code in your source?
|
|
|
|
|
Nishant Sivakumar wrote: So why don't you go ahead and fix it? Why leave bad code in your source?
In my project I'm using a library with thousands of code lines. And the real problem is that library. I don't dare mess with such a huge amount of code I've not written myself.
Anyway thanks for replying.
|
|
|
|
|
Hello,
Did you make a backup? VS 2005 asks this before it converts the file.
Anyway, as Nishant already said it: fix the errors and use the better compiler. The standard conformance is far better than any previous compiler written by Microsoft.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Bob Stanneveld wrote: Did you make a backup? VS 2005 asks this before it converts the file.
In the updrade log generated by VC 2005 it is said there is a backup sln file in the project directory.
It is called myproject.sln.old but I can't find it even in the hidden files.
Do you have any idea?
|
|
|
|