CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 1999
    Posts
    56

    how can I dynamically creat edit box control?

    I have a database project to finish. I have to dynamically create some edit box controls on a dialog box and the number of edit box controls
    depends on my input. Please help me! Thanks a lot!


  2. #2
    Join Date
    May 1999
    Posts
    29

    Re: how can I dynamically creat edit box control?

    Hi!
    U need to make use of the CreateWindow function to create the edit box dynamically.The prototype is :
    HWND CreateWindow( LPCTSTR lpClassName, // pointer to registered class name
    LPCTSTR lpWindowName, // pointer to window name
    DWORD dwStyle, // window style
    int x, // horizontal position of window
    int y, // vertical position of window
    int nWidth, // window width int nHeight, // window height
    HWND hWndParent, // handle to parent or owner window
    HMENU hMenu, // handle to menu or child-window identifier
    HANDLE hInstance, // handle to application instance
    LPVOID lpParam // pointer to window-creation data);

    Sample code for creating edit control dynamically :
    HWND hWnd;
    hWnd = ::CreateWindow("Edit","SampleEdit",ES_MULTILINE|WS_CHILD|WS_VISIBLE,20,40,100,30,this->m_hWnd,NULL,AfxGetApp()->m_hInstance,NULL);

    Regards,
    Sukanya Swaminathan
    Software Engineer
    Aditi Technologies
    Blore - 80
    URL : www.aditi.com



  3. #3
    Join Date
    Apr 1999
    Posts
    56

    Re: how can I dynamically creat edit box control?

    Hi, Sukanya Swaminathan,

    Thanks a lot for your help! It really works. So I can use the same method to dynamically create any control, right?


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured