Also when you use the SelectObject function it returns a pointer to the old object. Reselect this object before the one you created goes out of scope. For example:
CPen pen1, *penOld;
penOld = pen1.CreatePen(PS_SOLID,3,RGB(0,0,0));
dc.SelectObject(&pen1);
// ....processes using the pen1 object...
Add the code
ReleaseDC(&dc);
to the end to release the dc you created. Even though it goes out of scope, I believe that MFC has done some behind the seens operations that has some memory still allocated.
Since you are in the mouse move handler, you needed to created a device context. You must also release the device context object with a call to ReleaseDC.
If you fail to do this you will run out of GDI resources and your program will fail.
Use the window pointer to get the specific window identifier like this.
if(pWnd->GetDlgCtrlID()==IDC_CAL_NAME)
{
pDC->SetTextColor(colorStatic);
}
Then you can distinguish between the different windows on your dialog.
Hope this helps.
Do it like this
if(pWnd->GetDlgCtrlID()==IDC_STATIC1
|| pWnd->GetDlgCtrlID()==IDC_STATIC2)
{
pDC->SetBkColor(RGB(0,0,0));
pDC->SetTextColor(RGB(0,255,255)); // or whatever yellow is
}
Hope this helps.
Sounds like you are loosing graphics resources. Make sure you reselect in the original pens, brushes, ... etc before exiting your paint function. Also if you use GetDC anywhere you need to use ReleaseDC.
Hope this helps.
You can use PhotoShop to create a bitmap. Then load the bitmap into a resource. From then on you can use it for a button image, bltbit is onto a dialog for a background image, ....
Hope this helps.
You probably are experiencing a challenge because the coordinate systems used by the rectangle and the point are different. There is a built in functions ClientToScreen and ScreenToClient to handle the conversion for you.
Hope this helps.
Try changing the following two lines of code.
Save.Read(&pClient, clSize);
should be
Save.Read(pClient, clSize);
Save.Write(&pClient, clSize);
should be
Save.Write(pClient, clSize);
The first parameter in these two calls is a pointer. Your pClient variable is already a pointer, so I don't...
I know that the CreateFile can be used to access the serial ports. I have not looked, but have a feeling it is also used to access the parallel port. Look it up on-line in the msdn website.
Hope this helps.
MFC Classes that will be of interest:
CDaoDatabase: Takes the filename and opens the db.
CDaoRecordset: Allows you to retrieve/save info from/to the database fields. Use the GetFieldValue/SetFieldValue methods.
CDaoTableDef: Allows you to contruct tables to add to the database. Add fields...
Some commercial routers also behave like a firewall. I know that my Linksys works this way. In order for a computer to be exposed to the outside world, I need to configure my router/firewall by forwarding all port activity to this computer.
Hope this helps.
There exist routines already for solving linear equations. I would start by examining those routines. Try finding an online version of "Numerical Methods in C". This reference has code that you can essentially copy and paste into your project (once you understand what it is doing of...
As you receive real time input data. Save it to an array that you will use to display your scope trace. Everytime you refresh your scope, redraw all the data by accessing the array.
Hope this helps.
The scroll bars are a property of the window style. I'm not sure if there is an api to tell if they are visible or not. Here is a solution (although may not be the most elegant).
Get the window rectangle for both the frame and client windows. You know that the difference in width will be larger...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.