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

Sandeep Saini SRE

@Sandeep Saini SRE
About
Posts
16
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Need To Create a crawler/spider in vc++
    S Sandeep Saini SRE

    Hi Ash, You still need the code? If yes then please let me know.

    C / C++ / MFC c++ visual-studio

  • GetDirectory?
    S Sandeep Saini SRE

    Try

    char szCurrentDir[MAX_PATH];
    ::GetCurrentDirectory(MAX_PATH,szCurrentDir);//returns current directory

    C / C++ / MFC question com

  • Basic string manipulation question
    S Sandeep Saini SRE

    Its simple using CString class

    CString sEmail, sDomain;
    sEmail = "random@mail.com";
    int nPos = sEmail.Find("@");
    sDomain = sEmail.Mid(nPos + 1, sEmail.GetLength());
    
    C / C++ / MFC com question lounge

  • How to download only images from the webpage
    S Sandeep Saini SRE

    I want to down load only images from a webpage, please suggest. Thanks!

    C / C++ / MFC tutorial

  • call OnKillFoucus event of Edit box..............
    S Sandeep Saini SRE

    Simply map "OnKillFoucus" to the click event of button

    ON_BN_CLICKED(IDC_BUTTON, OnKillFoucus)

    C / C++ / MFC

  • String Problem
    S Sandeep Saini SRE

    Use ReverseFind() instead of Find().

    CString DirPath;
    CString FullPath = _T("C:\\abc\\cd\\as.txt");
    int nPos = FullPath.ReverseFind( _T('\\') );
    if( nPos >= 0 )
    {
    DirPath = FullPath.Mid( 0, nPos);
    }
    AfxMessageBox(DirPath);

    C / C++ / MFC help question

  • OpenDialog
    S Sandeep Saini SRE

    Here it is -

    CFileDialog dlg(TRUE);
    CString sPath = "c:\\program files\\my folder\\1.c";
    int nPos = sPath.Find("\\");
    nPos = sPath.Find("\\",nPos + 1);
    sPath = sPath.Left(nPos + 1);
    dlg.m_ofn.lpstrInitialDir = sPath;
    dlg.DoModal();

    C / C++ / MFC question c++

  • how to get a line of text file
    S Sandeep Saini SRE

    This function takes two parameters 1. first one is the path of file to be read. 2. second parametrs is the line number you want to get from the file.

    CString GetLine(CString sFileName, int nLineNumber)
    {
    CStdioFile Inputfile;
    CString sLine = _T("");
    CFileException FileExc;
    UINT nOpenFlags = CFile::modeRead;

    //OPen the file & load it into a CStdioFile object
    if (!Inputfile.Open(sFileName, nOpenFlags, &FileExc)) {
    FileExc.ReportError();
    return "Error";
    }

    //Reading line by line
    while(Inputfile.ReadString(sLine) && nCount < nLineNumber){
    	nCount++;
    }
    Inputfile.Close();
    

    return sLine;
    }

    C / C++ / MFC question help tutorial

  • save and load in XML
    S Sandeep Saini SRE

    This may help Don't forget to write this line :) #import <msxml.dll> // The XML DOM

    try
    {
    CString sQueryXML = "<start><sometag></sometag></end>";
    CString sFileName;
    sFileName.Format("%s","C:\\MyXml.xml");
    MSXML::IXMLDOMDocumentPtr pDoc(__uuidof(MSXML::DOMDocument));
    pDoc->async = false;
    pDoc->loadXML((LPCSTR) sQueryXML);
    pDoc->save((LPCSTR) sFileName);
    }
    catch(_com_error e)
    {
    ASSERT(false);
    }

    C / C++ / MFC c++ xml tutorial question

  • Using MySQl with VC++
    S Sandeep Saini SRE

    Ya definitely!

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

  • Using MySQl with VC++
    S Sandeep Saini SRE

    Simple 7 Steps :-D

    1)First of all import msado15.dll into your workspace

    #import "C:\Program Files\Common Files\System\ADO\msado15.dll" \
    no_namespace rename("EOF", "EndOfFile")

    2)Initialize COM libraries using

    CoInitialize(NULL);

    1. Create connection & record set pointers

    _ConnectionPtr pConn("ADODB.Connection");

    _RecordsetPtr pRst("ADODB.Recordset");

    1. Open data base

    #define STR_DATABASE L"DRIVER={sql server};SERVER=serverName;Database=datbaseName;" L"UID=sa; PWD=sa;"

    HRESULT hr = S_OK;

    hr = pConn->Open(STR_DATABASE, L"", L"", adOpenUnspecified);

    if(FAILED(hr))
    {
    AfxMessageBox ("Error instantiating Connection object\n");
    }

    5)Execute Query and read values

    try
    {
    CString strSQL(“Select * From MyTable”);
    pRst->Open( _variant_t(strSQL),_variant_t((IDispatch *) pConn, true),adOpenDynamic, adLockReadOnly,adCmdText);

    if(!pRst->EndOfFile){
    CString strValue = (char*)(_bstr_t)pRst->Fields->Item[“FieldName”]- >Value;

    int nValue = (long)pRst->Fields->Item[“FieldName”]->Value;

    // Here “FieldName” is the column name of table. You will get the value of this column in the corresponding variable.

    }

    catch(_com_error &ce)
    {
    AfxMessageBox(ce.ErrorInfo);
    OR
    AfxMessageBox(ce.Description());

    }

    6)Close connection and record set pointers

    if(pRst->State == adStateOpen)
    pRst->Close();
    if(pConn->State == adStateOpen)
    pConn->Close();

    7)UnInitialized COM library

    ::CoUninitialize();

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

  • Change Date format
    S Sandeep Saini SRE

    If you are talking about Date variable then you can get the desired format using -

    CString Date = "12/05/2008";
    CString YY,MM,DD;
    int nLen;

    nLen = Date.ReverseFind('/');
    YY = Date.Right(nLen - 1);
    Date = Date.Left(nLen);

    nLen = Date.ReverseFind('/');
    MM = Date.Right(nLen);
    Date = Date.Left(nLen);

    DD = Date;
    CString sNewDateFormat;
    sNewDateFormat.Format("%s/%s/%s",YY,MM,DD);

    And if you are talking about the variable Datee, then the code written by you is fine.

    C / C++ / MFC c++ help career

  • How to parse the string
    S Sandeep Saini SRE

    CString str = "http://server/sharanu/inbox/test.jpg";
    int i = str.ReverseFind('/');
    str = str.Left(i);
    CString sValue1 = str.Right(str.GetLength() - str.ReverseFind('/') -1);

    i = str.ReverseFind('/');
    str = str.Left(i);
    CString sValue2 = str.Right(str.GetLength() - str.ReverseFind('/') -1);

    C / C++ / MFC tutorial sysadmin help

  • Can I set timeout in IWebBrowser2 Navigate?
    S Sandeep Saini SRE

    Try this

    BOOL m_bReady = 0;
    BSTR bsStatus;
    CString str;

    m_pBrowser->Navigate2(vaURL,null,null,null,null) ;

    while(!m_bReady)
    {
    m_pBrowser->get_StatusText(&bsStatus);
    mStr = bsStatus;
    if(mStr == "Done") m_bReady=1;
    }

    C / C++ / MFC sysadmin question

  • Static Label Visible Problem
    S Sandeep Saini SRE

    if(label_has_certain_values_during_runtime)
    {
    GetDlgItem(IDC_STATIC_EMAIL)->ShowWindow(TRUE);
    }

    C / C++ / MFC c++ help tutorial

  • Extract images & banners from website
    S Sandeep Saini SRE

    Hi There, I want to extract images & banners with their redirecting URL from a website. I'm using IHTMLElementCollection to enumerate the HTML elements but still not able to get the redirecting URL of images & banners. If you need any further information/clarification please let me know. Thanks!

    C / C++ / MFC html
  • Login

  • Don't have an account? Register

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