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
M

Mahendra_786

@Mahendra_786
About
Posts
20
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Splitter Window
    M Mahendra_786

    (To be complete) this is what can be done: CRect rect; m_wndSplitter.GetClientRect(rect); CSize splitter_size = m_wndSplitter.GetSplitterSize(); CSize border_size = m_wndSplitter.GetBorderSize(); int row_height = rect.Height() - ((splitter_size.cy * (m_rows - 1)) + (border_size.cy * 2)); int col_width = rect.Width() - ((splitter_size.cx * (m_cols - 1)) + (border_size.cx * 2)); row_height /= m_rows; col_width /= m_cols; for (int i = 0; i < m_rows; i++) { m_wndSplitter.SetRowInfo(i, row_height, 100); } for (int j = 0; j < m_cols; j++) { m_wndSplitter.SetColumnInfo(j, col_width, 100); } m_wndSplitter.RecalcLayout(); Regards Mahendra

    C / C++ / MFC

  • Splitter Window
    M Mahendra_786

    Thanks. This is probably the only way out. Here is a fragment from Q & A: C++ (Periodicals 1998) from MSDN Library 1999 that does something similar: After calculating the heights of the toolbars, the next troublesome task is calculating the height and width of all the splitter window components: the border with which it surrounds each pane and the splitter bar itself. All these magic numbers are contained within data members in CSplitterWnd, but naturally the data is protected, which means you can’t access it! Sigh. So what do you do? Simple: just derive a new class with public functions to export the protected data, and use it instead of CSplitterWnd in your main frame. class CMySplitterWnd : public CSplitterWnd { public: CSize GetBorderSize() { return CSize(m_cxBorder,m_cyBorder); } CSize GetSplitterSize() { return CSize(m_cxSplitter,m_cySplitter); } };

    C / C++ / MFC

  • how to convert BYTE to String
    M Mahendra_786

    Try this: char buff[3] = ""; sprintf(buff, "%X", Byte); // Display in hex (or choose whatever format you prefer) this->Textbox1->Text = buff; Hope it works! Regards Mahendra

    C / C++ / MFC c++ question csharp winforms help

  • Splitter Window
    M Mahendra_786

    I am creating a 2x2 spllitter window in a SDI application. // OnCreateClient of SDI Frame Window ... VERIFY(m_wndSplitter.CreateStatic(this, m_rows, m_cols)); ... I want every pane to be of the same size (plus-minus 1 pixel). In OnSize I do something like: // OnSize of Frame Window ... m_wndSplitter.GetClientRect(rect); int row_height = rect.Height(); int col_width = rect.Width(); row_height /= 2; col_width /= 2; m_wndSplitter.SetRowInfo(0, row_height, 100); m_wndSplitter.SetRowInfo(1, row_height, 100); m_wndSplitter.SetColumnInfo(0, col_width, 100); m_wndSplitter.SetColumnInfo(1, col_width, 100); m_wndSplitter.RecalcLayout(); ... HOWEVER probably due to the "splitting margin" or border between panes, the pane(0, 0) is larger than the other panes with a difference of about 11 pixels in size. Other than "manually" accounting for the border thickness, is there a better way of making the panes same size. Thanks in anticipation.

    C / C++ / MFC

  • CPtrList
    M Mahendra_786

    But is this ok - (re)moving from the tail end if a sub-sequence has to be removed and RQUIRES using RemoveAt. This seems to works: for (pos = m_points.GetTailPosition(); !m_points.IsEmpty(); m_points.GetPrev(pos)) { pPt = m_points.GetAt(pos); delete pPt; m_points.RemoveAt(pos); } pos is still not NULL in the end though! Or like in the MSDNL RemoveAt help!: POSITION pos1 = NULL; POSITION pos2 = NULL; for (pos1 = m_points.GetHeadPosition(); (pos2 = pos1) != NULL; ) { m_points.GetNext(pos1); pPt = m_points.GetAt(pos2); delete pPt; m_points.RemoveAt(pos2); } Due Regards Mahendra

    C / C++ / MFC debugging help question

  • CPtrList
    M Mahendra_786

    Hi, I am trying to iterate and delete the elements (assuming atleast 1 element) in a CptrList with this: void *pPt = NULL; POSITION pos = NULL; for (pos = m_points.GetHeadPosition(); !m_points.IsEmpty(); m_points.GetNext(pos)) { // TRACE("pos: %d, %d\n", pos, NULL); pPt = m_points.GetAt(pos); m_points.RemoveAt(pos); delete pPt; } TRACE shows that pos is not equal to NULL as it should be after the last element has been seen. So pos != NULL check does not work contrary to the MSDN Library documentation. THIS IS ONE PROBLEM. The OTHER is even if there are more than 1 elements the second element returned by GetAt is not "valid" (0xcdcdcdcd) and RemoveAt asserts. Any clues? Regards Mahendra

    C / C++ / MFC debugging help question

  • Libraries for creating a RIFF Wav file??
    M Mahendra_786

    Hi, MCI (Media Control Interface) is part of Windows SDK. You may need to work with low-level MCI if you have to directly manipulate raw audio-data. I am not sure if MCI supports MP3 files directly, though. Due Regards Mahnedra

    C / C++ / MFC performance question

  • wchar_t* wsz = L .. proplem ..
    M Mahendra_786

    If you define _UNICODE the internal CString buffer is already unicode data, which you can get using GetBuffer(). If _UNICODE is not defined, you can convert the buffer using MultiByteToWideChar. Hope this helps! Due Regards Mahendra

    C / C++ / MFC help tutorial

  • I need help
    M Mahendra_786
    1. After you get the file name from the Dialog create the file using CFile or whatever. 2) In your (added) OnNewDocument function call SetPathName(""); e.g. BOOL CMyDoc::OnNewDocument() { if (!CDocument::OnNewDocument()) return FALSE; // TODO: add reinitialization code here // (SDI documents will reuse this document) SetPathName("c:\\temp\\a.txt"); // c:\temp\a.txt should exist! return TRUE; } This will not display a Save Dialog when you select "Save" from the File menu. If I have not misunderstood your question this should help! Due Regards Mahendra
    C / C++ / MFC question help

  • modal dialog
    M Mahendra_786

    Why would you need to display a modal dialog in OnSize? Due Regards Mahendra

    C / C++ / MFC question

  • Combo Boxes and numbers
    M Mahendra_786

    You can provide another button to undo the last operation or a "Reset" button to start again. At least it is better than re-starting:) Due Regards Mahendra

    C / C++ / MFC tutorial question

  • ISAPI FILTER ON ISA SERVER
    M Mahendra_786

    Thats a lot of help to ask for on a Discussion forum. Still I can try, if you care. Due Regards Mahendra

    C / C++ / MFC sysadmin help question

  • Setting Background Color
    M Mahendra_786

    In a Win32 application you can set the hbrBackground member of the window class structure typically in "MyRegisterClass". wcex.hbrBackground = CreateSolidBrush(RGB(255, 0, 0)); // This makes the window red In MFC you can do something similar in PreCreateWindow. Due Regards Mahendra

    C / C++ / MFC tutorial question

  • How to load DLL from memory, not disk
    M Mahendra_786

    DLLs automatically use shared memory for READ-ONLY areas. Due Regards Mahendra

    C / C++ / MFC performance help tutorial

  • Convert to PDF
    M Mahendra_786

    Hi, Yours is a "custom" application which needs to "create/ save as" PDF documents? If that is true than you would need something similar to what you have for RTF; there are commercial libraries available to write PDF files as well. Due Regards Mahendra

    C / C++ / MFC tutorial question discussion

  • a question about Edit Box
    M Mahendra_786

    That is :rolleyes:HIGHLY:rolleyes: correct and my way in fact may be insufficient not just unnecessary. In fact DDX_* somewhere calls SubclassWindow to do this. Moreover the way I suggested I am not sure how UpdateData will work beside other side-effects. Due Regards Mahendra

    C / C++ / MFC question

  • Convert to PDF
    M Mahendra_786

    Hi, It might help if you can give more details. There are "PDF toolkits" available to help create PDF files programmatically but then you will need to "parse" the RTF yourself. Another way is "printing" to something like Adobe's PDFWriter. Regards Mahendra

    C / C++ / MFC tutorial question discussion

  • WS_THICKFRAME &amp; Dialog icon
    M Mahendra_786

    Just commenting these 2 lines in OnInitDialog works for me in both vc 6.0 & vc 7.x SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon

    C / C++ / MFC question

  • how to get variable type
    M Mahendra_786

    What vc 7.x is doing seems more logical than vc 6.0 ... it seems to be checking the "from" and "to" types! class A { int a; }; class B: public A { int b; }; /***** break ****/ B b; if (dynamic_cast**(&b)) { printf("OK"); } /***** above will work in vc 7.x but not vc 6.0 */ /***** below will NOT work in both vc 7.x & vc 6.0 */ B b; A *p_a = &b; if (dynamic_cast**(p_a)) { printf("OK"); }****

    C / C++ / MFC tutorial question

  • a question about Edit Box
    M Mahendra_786

    You can do this using CWnd::SubclassDlgItem Derive your own class say CMyEdit from CEdit and add a WM_CHAR handler: void CMyEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) { if (nChar >= '0' && nChar <= '9') { CEdit::OnChar(nChar, nRepCnt, nFlags); return; } else { AfxMessageBox("Invalid Key"); } } In your Dialog class add this to OnInitDialog: m_myEdit.SubclassDlgItem(IDC_EDIT1, this); where m_myEdit is a Dialog member of type CMyEdit and IDC_EDIT1 is the edit control id. Hope this helps!

    C / C++ / MFC 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