|
please don't use the <pre> tag to quote long sentences. this enforce the page to display the line till the end, requiering us to scroll then...
|
|
|
|
|
I've modified it.
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.
|
|
|
|
|
I built a demo project that using OLE-DB,I add two controls on my form
(Single Document),one is DataGrid,the other is ADODC,What my purpose is that I want to resize the size of the two controls when the form shows,the variables that connect to the two controls are m_DataGrid and m_AdoDC;
the code is as followed:
void CADO2View::OnSize(UINT nType, int cx, int cy)
{
int iHeight;
int iWidth;
CRect oRect;
COleDBRecordView::OnSize(nType, cx, cy);
if (m_AdoDC.m_hWnd==NULL||m_DataGrid.m_hWnd==NULL)
{
return;
}
else
{
m_AdoDC.GetClientRect(oRect);
iHeight=oRect.Height();
iWidth=oRect.Width();
m_AdoDC.MoveWindow(0,0,iWidth,iHeight,TRUE);
m_DataGrid.MoveWindow(0,iHeight,cx,xy,TRUE);
}
}
But the code doesn't work,so how to resize the controls when the form shows?
Nothend
-- modified at 19:51 Monday 8th January, 2007
|
|
|
|
|
Nothend wrote: But the code doesn't work,so how to resize the controls when the form shows?
What happens exaclty ? What does 'not working' mean ?
Also, use the pre or code tag when you post code (it will make it more readable)
|
|
|
|
|
I am sorry about that,because I am a student from China,my English is poor.
What I want is that when the view shows,the DataGrid and the ADODC will position the right place on the form(view),not the place I put when using the control bar.
As the code shows that,the event of OnSize takes place first than that of
DoDataExchange,so the two variables(m_AdoDC and m_DataGrid) are null when OnSize takes place.
I use PostMessage(WM_SIZE) in the event of OnInitialUpdate,and then it happpens,but the control ADODC doesn't move when I pull the form ,and the DataGrid does.
So how can I do ?
Thanks a lot!
Nothend
|
|
|
|
|
Well, I didn't look at all the details of your code for my previous answer (your explanation was a bit vague). But I think the problem is here:
Nothend wrote: m_AdoDC.GetClientRect(oRect);
iHeight=oRect.Height();
iWidth=oRect.Width();
m_AdoDC.MoveWindow(0,0,iWidth,iHeight,TRUE);
m_DataGrid.MoveWindow(0,iHeight,cx,xy,TRUE);
You said that m_AdoDC is a member of your class, so it will never resize. The only thing that is resizing is your view. So what you need to do is retrieve the new size of your view (using GetClientRect) and then calculate the new sizes of the two other controls.
|
|
|
|
|
I am sorry about that,because I am a student from China,my English is poor.
What I want is that when the view shows,the DataGrid and the ADODC will position the right place on the form(view),not the place I put when using the control bar.
As the code shows that,the event of OnSize takes place first than that of
DoDataExchange,so the two variables(m_AdoDC and m_DataGrid) are null when OnSize takes place.
I use PostMessage(WM_SIZE) in the event of OnInitialUpdate,and then it happpens,but the control ADODC doesn't move when I pull the form ,and the DataGrid does.
So how can I do ?
Thanks a lot!
|
|
|
|
|
You can use of SendMessage(WM_SIZE)
|
|
|
|
|
|
Because the event of OnSize takes place first than that of DoDataExchange,so the controls' m_hWnds are null.
I have used the PostMessage(WM_SIZE),it works,but the ADODC control can't move,I don't know why.
Thanks
Nothend
|
|
|
|
|
What happens if you insert ScreenToClient/*for converts coordinates */ after m_AdoDC.GetClientRect(oRect);
m_AdoDC.GetClientRect(oRect);
m_AdoDC.ScreenToClient(oRect);
|
|
|
|
|
It's all the same .
Nothing happen.
Nothend
|
|
|
|
|
Do you mind that I send you a email including the demo code to you?
Nothend
|
|
|
|
|
Nothend wrote: Because the event of OnSize takes place first than that of DoDataExchange,so the controls' m_hWnds are null.
Call UpdateData as first statement in OnSize , which eventually calls DoDataExchange .
|
|
|
|
|
I have tried that ,but it would be error.
It will show error dialog saying that "Debug Assertion Failed",and if I retry,the XP sends me a error report.
Nothend
|
|
|
|
|
Hi,
I have sub classed CEdit and I can get notifications for example in the OnKeyDown function for any VK_XXXXX keys. From some odd reason, the VK_TAB is not responding, any reason why ?
Basically, what I am looking for is to do auto complete Linux type. I already have the data to auto complete and I just want to do it with the TAB key. The problem is that no matter what I tried, the TAB always does what it's "programmed" to do in windows, it jumps to the next field.
Any help is appreciated.
shay
|
|
|
|
|
I think you have to override the PreTranslateMessage() method.
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.
|
|
|
|
|
|
Hi all,
I have creating dialog based window in vc++(MFC) and i installed image magic(dynamic dll of binary version).
I need to know about InitializeMagic(char *) function. Is Magic must be initialize?... when i read one image using read(std::string) function.....
#include <Magick++.h><br />
#include <<iostream><br />
using namespace std;<br />
using namespace Magick;<br />
<br />
void CSampleDlg::OnButttonClick()<br />
{<br />
Image img;<br />
img.read("c:\\logo.jpg");<br />
}
Error will be thrown like......
Unhandled exception at 0x000c256.. in Csample3.exe:0xC000075:
Access voilation writing location 0xcde....
Now i am using VS 2005...
Anybody know about this problem let me know...
Thankx in advance...
|
|
|
|
|
|
I already seen that the Image magic Documetation, but i cant get clearly.
I thing your recently sending links are very useful for me.
I will try it...thank you.
|
|
|
|
|
hi,
I'm facing some problem with the termination of the process.
I have a COM DLL, which intern talks to a drive through a serial communication medium.
And the COM Client, has some 5/6 threads runing.
The problem is, *Some Times* when I close the application, the application never closes.
Some threads of the process are still running, which prevents the usage of the serial port by
the next instance of the application.
Yet another problem is, the problem araises very rarely. Please help me!!
Thanks in advance,
Raja Pratap
|
|
|
|
|
What mechanism are you using to signal to the running threads that its time to stop?
If you think you can than you can, if you think you can't you are right.
|
|
|
|
|
Thanks for the reply.<br />
Here is the way I'm terminating.<br />
<br />
1. PostThreadMessage(WM_QUIT, NULL, NULL);<br />
2. dwState = ::WaitForSingleObject(m_hThread, 6000);<br />
<br />
3. if(dwState != WAIT_OBJECT_0)<br />
TerminateThread(m_hThread, dwExitCode);
--
Pratap
|
|
|
|
|
Stack traces of what the application is doing when hung would be a big help. Also, what framework (if any) is being used?
Steve
|
|
|
|