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
V

Vikram Kashyap

@Vikram Kashyap
About
Posts
20
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Only Numeric value in Edit Box
    V Vikram Kashyap

    hi.. You need to derive a new class using CEdit as the base class. There you can code either OnKeydown() or OnChar(, or PreTranslateMessage() message to suit your needs. For PreTranslateMessage() here is the code...Hope it'll help you BOOL CMyEdit::PreTranslateMessage(MSG* pMsg) { if(pMsg->message == WM_KEYDOWN ) { int nVirtKey = (int) pMsg->wParam; if(nVirtKey >= 97 && nVirtKey <= 122) //For Lower Case { MessageBox("Cannot enter alphabets"); } if(nVirtKey >= 65 && nVirtKey <= 90) //For Upper Case { MessageBox("Cannot enter alphabets"); } } return CEdit::PreTranslateMessage(pMsg); } Bye... :rolleyes: Vikram Kashyap "You will never fail until you stop trying"

    C / C++ / MFC question

  • Help me...
    V Vikram Kashyap

    Hi... I think you probably need to ship the supporting DLL's also required by your application. Check the Dll name that is appearing in the message box when u try to execute the application. Bye... Vikram Kashyap "You will never fail until you stop trying"

    C / C++ / MFC help csharp c++ visual-studio announcement

  • Only Numeric value in Edit Box
    V Vikram Kashyap

    Hi, You run a loop and check the ASCII value of the charter entered into that edit box. If the value is falling between 97 - 122 (means user is trying to enter some alphabets using lower case), if the value is falling between 65 - 90 (means user is trying to enter some alphabets using upper case). Here you can give the appropriate message. Bye.... :rolleyes:

    C / C++ / MFC question

  • Splash screen
    V Vikram Kashyap

    Hi, Click on "Project" in the main menu bar. Select Add To Project->Components and Controls. Select Visual C++ Components from the Components and Controls Gallery Dialog box and click on Splash Screen and finally click on "Insert" button. Sit back and relax, rest is done by MFC for you. You just need to design the bitmap for ur Splash Screen. :laugh: Vikram Kashyap "You will never fail until you stop trying"

    C / C++ / MFC c++ question

  • OnSize() Member function
    V Vikram Kashyap

    Hi You have not talked about any gap in the first phase, where u r coloring the control to give it a normal look. Which gap r u talking about, Please explain properly... :confused: Vikram Kashyap "You will never fail until you stop trying"

    C / C++ / MFC help

  • linking a microsoft access database to a vc++ program
    V Vikram Kashyap

    Hi, If you are using MFC, then u can use the following code to connect to access database. BOOL CMyDatabaseTesting::ConnectToDatabase() { if(!m_pdb) m_pdb = new CDatabase; CString StrConnectString; try { //Two Methods of connecting //1. Through the database path as described below //2. Using DSN, i.e, "DSN=szDSN;UID=szUsername;PWD=szPassword; StrConnectString.Format("Driver={Microsoft Access Driver (*.mdb)};Dbq=%s;UID=%s;PWD=%s",strDBPath/*Contains the database path*/, "Admin",szPassword/*Password of database (fi any)*/); m_pdb->OpenEx(StrConnectString,CDatabase::noOdbcDialog); } catch(CDBException *e) { if(e->m_strError.Find("Login failed") != -1) { MessageBox(0, e->m_strError, "Error1", MB_OK); return FALSE; } else if((e->m_strError.Find("Server user id") != -1) && (e->m_strError.Find("is not a valid user in database") != -1)) { MessageBox(0, e->m_strError, "Error2", MB_OK); return FALSE; } else if(e->m_strError.Find("Data source name not found and no default driver specified") != -1) { MessageBox(0, e->m_strError, "Error3", MB_OK); e->Delete(); if(m_pdb) { if(m_pdb->IsOpen()) m_pdb->Close(); delete m_pdb; m_pdb = NULL; } return FALSE; } else { //Database related error MessageBox(0, e->m_strError, "Database Error", MB_OK); return FALSE; } if(m_pdb) { if(m_pdb->IsOpen()) m_pdb->Close(); delete m_pdb; m_pdb = NULL; } e->Delete(); return FALSE; } return TRUE; } Where m_pdb is a pointer to CDatabase. Also don't forget to include in stdafx.h file. That's it, you are connect to the database. Enjoy... :wtf: Vikram Kashyap "You will never fail until you stop trying"

    C / C++ / MFC c++ database tutorial question

  • access CMainFrame?
    V Vikram Kashyap

    Hello Use the folowing code to access the CMainFrame members ((CMainFrame *)AfxGetMainWnd())->Use the member functions defined in CMainFrame; ;P:wtf::rose:;P Vikram Kashyap "You will never fail until you stop trying"

    C / C++ / MFC question

  • Add -ins
    V Vikram Kashyap

    Hi, This can be achieved using automation...so try looking for some automation on net. You will good sample projects here on CP also... Vikram Kashyap "You will never fail until you stop trying"

    C / C++ / MFC com help learning

  • How to set Shortcutkeys for Toolbar buttons?
    V Vikram Kashyap

    Hi, Yes, you need to load that Accelerator table. HACCEL gAccel; //Declare in header file //Add this code to the OnInItDialog of your dialog class gAccel = LoadAccelerators(AfxGetApp()->m_hInstance,MAKEINTRESOURCE(IDR_MYACCEL)); //Add this code to PreTranslateMessage if(TranslateAccelerator(AfxGetMainWnd()->m_hWnd,gAccel,pMsg)) return FALSE; This should work.... Thanx and Bye Vikram Kashyap "You will never fail until you stop trying"

    C / C++ / MFC tutorial question

  • How to set Shortcutkeys for Toolbar buttons?
    V Vikram Kashyap

    Hi, Create the accelerators for the toolbar buttons using the resource editor... Vikram Kashyap "You will never fail until you stop trying"

    C / C++ / MFC tutorial question

  • using installshield
    V Vikram Kashyap

    Hi, You need to first check the components entry in the registry using the functions provided by InstallShield for registry. Thanx Vikram Kashyap "You will never fail until you stop trying"

    IT & Infrastructure

  • Prblm with SDI
    V Vikram Kashyap

    Hello, You can simply take the handle of the SystemMenu using GetSystemMenu and remove the Move menu. The code goes like this... void CMainFrame::DisableMoveWindow() { CMenu* pSysMenu = GetSystemMenu(FALSE); if (pSysMenu != NULL) { pSysMenu->RemoveMenu(1, MF_BYPOSITION); } } Call this function in the OnCreate of CMainFrame() ;) Vikram Kashyap "You will never fail until you stop trying"

    C / C++ / MFC help tutorial

  • Picture Control
    V Vikram Kashyap

    Hi,;) Yes, Certainly you can change the bitmap at run time during the MOUSEMOVE or on LBUTTONDOWN. Let's take the example of MOUSEMOVE void CMouseDlg::OnMouseMove(UINT nFlags, CPoint point) { m_Image.GetWindowRect(&rect); ClientToScreen(&point); if(rect.PtInRect(point)) { m_Image.SetBitmap(m_Bitmap1); } else { m_Image.SetBitmap(m_Bitmap2); } CDialog::OnMouseMove(nFlags, point); } Here m_Image is the control type variable of Image control created using Class Wizard and rect is CRect object. // m_Image.GetWindowRect(&rect); Extract the image control co-ordinates in a rect object. // ClientToScreen(&point); ClientToScreen is used to convert the client coordinates of a given point or rectangle on the display to screen coordinates. Next step is to check whether these points fall under the area where our image is place on the screen using PtInRect. If yes, then change the bitmap to whatever. m_Bitmap1 and m_Bitmap2 are twom CBitmap type objects defined in the header file. That's it...you r on ur way to change the bitmaps at runtime Vikram Kashyap "You will never fail until you stop trying"

    C / C++ / MFC question graphics learning

  • CTreeCtrl Speeding issue
    V Vikram Kashyap

    Hi, the code snippet... void CInsertBookmark::LoadTreeItems() { BeginWaitCursor(); m_pTree.SetRedraw(FALSE); //Works fine in case of lesser records CString BookMarkType, BookMarkPath, BookMarkName; BookMarkType.Empty(); BookMarkPath.Empty(); BookMarkName.Empty(); CString TempPath; TempPath.Empty(); HSTMT hstmt; SDWORD len = SQL_NTS; RETCODE rc; char m_BookMark_Node_Path[256]; char m_BookMark_Node_Name[256]; char m_BookMark_Type[256]; int nIndex = 0; strTemp.Format("SELECT BookMark_Node_Path, " "BookMark_Node_Name, " "BookMark_Type " "FROM BookMark " "ORDER BY BookMark_Node_Path"); SQLAllocStmt(m_pdb->m_hdbc , &hstmt); SQLBindCol(hstmt,1, SQL_C_CHAR, &m_BookMark_Node_Path , sizeof(m_BookMark_Node_Path), &len); SQLBindCol(hstmt,2, SQL_C_CHAR, &m_BookMark_Node_Name , sizeof(m_BookMark_Node_Name), &len); SQLBindCol(hstmt,3, SQL_C_CHAR, &m_BookMark_Type , sizeof(m_BookMark_Type) , &len); if (SQLExecDirect(hstmt, (UCHAR*)(LPCTSTR)strTemp, SQL_NTS) == SQL_ERROR) { DisplayErrorMsg(&hstmt); SQLFreeStmt (hstmt, SQL_DROP); return ; } while(TRUE) { rc = SQLFetch(hstmt); if(rc == SQL_ERROR) { DisplayErrorMsg(&hstmt); SQLFreeStmt (hstmt, SQL_DROP); return ; } else if(rc == SQL_NO_DATA_FOUND) break; BookMarkPath.Empty(); BookMarkPath.Format("%s",m_BookMark_Node_Path); BookMarkType.Empty(); BookMarkType.Format("%s",m_BookMark_Type); BookMarkName.Empty(); BookMarkName.Format("%s",m_BookMark_Node_Name); if(BookMarkType.CompareNoCase("Folder") == 0) { m_pTree.Initialize(true); HTREEITEM hItem = m_pTree.GetNext(); while (hItem != NULL) { m_pTree.SelectItem(hItem); TempPath = GetPathFromItem(hItem) ; if(TempPath.Compare(BookMarkPath) == 0) { //Inserting items into tree ctrl m_pTree.InsertItem(_T(BookMarkName), ILI_CLSDFLD, ILI_OPENFLD, hItem, TVI_SORT); BookMarkPath.Empty(); BookMarkType.Empty(); break; } else hItem= m_pTree.GetNext(); } } if(BookMarkType.CompareNoCase("BookMark") == 0) { m_pTree.Initialize(true); HTREEITEM hItem= m_pTree.GetNext(); while (hItem != NULL) { m_pTree.SelectItem(hItem); TempPath = GetPathFromItem(hItem); if( TempPath.Compare(BookMarkPath) == 0) { //Inserting items into tree ctrl m_pTree.InsertItem(

    C / C++ / MFC help database

  • CTreeCtrl Speeding issue
    V Vikram Kashyap

    :rose: Hi Friends, I've a treectrl on a dialog based application which gets populated from ms-access database containing some 2000 records in OnInItDialog. To fetch the data, i am simply using the SQLFetch and inserting it using a while loop in treectrl using InsertItem, but it takes too much of time. Can anybody help me in speeding up my treectrl. The fields in my database are "BookmarkName", "BookmarkType" where Bookmark name is the bookmark name and BookmarkType is either "Folder" or "Bookmark" and Bookmarks are added as child in Folders. Vikram Kashyap "You will never fail, until u stop trying"

    C / C++ / MFC help database

  • how to make MSDN-like help file?
    V Vikram Kashyap

    ;P Hi, Use HTML Help Workshop for VC++. Hope this will help u. Gives the same look and feel as that of MSDN. Vikram Kashyap "You will never fail, until u stop trying"

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

  • SetWindowText
    V Vikram Kashyap

    ;P Fetch the content in a CString type variable and then use the TrimRight() function with no parameters. When used with no parameters, TrimRight removes trailing newline, space, and tab characters from the string. Vikram Kashyap "You will never fail, until you stop trying"

    C / C++ / MFC help

  • SetWindowText
    V Vikram Kashyap

    ;P Fetch the content in a CString type variable and then use the TrimRight() function with no parameters. When used with no parameters, TrimRight removes trailing newline, space, and tab characters from the string. Vikram Kashyap "You will never fail until you stop trying"

    C / C++ / MFC help

  • Get the x and y pixelsize of the screen?
    V Vikram Kashyap

    ;P Use this one... int cx = GetSystemMetrics(SM_CXSCREEN); // return the width in pixels int cy = GetSystemMetrics(SM_CYSCREEN); // return the height in pixels Vikram Kashyap Sr. Software Engineer TechBooks International R&D Division

    C / C++ / MFC question tutorial

  • General Dialog Size Question
    V Vikram Kashyap

    Hi, You can simply use MoveWindow(int x, int y, int nWidth, int nHeight, BOOL bRedraw = FALSE) on the click on 'More Settings' button and expand/collapse the dialog using required width and height. This will solve ur problem. Vikram Kashyap Sr. Software Engineer TechBooks International R&D Division

    C / C++ / MFC question lounge
  • Login

  • Don't have an account? Register

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