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

mesajflaviu

@mesajflaviu
About
Posts
166
Topics
50
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How can I change background/text color of CComboBox ?
    M mesajflaviu

    I solve the problem in follow way :

    class CMyComboBox : public CComboBox
    {
    // ...
    afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
    // ...
    };

    and

    //...
    ON_WM_CTLCOLOR_REFLECT()
    //}}AFX_MSG_MAP
    END_MESSAGE_MAP()

    /////////////////////////////////////////////////////////////////////////////
    // CMyComboBox message handlers

    HBRUSH CMyComboBox::CtlColor(CDC* pDC, UINT nCtlColor)
    {
    HBRUSH hBrush = NULL;
    switch(nCtlColor)
    {
    case CTLCOLOR_EDIT:
    {
    pDC->SetBkColor(RGB(255, 0, 0));
    pDC->SetTextColor(RGB(255, 255, 255));
    hBrush = m_brush;
    }
    break;
    //...
    }
    return hBrush;
    }

    C / C++ / MFC question

  • There is a method to get m_hWnd of CComboBox ?
    M mesajflaviu

    There is a method to get m_hWnd of dropdown list of CComboBox , of course , except GetComboBoxInfo(...) ? I need to get that handle to work on Windows NT SP6 , and there I haven't COMBOBOXINFO struct and GetComboBoxInfo ... :( I try this[^] method , but is not good for me for two reason : 1. Don't function 'nCtlColor == CTLCOLOR_LISTBOX' part , I don't know why 2. This handle will be avaiable only after I clicked to dropdown button of CComboBox , and I needed in PreSublclassWindow already . Thank you .

    C / C++ / MFC com question learning

  • GetComboBoxInfo implementation
    M mesajflaviu

    In fact , I try to deturn LB_FINDSTRING from dropdown list into LB_FINDSTRINGEXACT , and there must be an solution that function for Windows NT ... :(

    C / C++ / MFC visual-studio com help question

  • GetComboBoxInfo implementation
    M mesajflaviu

    Then perhaps you give me an alternative for this issue : I need to have ComboBoxInfo.hwndList handle for the follow function :

    void CComboBoxExt::PreSubclassWindow()
    {
    // TODO: Add your specialized code here and/or call the base class

    CComboBox::PreSubclassWindow();
    
    COMBOBOXINFO ComboBoxInfo;
    ComboBoxInfo.cbSize = sizeof(ComboBoxInfo);
    GetComboBoxInfo(m\_hWnd,&ComboBoxInfo);
    

    // m_Edit.SubclassWindow(ComboBoxInfo.hwndEdit);
    m_List.SubclassWindow(ComboBoxInfo.hwndList);
    SetProp(ComboBoxInfo.hwndList, WndPropertyComboBoxEx, this);
    fNextListProc = (WNDPROC)SetWindowLong(ComboBoxInfo.hwndList, GWL_WNDPROC, (LONG)WinProcForList); // <- here I need ComboBoxInfo.hwndList
    }

    and implementation of WinProcForList is here :

    LRESULT CComboBoxExt::WinProcForList(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
    {
    CComboBoxExt* pInstance = (CComboBoxExt*)GetProp(hWnd,WndPropertyComboBoxEx);
    ASSERT(pInstance != NULL);

    if(msg == LB\_FINDSTRING)
    {
    	TRACE("Replacing LB\_FINDSTRING with LB\_FINDSTRINGEXACT when looking for: \\"%s\\"\\n", (LPCTSTR)lParam);
    	msg = LB\_FINDSTRINGEXACT;
    }
    
    return CallWindowProc(pInstance->fNextListProc, hWnd, msg, wParam, lParam);
    

    }

    any help or hint I will very appreciated !

    C / C++ / MFC visual-studio com help question

  • GetComboBoxInfo implementation
    M mesajflaviu

    Hi everyone ! Can you give an help hand , please ? I need an source code of GetComboBoxInfo function from here[^] Why ? Because I use that function in a project that I need compile on Windows NT SP6 , and there I don't have this function ... thank you very much .

    C / C++ / MFC visual-studio com help question

  • How can I use SetWindowLongPtr function in VC6 ?
    M mesajflaviu

    I try

    #include <Windows.h>

    but didn't work.

    C / C++ / MFC question help

  • How can I use SetWindowLongPtr function in VC6 ?
    M mesajflaviu

    Hi everyone . I try to use SetWindowLongPtr function to change behaviour of CComboBox control , but I get an error :

    error C2065: 'SetWindowLongPtr' : undeclared identifier

    what I can do ? I read somewhere that I need to install SDK , it's really necesary ? I mention that I use VC6 .

    C / C++ / MFC question help

  • How to provent text selection in CComboBox ?
    M mesajflaviu

    The problem is that when I type 'O' , the control autocompletion 'One' in editbox , select all text and put the mouse cursor at the end of the 'One' string .. is annoynig , because I want to type myself all string ... for more details , I put here[^] an source code .. .just type 'O' in combobox ....

    C / C++ / MFC help tutorial question

  • How to provent text selection in CComboBox ?
    M mesajflaviu

    I forget to say something : I use this , may me this cause weird behaviour ?

    void CComboBoxExt::OnEditchange()
    {
    // TODO: Add your control notification handler code here

    CString sText;
    GetWindowText(sText);
    if(sText.IsEmpty())ShowDropDown(FALSE);
    else ShowDropDown();
    

    }

    C / C++ / MFC help tutorial question

  • How to provent text selection in CComboBox ?
    M mesajflaviu

    I have an CComboBoxExt derived from CCOmboBox .. but I have an small problem , perhaps you can help me :

    CComboBoxExt	m\_Combo;
    

    void CTestComboView::OnInitialUpdate()
    {
    CFormView::OnInitialUpdate();
    GetParentFrame()->RecalcLayout();
    ResizeParentToFit();

    m\_Combo.AddString("One");
    m\_Combo.AddString("Two");
    m\_Combo.AddString("Three");
    

    }

    and when I type 'O' in combobox , it select me automatically 'One' item from the list ... well , I try this one :

    void CComboBoxExt::OnEditupdate()
    {
    // TODO: Add your control notification handler code here

    CString sText;
    GetWindowText(sText);
    DWORD dwCurSel = GetEditSel();
    WORD dStart = LOWORD(dwCurSel);
    WORD dEnd = HIWORD(dwCurSel);
    if(dStart == 0 && dEnd == sText.GetLength())
    	SetEditSel(sText.GetLength(),sText.GetLength());
    

    }

    but have no effect ....

    C / C++ / MFC help tutorial question

  • GetDlgItemText in an derived CComboBox
    M mesajflaviu

    Thanks . Goes well.

    C / C++ / MFC help question

  • GetDlgItemText in an derived CComboBox
    M mesajflaviu

    I try to make an CComboBoxExt derived from CCOmboBox . In

    void CComboBoxExt::OnEditchange()
    {
    // TODO: Add your control notification handler code here

    CString sText;
    GetDlgItemText(this?,sText);
    ShowDropDown();
    

    }

    I try to retrive the text that user entered in combobox , and if text is not empty show drop down list , if is empty then hide drop down list .. but I stuck on GetDlgItemText method : how can I retrieve the text that user entered ? Can you help me please ? Thank you !

    C / C++ / MFC help question

  • How can I upload an file in MFC ?
    M mesajflaviu

    I found the solution , and for those hwo have the same issue , I post the code :

    BOOL CMyDoc::UploadFile(CString sFileName)
    {
    CString sTemp;
    BOOL bRet = FALSE;
    CInternetSession session;
    CFtpConnection* pConn = NULL;
    CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();
    sTemp = sFileName.Right(sFileName.GetLength() - sFileName.ReverseFind('\\') - 1);

    try
    {
    	pConn = session.GetFtpConnection(\_T("ftp.domain.com"),\_T("username"),\_T("password"),INTERNET\_INVALID\_PORT\_NUMBER,TRUE);
    	bRet = pConn->PutFile(sFileName,\_T("./httpdocs/temp/") + sTemp);
    }
    catch(CException\* pException)
    {
    	pException->GetErrorMessage(sTemp.GetBuffer(255),255);
    	sTemp.ReleaseBuffer();
    	pException->Delete();
    	pFrame->SetMessageText(sTemp);
    }
    
    if(pConn)
    {
    	pConn->Close();
    	delete pConn;
    }
    
    return bRet;
    

    }

    C / C++ / MFC question c++ sysadmin

  • How can I upload an file in MFC ?
    M mesajflaviu

    Maybe ( or for sure ) I don't understand something : I have an address to an server : 'http://www.testserver.com/testfolder/' and in this location ( path ) I want to upload an PC local path file : 'D:/Flaviu/test.txt' ... How can I adapt download code from above to write strings into server file ? First , create an mirror text file on server , and there write strings from PC local txt file ?

    C / C++ / MFC question c++ sysadmin

  • How can I upload an file in MFC ?
    M mesajflaviu

    David , you are very prompt ! Thank you ! But , if I need to upload an file , don't need an login data to access upload server ?

    C / C++ / MFC question c++ sysadmin

  • How can I upload an file in MFC ?
    M mesajflaviu

    Ok , here is my download code , which goes perfectly : ( I don't know if is corectly , but does function )

    BOOL CMyDoc::GetXmlFile(CString sAddress, CString& sResult)
    {
    CString sTemp;
    CInternetSession ISession;
    CInternetFile* pIFile = NULL;
    CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();

    try
    {
    	pIFile = (CInternetFile\*)ISession.OpenURL(sAddress);
    	while(pIFile->ReadString(sTemp))sResult += sTemp;
    	pIFile->Close();
    	delete pIFile;
    }
    catch(CException\* pException)
    {
    	delete pIFile;
    	pException->GetErrorMessage(sTemp.GetBuffer(255),255);
    	sTemp.ReleaseBuffer();
    	pFrame->SetMessageText(sTemp);
    	return FALSE;
    }
    
    return TRUE;
    

    }

    I will be very glad if you can help me . Thank you very much !

    C / C++ / MFC question c++ sysadmin

  • How can I upload an file in MFC ?
    M mesajflaviu

    I test MFC classes to download files from internet server , but how can I upload it ? Can I use the same classes / tehnique ?

    C / C++ / MFC question c++ sysadmin

  • CTypedPtrArray & CStringArray
    M mesajflaviu

    Thanks , works fine ! Thank you all !!!

    C / C++ / MFC debugging performance help question

  • CTypedPtrArray & CStringArray
    M mesajflaviu

    I don't know if is corect , but I think that I solve it :

    // CMyDoc.h
    typedef CTypedPtrArray CDumpArray;
    class CMyDoc : public CDocument
    {
    protected: // create from serialization only
    CMyDoc();
    DECLARE_DYNCREATE(CMyDoc)

    // Attributes
    public:
    CDumpArray m_arrDump;
    ...
    };

    // CMyDoc.cpp
    CString sText = "one";
    CStringArray* pTable = NULL;
    pTable = new CStringArray();
    pTable->Add(sText);
    sText = "two";
    pTable->Add(sText);

    m\_arrDump.Add(pTable);
    
    pTable = new CStringArray();
    sText = "three";
    pTable->Add(sText);
    sText = "four";
    pTable->Add(sText);
    
    m\_arrDump.Add(pTable);
    

    void CMyDoc::OnCloseDocument()
    {
    // TODO: Add your specialized code here and/or call the base class

    TRACE("\\n m\_arrDump %d \\n",m\_arrDump.GetSize());
    
    CString sTemp;
    for(int n = 0;n < m\_arrDump.GetSize();++n)
    {
    	TRACE("\\n StringArray no %d \\n",n);
    	CStringArray\* pTable = m\_arrDump.GetAt(n);
    	for(int t = 0;t < pTable->GetSize();++t)
    	{
    		sTemp = pTable->GetAt(t);
    		TRACE("\\n %s \\n",sTemp);
    	}
    }
    int nCount = m\_arrDump.GetSize();
    for(int i = 0;i < nCount;++i)delete m\_arrDump.GetAt(i);
    m\_arrDump.RemoveAll();
    
    TRACE("\\n m\_arrDump %d \\n",m\_arrDump.GetSize());
    
    CDocument::OnCloseDocument();
    

    }

    C / C++ / MFC debugging performance help question

  • CTypedPtrArray & CStringArray
    M mesajflaviu

    At this code :

    #if defined(DEBUG) || defined(_DEBUG)
    _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
    #endif

    give me the follow error :

    error C2501: '_CrtSetDbgFlag' : missing storage-class or type specifiers

    Because I use VC6 ?

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