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
J

JC Gauthier

@JC Gauthier
About
Posts
8
Topics
4
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Validate a filename
    J JC Gauthier

    How do you know if a combination of a path and filename is valid ? I don't want to know if it is an actual existing file but only if it's valid (does not contain any invalid caracters). Also, I do not want to create a file on the disk to know if I'll receive an invalid filename error. So, how can I know if a path + filename combination has a valid syntax ? (example: "C:\folder name\file name.ext" is valid, "C:\folder name\file&?n!.ext" is invalid) I'm using C++ only (no MFC, etc). Thanks a lot ! =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= J.-C. Gauthier - http://www.grandmenhir.com/

    C / C++ / MFC c++ question com help tutorial

  • Disabling a button using ATL
    J JC Gauthier

    Excellent ! This is exactly what I was looking for :-D Thanks for your input. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= J.-C. Gauthier - http://www.grandmenhir.com/

    C / C++ / MFC c++ com question

  • Disabling a button using ATL
    J JC Gauthier

    Is there a way to enable/disable a button whitout using MFC ? I am not really familliar with this type of operation. I've done it successfully for edit control : // Enable ::SendDlgItemMessage(hwndDlg, IDC_KEYPAIRNEWFILENAME, WM_ENABLE, TRUE, 0); // Disable ::SendDlgItemMessage(hwndDlg, IDC_KEYPAIRNEWFILENAME, WM_ENABLE, FALSE, 0); and was expectiong something similar for buttons but everything I tried was unsuccessfull. Thanks. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= J.-C. Gauthier - http://www.grandmenhir.com/

    C / C++ / MFC c++ com question

  • How ???
    J JC Gauthier

    Security holes in IE or somebody else have been using your computer :) =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= J.-C. Gauthier - http://www.grandmenhir.com/

    Web Development tools question

  • Problem converting a CComBSTR to LPCTSTR with CW2CT
    J JC Gauthier

    :~ even with 1024 it doesn't work

    TCHAR pszBuf[1024] = "";// Message buffer

    maybe there is something else I need to do. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= J.-C. Gauthier - http://www.grandmenhir.com/

    C / C++ / MFC help c++ css

  • Problem converting a CComBSTR to LPCTSTR with CW2CT
    J JC Gauthier

    oops sorry, I kinda didn't notice I was in the wrong forum :) =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= JiCi - http://www.grandmenhir.com/

    The Lounge help c++ css

  • Problem converting a CComBSTR to LPCTSTR with CW2CT
    J JC Gauthier

    I have a problem converting a CComBSTR to LPCTSTR with CW2CT. Eveything works fine until my CComBSTR gets around 64 caracters... then the result of the convertion is a long "corrupted" string: "îþîþîþîþîþîþîþîþîþîþîþîþîþîþîþ...." Please help me ! :(( ----- See comments between /* */ for more info -----

    LRESULT CListBoxDlg::OnBnClickedBtngetselitems(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
    {
    LPCTSTR sTitle; // Message box title
    int arrSelList[12]; // Message buffer
    TCHAR pszBuf[128] = "";// Message buffer
    int iMaxNum = 12; // Max number of selected items
    LRESULT iSelCount = 0; // Total selected items in the list
    LPCTSTR sMsg = 0; // Message to put in the message box
    CComBSTR bsMessage; // Message accumulator

    iSelCount = this->SendDlgItemMessage(IDC\_AVSCODES, LB\_GETSELITEMS, WPARAM(iMaxNum), LPARAM(arrSelList));
    
    if (iSelCount != LB\_ERR) {
    
    	bsMessage.Append("You have selected the fields: ");
    	\_stprintf(pszBuf, "%li", arrSelList\[0\]);
    	bsMessage.Append(pszBuf);
    
    	for (int i = 1; i < iSelCount; i++) {
    
    		bsMessage.Append(", ");
    		\_stprintf(pszBuf, "%li", arrSelList\[i\]);
    		bsMessage.Append(pszBuf);
    	}
    	bsMessage.Append(".");
    	/\* The following line will fails if bsMessage.m\_str contains:
    		"You have selected the fields: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11."
    	   But will not fail if it bsMessage.m\_str contains:
    		"You have selected the fields: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10."
    		(4 caracter less) but long size is not suppose the cause problems
    		with ATL 7.0 compared to ATL 3.0
    	\*/
    	sMsg = CW2CT(bsMessage.m\_str);
    	/\*
    	// The following two lines makes it work fine but USES\_CONVERSION is not supposed
    	// to be needed with ATL 7.0
    	USES\_CONVERSION;
    	sMsg = W2CT(bsMessage.m\_str);\*/
    	sTitle = \_T("Selected Items List");
    	::MessageBox(this->m\_hWnd, sMsg, sTitle, MB\_OK);
    }
    
    return 0;
    

    }

    C / C++ / MFC help c++ css

  • Problem converting a CComBSTR to LPCTSTR with CW2CT
    J JC Gauthier

    I have a problem converting a CComBSTR to LPCTSTR with CW2CT. Eveything works fine until my CComBSTR gets around 64 caracters... then the result of the convertion is a long "corrupted" string: "îþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþîþ" Please help me ! :(( ----- See comments between /* */ for more info ----- LRESULT CListBoxDlg::OnBnClickedBtngetselitems(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { LPCTSTR sTitle; // Message box title int arrSelList[12]; // Message buffer TCHAR pszBuf[128] = "";// Message buffer int iMaxNum = 12; // Max number of selected items LRESULT iSelCount = 0; // Total selected items in the list LPCTSTR sMsg = 0; // Message to put in the message box CComBSTR bsMessage; // Message accumulator iSelCount = this->SendDlgItemMessage(IDC_AVSCODES, LB_GETSELITEMS, WPARAM(iMaxNum), LPARAM(arrSelList)); if (iSelCount != LB_ERR) { bsMessage.Append("You have selected the fields: "); _stprintf(pszBuf, "%li", arrSelList[0]); bsMessage.Append(pszBuf); for (int i = 1; i < iSelCount; i++) { bsMessage.Append(", "); _stprintf(pszBuf, "%li", arrSelList[i]); bsMessage.Append(pszBuf); } bsMessage.Append("."); /* The following line will fails if bsMessage.m_str contains: "You have selected the fields: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11." But will not fail if it bsMessage.m_str contains: "You have selected the fields: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10." (4 caracter less) but long size is not suppose the cause problems with ATL 7.0 c

    The Lounge help c++ css
  • Login

  • Don't have an account? Register

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