Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recent content by bcravens

  1. bcravens

    ListControl in a Dialog box

    Over ride OnInitDialog and put this initialization code in there.
  2. bcravens

    Problems with OnPaint

    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...
  3. bcravens

    Problems with OnPaint

    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.
  4. bcravens

    GDI problem: CreateSolidBrush

    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.
  5. bcravens

    Specify Coloru for Specific Labels

    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.
  6. bcravens

    OnCtlColor Use in MFC Application

    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.
  7. bcravens

    Problems with WM_PAINT

    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.
  8. bcravens

    Using art as a window or control

    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.
  9. bcravens

    LAN/WAN

    You will probably want to learn how to use sockets. There are a lot of resources on the internet about their use.
  10. bcravens

    Getting position / coordinate of button on dialog

    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.
  11. bcravens

    CFile troubles

    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...
  12. bcravens

    parallel port access under winXP

    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.
  13. bcravens

    Using CRecordset without DB Connection

    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...
  14. bcravens

    Server behind a router...how to access from outside the network

    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.
  15. bcravens

    Using Visual c++ to solve systems of linear equration

    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...

Part and Inventory Search

Back
Top