Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Win 32 controls. No *.rc

I want to add controls to my win 32 app
without using resource files.

Assuming I did all the nesesery job for most basic window:
- wrote a basic Window Procedure
- wrote a basic winmain procedure
- declared WNDCLASS and initialised its filds,
- ::RegisterClass (&wndClass)
- hwnd = ::CreateWindow

I know I can use CreateWindow function to create multiple windows
but how do I make an edit box.
What layer of the os does this???
I imagine there is a function or a class to do this.

Any good tutorials/links on windows infrastructure?

Any help highly appreciated.

Comments

  • AsmGuru62AsmGuru62 Member Posts: 6,519
    [color=Blue]
    [link=http://msdn.microsoft.com/en-us/library/ms632680(VS.85).aspx]http://msdn.microsoft.com/en-us/library/ms632680(VS.85).aspx[/link]

    In description of 'lpClassName' there is a link "system class". It has a list of predefined classes, responsible for edit boxes, list boxes, etc. However, not all controls are listed there. If you need a tree view or list view or tab control - these class names are defined in "CommCtrl.h".
    [/color]
  • vlad777vlad777 Member Posts: 53
    I have put this code in:

    hwnd1 = ::CreateWindow (
    "EDIT", // name of a registered window class
    "A Real App", // window caption
    WS_CHILD | WS_VISIBLE ,// window style
    10, // x position
    10, // y position
    200, // witdh
    200, // height
    hwnd, // handle to parent window
    0, // handle to menu
    hInst, // application instance
    0); // window creation data

    Only the delete taster works and the edit box does not have border lines.Mouse marking works also.
  • AsmGuru62AsmGuru62 Member Posts: 6,519
    [color=Blue]See RED below. Each child window (with style WS_CHILD) must have non-zero child identifier. Instead of zero use some number with a type cast: "(HMENU) 101". If you have more controls created on the same hwnd use different IDs for each control: 102, 103, ... and so on. Also, into a list of styles add WS_BORDER style if you need a border. Also, you did not use the edit styles at all. These are defined as ES_xxx values (like ES_MULTILINE). Also, you might want to apply some nice font to the edit control - the system font is ugly.[/color]
    : [code]
    : hwnd1 = ::CreateWindow (
    : "EDIT", // name of a registered window class
    : "A Real App", // window caption
    : WS_CHILD | WS_VISIBLE ,// window style
    : 10, // x position
    : 10, // y position
    : 200, // witdh
    : 200, // height
    : hwnd, // handle to parent window
    : [color=Red]0, // handle to menu[/color]
    : hInst, // application instance
    : 0); // window creation data
    :
    : Only the delete taster works and the edit box does not have border
    : lines.Mouse marking works also.
    :
    [/code]
  • vlad777vlad777 Member Posts: 53
    hwnd1 = ::CreateWindow (
    "EDIT", // name of a registered window class
    "A Real App", // window caption
    WS_CHILD | WS_VISIBLE | WS_BORDER | ES_MULTILINE ,//win style
    10, // x position
    10, // y position
    200, // witdh
    200, // height
    hwnd, // handle to parent window
    (HMENU) 101, // handle to menu
    hInst, // application instance
    0); // window creation data

    Backspace and del key work with normal speed
    but when I press any of the character keys
    I get full edit box of it (even if multiline).
Sign In or Register to comment.