Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
S

Santanu Lahiri

@Santanu Lahiri
About
Posts
30
Topics
11
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Odd bug in CMFCToolbarComboBoxButton class
    S Santanu Lahiri

    Yes, a code sample in the MSDN website gives details on how to identify the control that you are using.

    CMFCToolBarComboBoxButton\* pSrcCombo = NULL;
    
    CObList listButtons;
    if (CMFCToolBar::GetCommandButtons(ID\_EDT\_FIND\_NDC, listButtons) > 0)
    {
    	for (POSITION posCombo = listButtons.GetHeadPosition();
    		pSrcCombo == NULL && posCombo != NULL;)
    	{
    		CMFCToolBarComboBoxButton\* pCombo = DYNAMIC\_DOWNCAST(CMFCToolBarComboBoxButton, listButtons.GetNext(posCombo));
    
    		if (pCombo != NULL && CMFCToolBar::IsLastCommandFromButton(pCombo))
    		{
    			pSrcCombo = pCombo;
    		}
    	}
    }
    
    C / C++ / MFC help question

  • Odd bug in CMFCToolbarComboBoxButton class
    S Santanu Lahiri

    Yes, I finally got frustrated enough to think up alternatives. I had already coded to find the CMFCToolbarComboBoxButton object (Code from MSDN actually), so now I went ahead and code along the following lines:

    if (pSrcCombo != NULL)
    {
        ASSERT\_VALID(pSrcCombo);
        CMFCToolBarComboBoxEdit \*pEdit = (CMFCToolBarComboBoxEdit \*) pSrcCombo->GetEditCtrl();
        if (pEdit)
        {
            CString strSelItem=\_T("");
            pEdit->GetWindowText (strSelItem);
            pSrcCombo->AddItem (strSelItem);
            ...
        }
    }
    

    Using the Edit Control seems to have solved the problem for me. At the MFCToolbarComboBoxButton level, there is no option for a fix that I have found. Perhaps subclassing the control and intercepting the GetText() call may work, but I have not tried it.

    modified on Tuesday, October 20, 2009 4:07 PM

    C / C++ / MFC help question

  • Odd bug in CMFCToolbarComboBoxButton class
    S Santanu Lahiri

    Hello, I am trying to use this control in a toolbar. For the most part the code works. However, I am running into this odd problem that I am getting partial text back when I call GetText. The app requires that when I click a different button in the toolbar, I check the combo box and retrieve the text from it for processing. That is when this bug surfaces. The last character is getting truncated. If I retrieve the text in response to the Enter key handler for the combo box, I get the full text using the same GetText call. Here is the code...most all of it is lifted from the samples. CObList listButtons; if (CMFCToolBar::GetCommandButtons(ID_EDT_FIND_NDC, listButtons) > 0) {     for (POSITION posCombo = listButtons.GetHeadPosition();     pSrcCombo == NULL && posCombo != NULL; )     {        CMFCToolBarComboBoxButton* pCombo = DYNAMIC_DOWNCAST(CMFCToolBarComboBoxButton, listButtons.GetNext(posCombo));        if (pCombo != NULL) pSrcCombo = pCombo;     } } if (pSrcCombo != NULL) { ASSERT_VALID(pSrcCombo); LPCTSTR lpszSelItem = pSrcCombo->GetText(); ... } So if the combo box has the text '1234567890', I am getting back '123456789' in one case, and '1234567890' in another case, depending on whether I press the other button or press the Enter key. Has anyone encountered this, and can someone suggest a solution? Thanks for your time.

    C / C++ / MFC help question

  • Funny headlines on CNN
    S Santanu Lahiri

    I browse the CNN homepage now and then. This morning (6/18/2009) I looked at it and saw two headlines side by side that just cracked me up. Under the More News section down towards the bottom, under the Health subheading, I saw the following two news items one after another: Health » Periods: What's normal, what's not, what to do Beware Web-assisted self-diagnosis Makes me wonder if someone at CNN is developing a sense of humor...

    The Lounge announcement

  • User of the Year!
    S Santanu Lahiri

    I hate to overcharge for services, but in this case, I am tempted to add a few zeros after the normal fee...

    The Lounge sysadmin windows-admin question workspace

  • User of the Year!
    S Santanu Lahiri

    You would still need to get the dongle to the PC... which they do not seem very eager to do.

    The Lounge sysadmin windows-admin question workspace

  • User of the Year!
    S Santanu Lahiri

    Easier said than done, these days, in this economy. I can only wish...

    The Lounge sysadmin windows-admin question workspace

  • User of the Year!
    S Santanu Lahiri

    I think you are on the right track there...

    The Lounge sysadmin windows-admin question workspace

  • User of the Year!
    S Santanu Lahiri

    Errrr, no. This is neither... Not even a government installation. I best not say anything else about their field...

    The Lounge sysadmin windows-admin question workspace

  • User of the Year!
    S Santanu Lahiri

    We considered USB thumbdrives, SD cards etc, but the PCs are off limits to us and they are not willing to use the legwork network. In fact the manager went to some pains to point out, come time for license renewal, he DID NOT expect to have anyone go to each of the 100 machines and install a new license. Which, BTW, would require a complete re-install of their software because they are hardwiring the registration key inside their app! Oh yes, a full recompile as well.

    The Lounge sysadmin windows-admin question workspace

  • User of the Year!
    S Santanu Lahiri

    Our company has an application that run on a (Gasp!) Windows environment. We put a license key in it that expires periodically, say a year, and needs to be renewed. By the way, the stuff is a DLL that is called by the client's application, and the key is passed to the DLL by the client's app when loading the DLL (client requirement, our app will not have access to the registry or have admin privilege!). One of our client proposed to install this on a hundred PCs in their site. We were happy to say yes. The client was quite willing to pay the annual licensing fee. Then came the gotchas: 1. The PCs are NOT connected to ANY sort of a network. 2. The client will NOT consider connecting them to a network, not even to let us remote in. 3. The client is not willing to go around to each station and copy a new application onto the PC. 4. The client is adamant that they need to hardwire the license key into their application. 5. The client requires that all updates and patches be applied as they are released. Uhhhh, did we miss a turn or something somewhere?

    The Lounge sysadmin windows-admin question workspace

  • Formatting text onto a DC
    S Santanu Lahiri

    Stephen, Your suggestion was exactly what I needed. I used the SetWorldTransform API to rotate and align text along the required axes and let DrawText do the wordwrap part. Thank you very much.

    C / C++ / MFC help workspace c++ json performance

  • Formatting text onto a DC
    S Santanu Lahiri

    Stephen, I am not familiar with the World Transform functions, so I will have to go through the sections to pick up on them, but thank you for pointing me at them. From the initial look I had, they do look promising. Santanu

    C / C++ / MFC help workspace c++ json performance

  • Formatting text onto a DC
    S Santanu Lahiri

    Unfortunately, I am out of options at this point... In-Memory bitmap and rotate would have to be the answer. I was kind of hoping some built-in API.

    C / C++ / MFC help workspace c++ json performance

  • Formatting text onto a DC
    S Santanu Lahiri

    This should be a simple problem, but I am unable to solve it! My environment is VStudio 2005 and MFC. The issue is printing text onto a DC. Should be simple enough, but here are some constraints: 1. The text may be rotated 0, 90, 180, 270 degrees. 2. The text may need reformatted within the bounding rectangle, meaning word-breaks. 3. The text will need to be aligned horizantally and vertically within the bounding rectangle - left, right, and center horizontally, top, center, bottom vertically. Rotating text is not a problem. Normally, I could use DrawText to print the text, but on rotated fonts, DrawText seems to choke. I tried TextOut and ExtTextOut. These rotate and position just fine, but can't seem to do word-wrap. Is there an API call or setup that I am missing? Or do I need to draw to a memory DC and somehow rotate it to fit? Or can someone please point me to some code that will accomplish this easily? Thank you for your time

    C / C++ / MFC help workspace c++ json performance

  • Surely this can't a phishing email...
    S Santanu Lahiri

    Just thought I'd lighten things up for a moment... received this in my EMail. I did not get past the first line when I read it... ----------------------------------------------- Dear KeyBank Online Baking customer, During our regularly scheduled account maintenance and Online verification procedures, we have detected a slight error in your account information. This might be due to either of the following reasons: 1. A recent change in your personal information ( i.e change of address). 2. Submitting invalid information during the initial enrollment process. Please update and confirm your information by clicking the link below: https://accounts.key.com/ib2/confirm\_jsp/pageStart.jsp?sqklobh=middle2 For help please contact Online Customer Service immediately by email at customer_service@keybank.com or call us at 1-800-539-29689 . Thank you for using KeyBank Online Banking!

    The Lounge help java com sales question

  • ADO Update Question
    S Santanu Lahiri

    Actually, I had tried that already, it did not work. I am beginning to think this is something so deep inside Microsoft Cursor engine, that there may not be an easy work-around. The SQL I used was not a SHAPE sql anyway. My solution so far has been to switch to a disconnected recordset, and intercept update notifications from the grid. Then I have to write some code for a Lazy Writer to actually update the database with the changes from the grid.

    Database database question css mysql xml

  • Access to mySQL
    S Santanu Lahiri

    There are several items listed on the MySQL website that claim to do this. I have tried a few demos and they certainly seem to live up to those claims. Look in the Developers section, under Migration.

    Database database mysql question

  • ADO Update Question
    S Santanu Lahiri

    My Environment: MySQL Database, ADO, MSVC6, MS DataGrid. Datagrid is being used to display data from three tables, joined by their primary keys. Problem: User wants to be able to edit the data in the grid itself. When he does, and tried to move to another record, the grid displays the message "Insufficient Key Column Information for updating or refreshing". User is not willing to have me bring up the row data in a dialog to edit. Even Bigger Problem: I need to keep this user happy! Schema: Table_1: ID (AutoNumber, PK), Field_A (Varchar), Field_B (Varchar) Table_2: ID (Autonumber, PK), Field_C (Varchar), Field_D (Integer) Table_3: ID (Autonumber, PK), Field_E (Double) SQL for Grid: SELECT Table_1.ID, Table_1.Field_A, Table_2.Field_C, Table_3.Field_E FROM (Table_1 INNER JOIN Table_2 ON Table_1.ID=Table_2.ID) INNER JOIN Table_3 ON Table_1.ID=Table_3.ID ORDER BY Table_1.Field_A MS KB: There is no duplication of field names except ID. ID is always the primary key. The ID field is not being updated. Field_A is. ADO: I have tried using both adUseClient and adUseServer as the cursor location, for both the connection object and the recordset object. Has not made any difference. Can I set this up so that enough key column information is available for the update? Is this even possible?

    Database database question css mysql xml

  • Printing bitmaps to printer
    S Santanu Lahiri

    I have a series of small bitmaps I need to print. The bitmaps are approx. 20 pixels wide and 15 pixels high. I would like them to print on the printer at about 1/4" or so high and 3/4" wide. I figured I could use the StretchBlt call to do this. I am using the following code: // nTxtHt holds the height of a line of text to be printed

    CBitmap bmp;
    bmp.LoadBitmap (nBmpID);

    BITMAP bm;
    bmp.GetBitmap (&bm);

    int nWd = bm.bmWidth;
    int nHt = bm.bmHeight;
    int nWide = MulDiv (nWd, nTxtHt, nHt);

    CDC memDC;
    memDC.CreateCompatibleDC (pDC);
    CBitmap *pBmpOld = memDC.SelectObject (&bmp);

    CRect rc (CPoint (nX, nY), CSize (nWide, nTxtHt));
    pDC->Rectangle (&rc);
    pDC->StretchBlt(nX, nY, nWide, nTxtHt, &memDC, 0, 0, nWd, nHt, SRCCOPY);
    memDC.SelectObject(pBmpOld);

    The framing rectangle prints just fine. The bitmap prints fine in preview. But when printed to printer, it shows up as a dot. What am I doing wrong here?

    C / C++ / MFC graphics question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups