|
In addition do comment by Ash. Move
if(pv>=oTagBase->GetAlarmHigh())
{
m_Picture.SetBitmap(Bmp1);
}
else
{
m_Picture.SetBitmap(Bmp2);
}
to a separate function, e.g. SetImages() and call this from OnInitDialog. Modify SetImages() to only call SetBitmap if the image actually changed since last call.
Then if possible add an event handler listening for changes in the alarm. If you have no such mechanism implemented you could poll the alarm value using a timer.
|
|
|
|
|
m_Picture.SetBitmap(Bmp1) isnt drawing the pic i guess by not taking the dc as param.
i miss something like
Picture.Draw(dc);
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
You should set the bitmap only when needed, for instance
void CFacePlate::OnPaint()
{
static bool wasAlarmHigh = false;
bool isAlarmHigh = pv>=oTagBase->GetAlarmHigh();
if ( isAlarmHigh != wasAlarmHigh)
{ if(isAlarmHigh)
{
m_Picture.SetBitmap(Bmp1);
}
else
{
m_Picture.SetBitmap(Bmp2);
}
wasAlarmHigh = isAlarmHigh;
}
}
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
[My articles]
|
|
|
|
|
please help
i get this message when i try to build the application. please note that it was converted to visual studio 2010
error C1083: Cannot open source file: '..\..\..\..\..\Program Files\Microsoft Visual Studio\VC98\MFC\SRC\WINMAIN.CPP': No such file or directory C:\Users\Yotam Wimmer\Desktop\Scope files\Copy of ver8hSearchWholeWord\c1xx
i am not sure what the winmain.cpp is but i have found it on my system at "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\src\mfc"
how can i tell visual studio to look in that path instead of the other one. or is there another solution?
thanks,
yotam
|
|
|
|
|
You should be able to change the path to the file by either opening the .vcproj file in notepad and changing it or by clicking the file in the Solution Explorer and changing the RelativePath property in the Properties window (That's the dock-able properties window, not the one you get from right-clicking)
My current favourite quote is: Punch them in the face, see what happens!
-SK Genius
|
|
|
|
|
thanks you ,legend
|
|
|
|
|
Below are run NOTEPAD. 01001EDC place, in EXE OllyDbg interrupt results:
<br />
01001ED6 |. 8B3D 48120001 MOV EDI,DWORD PTR DS:[<&USER32.CheckMenu>; |USER32.CheckMenuItem<br />
01001EDC |. 50 PUSH EAX ; |hMenu<br />
01001EDD |. FFD7 CALL EDI ; \CheckMenuItem<br />
u can OllyDbg through the upper check into another process EAX value.
How do I use vc + + to write a program that can read the value 01001EDC EAX place?
|
|
|
|
|
I beleive you have to get a handle to the process (in this case, Notepad), and then use an API function called ReadProcessMemory
If you do a search on ReadProcessMemory you should find some examples, there were some around a while back - its not 'easy' though ..
'g'
|
|
|
|
|
Can you explain what you're trying to do more clearly? I'm not sure what you're asking.
Steve
|
|
|
|
|
Hi,
I am reading some image data out of a camera pixels and have extracted the raw pixel intensity. Each "pixel" on the Camera sensor has either a R,G, or B filter that gives the intensity of the 'R', 'G', or 'B' 'pixel'. I read this data and then extract and store the individual R, G, or B pixel intensities into 3 separate 2d unsigned char arrays called m_ptrRed2DPostDecimationArray. m_ptrGreen2DPostDecimationArray, and m_ptrBlue2DPostDecimationArray. Now I can use SetPixel to display the extracted R, G, and B in 3 separate 'R', 'G', or 'B' window areas. I can display them either in color or grayscale through:
For grayscale: dc.SetPixel(j, i, RGB(theApp.m_ptrRed2DPostDecimationArray[i][j], theApp.m_ptrRed2DPostDecimationArray[i][j], theApp.m_ptrRed2DPostDecimationArray[i][j]));
For color: dc.SetPixel(j, i, RGB(theApp.m_ptrRed2DPostDecimationArray[i][j], 0, 0));
However, I realize SetPixel is very ineffecient so looking at other ways to display. I only need the 8 bit grayscale image so was hoping that I could achieve it using CreateBitmap. m_ptrRed2DPostDecimationArray is a BYTE array (actually unsigned char) that holds the 8 bit raw pixel intensities from the camera pixels that have a red filter on them. Here is my current code (that does not work):
void CVC_ExampleDlg::OnPaint()
{
CDC *pDC = GetDC();
BOOL retval = m_redBitmap.CreateBitmap(600, 200, 1, 8, theApp.m_ptrRed2DPostDecimationArray);
CDC memDC;
memDC.CreateCompatibleDC(pDC);
memDC.SelectObject(&m_redBitmap);
retVal = pDC->BitBlt(0, 0, 600, 200, &memDC, 0, 0, SRCCOPY);
memDC.DeleteDC();
ReleaseDC(pDC);
CDialog::OnPaint();
}
Now I know I can create a grayscale palette and use the raw data as an index to that palette but it seems to me that CreateBitmap has that built in functionality. I mean it seems like that when I give it 1 color plane and 8bpp, it should automatically create a grayscale 8bit bitmap, no?
Can anyone see what I'm doing wrong. I mean all I want is that I already have the pixel intensity from 0-255 (8 bit) in a byte array. Since I just only want a grayscale bitmap, creating a grayscale palette and indexing it seems overkill especially when CreateBitmap seems to (theoretically) encapsulate that functionality.
I guess, if my question is clear enough, what is the easiet and/or most efficiect way to create a 8bit grayscale image from the raw pixel intensity value from 0-255?
Thank you,
-Vivek Kinra
|
|
|
|
|
You should be looking at creating a DIB using CreatDIBSection() and SetDIBits() .
This may help CDibData[^]
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence." - Edsger Dijkstra
"I have never been lost, but I will admit to being confused for several weeks. " - Daniel Boone
|
|
|
|
|
Thanks Jon..but really, why is it that CreateBitmap doesn't work? I mean based on its documentation it should right?
I'm trying to do this the simple way and I suspect that there is built in functionality to take raw pixel intensity data and create a 8bit grayscale bitmap without explicitly creating a grayscale palette and using the raw pixel data as indices to that palette right?
I mean it seems fairly basic to simply take intensity data that is from 0-255 and drawing that as a grayscale bitmap.
-V
|
|
|
|
|
It has been a long time, but the problem could be as simple as word alignment. The length of each scan line must be divisible by 4. That is, each line must be padded with zeros if it is not already word aligned.
Example: (assuming single-byte per pixel)
wrong_data[2][1] = {
{0x00},
{0xFF}
};
correct_data[2][4] = {
{0x00, 0x00, 0x00, 0x00},
{0xFF, 0x00, 0x00, 0x00}
};
I have not tested the above, but it looks right.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence." - Edsger Dijkstra
"I have never been lost, but I will admit to being confused for several weeks. " - Daniel Boone
|
|
|
|
|
I always thought I had a good grip on short circuit evaluation for Logical AND and Logical OR but I'm mixing the two and the results are not intuitive. The specification does not suggest the behavior I'm seeing with VC++ 2003 so I thought I'd post the test and results and see if anyone can tell me why "Eval3" never gets evaluated.
void Test()
{
if (Eval1() || Eval2() && Eval3()) {
TRACE("Result = TRUE\n");
} else {
TRACE("Result = FALSE\n");
}
}
BOOL Eval1(void)
{
TRACE("Eval1\n");
return TRUE;
}
BOOL Eval2(void)
{
TRACE("Eval2\n");
return TRUE;
}
BOOL Eval3(void)
{
TRACE("Eval3\n");
return FALSE;
}
Output:
Eval1
Result = TRUE
|
|
|
|
|
rather than worrying about short circuiting, you should pay attention first to precedence.
a || b && c
isn't
(a || b) && c
it is equivalent to
a || (b && c)
When a is true, no need to evaluate b nor c.
The and/or precedence rule is simple, it is very similar to the one for 1 + 2 * 3
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
For some reason I had thought && and || were at the same precedence level and evaluated left to right but what your saying makes sense now that you helped me focus.
thanks for your guidance.
|
|
|
|
|
you're welcome.
PS: when in doubt, add parentheses.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Forget doubt, always use parentheses. Just make it bonehead simple and you never get what you don't expect. And you don't confuse people who are precedence challenged.
The wonderful thing about the Darwin Awards is that everyone wins, especially the members of the audience.
|
|
|
|
|
Luc Pattyn wrote: PS: when in doubt, add parentheses.
Words of wisdom.
Steve
|
|
|
|
|
How can I find how much memory my application is using up programatically? i.e Task Manager
|
|
|
|
|
|
It does not really matter, read this[^].
Watched code never compiles.
|
|
|
|
|
You can use GetProcessMemoryInfo[^] function.
This[^] is MSDN example for the usage of the function.
If you want to find the memory usage of your application only then you can pass GetCurrentProcess[^] as the process handle in order to get the information.
|
|
|
|
|
What I am trying to get at is find (private working set) like it shows on Task Manger per process. GetProcessmemoryInfo gets me workingsetsize which isn't the private. Do you know how I can calculate the private number?
Thanks
modified on Thursday, June 3, 2010 1:21 PM
|
|
|
|
|
Have you seen this?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|