|
|
I'll show exactly what I did so that you can help me
I put a custom control, add class name as MFCGridCtrl
In the file .h, I add the variable CGridCtrl grid. In the file .cpp, at the function DoDataExchange, I add manually DDX_GridControl(pDX, IDC_CUSTOM3, grid);
And I create by the function grid.Create()
But it show the error : Debug Assertion Failed
|
|
|
|
|
Does identify of IDC_CUSTOM3 is unique on the resource file?
|
|
|
|
|
Yes
|
|
|
|
|
Did you use of breakpoints for trace your code line to line and if yes did you see which line has error?
|
|
|
|
|
When I debug, the debugger stop at the line : ASSERT(pWnd->m_hWnd == NULL); in the file wincore.cpp
I used : grid.Create(rect, this, 1);
I don't know if the handle of window parent is true or false
|
|
|
|
|
It seems that you have a null hwnd does grid.Create(rect, this, 1);(and did you see that rect and this are valid or they are empty) has return value if yes what is it and do you want to use of MFC grid on your project or when you want to compile it you got this error?
|
|
|
|
|
The error doesn't come from my project because I just create a blank based dialog. Of course, rect & this are valid ( I use the pointer this in OnInitDialog())
I uploaded my file so that you can see clearly : http://www.mediafire.com/?ijb5p1vxgme[^]
Plz help me
|
|
|
|
|
You must wait until I compile your project.
|
|
|
|
|
compile your code with
/* CGridCtrl grid;
RECT rect;
rect.top = 10;
rect.left = 10;
rect.bottom = 50;
rect. right = 50;
//CWnd * pWnd;
//pWnd->GetParent();
grid.Create(rect, this, 1);
*/
For test insert these statement
grid.InsertColumn(_T("111"));
grid.InsertColumn(_T("111"));
grid.InsertColumn(_T("111"));
grid.InsertRow(_T("112"));
grid.InsertRow(_T("112"));
grid.InsertRow(_T("112"));
|
|
|
|
|
|
Oh thanks so much. I thought we have to use Create
|
|
|
|
|
First your think was good for upload your project because this error needed to see code and when I compiled your code I saw you dont need to make a control that is exist and delete Create and I replied to you,I asked of you yesterday again does your problem solve but you didnt answer to me so I guess maybe my answer was not attractive for you,but today I see your problem solved and I am glad.
|
|
|
|
|
Ok its early and the brain must not be working well this morning.
I have a Login dialog that is case sensitive with user names and passwords.
What I want to do is alert user when the "Caps Lock" key is pressed (show info in a static text control). What I can't figure out is how to know when the Caps Lock key is pressed.
I'm sure this is something that I am just overlooking.
Thanks..
Tim
|
|
|
|
|
|
Rather than polling, you can call SetWindowsHookEx() and check for VK_CAPITAL .
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I have attached two monitors two my system. Now i want to display a bitmap image on my second monitor.I am able to display a solid fill blue rectangle and able to display a text on it.
How can send a bitmap image?
Is it possible to send the raw image data without using the BITMAP?
Below is the code:
int count = 0;
void CMonitorTestDlg::OnBnClickedButtonFlashAll()
{
CMonitor monitor;
CMonitors monitors;
CString cstr[2];
for ( int i = 0; i < monitors.GetCount(); i++ )
{
count = i+1;
monitor = monitors.GetMonitor( i );
FlashMonitor( monitor);
Sleep( 500 );
}
}
void CMonitorTestDlg::FlashMonitor( CMonitor& monitor, bool WorkSpace)
{
CRect rect;
if ( WorkSpace )
monitor.GetWorkAreaRect( &rect );
else
monitor.GetMonitorRect( &rect );
CMonitorDC dc( &monitor );
if(count ==1)
{
CBrush brushBlue(RGB(0, 255, 0));
CBrush* pOldBrush = dc.SelectObject(&brushBlue);
rect.DeflateRect(200,200);
dc.Rectangle(&rect);
COLORREF clr1 = RGB(0,0,0);
dc.SetTextColor(clr1);
dc.DrawText("Primary Monitor",17,&rect,1);
dc.SelectObject(pOldBrush);
}
else
{
}
Sleep( 2000 );
::InvalidateRect( NULL, &rect, TRUE );
}
Code that i have tried to send a bitmap
CBitmap bmp;
if (bmp.LoadBitmap(IDB_BITMAP1))
{
BITMAP bmpInfo;
bmp.GetBitmap(&bmpInfo);
CDC dcMemory;
CBitmap* pOldBitmap = dcMemory.SelectObject(&bmp);
CRect rect1;
GetClientRect(&rect1);
int nX = rect.left + (rect1.Width() - bmpInfo.bmWidth) / 2;
int nY = rect.top + (rect1.Height() - bmpInfo.bmHeight) / 2;
dc.BitBlt(nX, nY, bmpInfo.bmWidth, bmpInfo.bmHeight, &dcMemory,
0, 0, SRCCOPY);
dcMemory.SelectObject(pOldBitmap);
}
Thanks
Soumyadipta De
|
|
|
|
|
Hello,
I have a list of values and a list of time stamps corresponding to the time at which each data has been measured.
Now, I need to apply a low pass filter on the data and I have really no idea how to do that! I have searched the web, read wikipedia's articles etc.. but since I am really bad in signal processing, I do not understand a lot of things.
I do not really understand what parameters are needed in addition of the data (and the cutoff frequency, of course, but what else ?). I do not understand what the orders stands for, if I need to apply a FFT, etc...
Moreover, the articles I have found on the web seems to work only on data measured periodically, which is not my case (ex: 1s, 1.2s, 4s, 5s..). However, I could interpolate if _really_ needed.
Anyone could help me ?
Ideally I need a piece of code (not a Matlab one please :p) but if someone could give a function prototype with a pseudo-algorithm, it would be good too.
Thanks in advance,
Regards
|
|
|
|
|
I don't understand your problem very well, but a low pass filter doesn't need to be so periodical (at least the analogic ones), it just check the values and if the data/frecuency of the signal is bigger than the cutoff value, then it does nothing, otherwise block it.
In grosso modo it should be like (assuming you are getting the data from a file... doing in a loop till you read all the values you have):
go to the beggining of the data
do
{
read data
if (data <= cutoff_value)
{ go one position foward;
continue;
}
else
{
do whatever you want to do with the values that passed the filter;
}
go one position foward;
}
while (data not ended)
But if you are just want to call the function in the moment you make a data aquirement you can use a function like...
bool apply_filter (cutoff_value, read_data)
{
if (read_data > cutoff_value)
{ do whatever you want;
return TRUE;
}
return FALSE;
}
is it what you were asking? If not, please explain yourself better.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Well, a code snippet is really what I needed, it is crystal clear now ! Thanks a lot.
I think the articles I have read was too detailed for such a simple thing.
Just one last question, what is the order of the filter and how to apply it ?
|
|
|
|
|
The order of a filter determines how the filter atenuates the incoming signal. If it is first order the atenuation will be 20 db/dec, second order 40 db/dec, and so on... This 20/40/.. db/dec is the grade of the angle that makes the caracteristical graphic of the filter's transfer function.
This is a concept that is important when you are creating an analogic filter where not only the frecuency has to be filtered. The amplitude of the signal can be modified as well using the order of the filter.
I try to make a example
for first order it should be something like:
.....
.
.
.
..
10 500
and, for second order
.....
.
.
.
..
10 500
This graphics will let you now how the incoming signal is going to be related to the outgoing signal. In analogic filters the output is not so "matematical". With the examples above. a signal of more than 500 hz will have almost no problems to pass the filter and will be almost not modified (1 to 1 in amplitude) but a signal of 400 will pass the filter because the cutoff frec in these graphics is less than 400, but the output will be different according to the order. For example: In the first order it can be reduced in a ratio of 1 : 0.8 in the second in a ratio of 1 : 0.9
This is theory of analogic electronichs, and is quite extended and pretty difficult just to explain it here. If you need to use the order of the filters as well, I recommend you to search in the web/wiki and so on to see graphic examples that can help you to understand it better.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Ok, that is a little bit clearer know.
Thank you very much.
|
|
|
|
|
Hi guys, can somone explain me the difference between
following calls ?
CCriticalSection mySection;<br />
<br />
mySection.Lock();<br />
....<br />
mySection.Unlock();
--------------------------
<br />
CCriticalSection mySection<br />
CSingleLock myLock(&mySection);<br />
<br />
myLock.Lock();<br />
....<br />
myLock.Unlock();
Thanks a lot !!
|
|
|
|
|
I don't know it as well but... as you are giving a reference to the CCriticalSection in the constructor of your CSingleLock, I guess you can access its methodes from the second one as well. It maybe is so to create an object based in one type and having access to functions in both (created and referenced).
Let see what the others say. (BTW, nice question )
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
The purpose of CSingleLock is to prevent cases where you might accidentally do this
<br />
<br />
mySection.Lock();<br />
....<br />
<br />
return;<br />
<br />
mySection.Unlock();<br />
<br />
If you use CSingleLock then when return is called CSingleLock is destroyed and its destructor calls Unlock() preventing disaster.
"The secret of happiness is freedom, and the secret of freedom, courage."
Thucydides (B.C. 460-400)
|
|
|
|