I need some win32 tuts >.>

This is a discussion on I need some win32 tuts >.> within the Windows Programming forums, part of the Platform Specific Boards category; Well, I have been using theForgers win32 api tutorials, but I dislike like how it takes you through creating a ...

  1. #1
    Registered User
    Join Date
    Feb 2006
    Posts
    71

    I need some win32 tuts >.>

    Well, I have been using theForgers win32 api tutorials, but I dislike like how it takes you through creating a MDI editor for a tutorial on using controls etc.... I also use msdn as a reference (which I love =/ ).

    Also, once I have created a edit box, I want to be able to insert text in it by clicking on stuff(such as a button). Basically was wondering how I could edit my edit box by receiving a message. Also to make it so you can't type in it.

    would I do something like this:

    Code:
    WM_COMMAND:
    //bleh
    
    switch(HIWORD(wParam)
    {
        BN_CLICKED:
        
        HWND hEdit;
        hEdit = CreateWindowEx(/*bleh*/);
    }
    break;
    basically, re-create my edit box through the BN_CLICKED message?


    EDIT:

    I just realized I dont want to do that, then it would completely create a new edit box over the old one.... =/ can someone explain to me what I should be doing?
    Last edited by Homunculus; 02-07-2006 at 03:13 PM.

  2. #2
    Registered User
    Join Date
    Feb 2006
    Posts
    71
    WOOT i figured out how =D.... I was just messing around ... and came up with this:
    Code:
                        case BN_CLICKED:
                             char array[]="WOOOOOoO";
                             
                             SendMessage(GetDlgItem(hwnd,IDC_MAIN_EDIT),WM_SETTEXT,0,(LPARAM)array);
                        break;

  3. #3
    Registered User
    Join Date
    Feb 2006
    Posts
    71

    Sorry for all these posts in a row =/

    I didnt want to create a whole new topic so.... anyways... i made a for loop in my BN_CLICKED message... and i've been trying to get it to print out 1-100 when I click on it to the edit box... but instead its just writing 100.... here is my code:

    Code:
                    switch(HIWORD(wParam))
                    {
                        case BN_CLICKED:
                             int x;
                             for(x = 0; x <= 100; x++)
                             {
                             SetDlgItemInt(hwnd,IDC_MAIN_EDIT,x,true);
                             }
                        break;
                    }
    again, sorry for multiple posts.

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    Each time you set the text, any text already in the edit is cleared.

    So it is adding the numbers 0-100 but you only see the last value, 100.

    For your example you want to;

    get the current text (GetDlgItemText)
    add the new text to the buffer (ensure it is big enough!)
    set the text in the edit


    OR

    add all required text to a buffer (ensure it is big enough!)
    set the edits text

    OR
    use a replace function like EM_REPLACESEL. Search here for code, some has been posted recently (week or so ago)

    >>Also to make it so you can't type in it.

    Look at 'Edit Control styles'. Add these in the resource editor or when you create the control.

    ie ES_READONLY
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  5. #5
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    Edit: novacain got there first.

    You put 1, 2, 3, ..., 98, 99, 100 in the edit box faster than you could see. You want to append text to the edit control. See this FAQ entry about appending text to an edit control: Windows SDK Edit Control: How to append text to an edit control You can make an alternate solution for appending integers
    Last edited by Tonto; 02-07-2006 at 07:06 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Win32 API or Win32 SDK?
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 07-20-2005, 04:26 PM
  2. Win32 Thread Object Model Revisted
    By Codeplug in forum Windows Programming
    Replies: 5
    Last Post: 12-15-2004, 08:50 AM
  3. OLE Clipboard :: Win32 API vs. MFC
    By kuphryn in forum Windows Programming
    Replies: 3
    Last Post: 08-11-2002, 06:57 PM
  4. Thread Synchronization :: Win32 API vs. MFC
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 08-09-2002, 10:09 AM
  5. Win32 API Tutorials?
    By c++_n00b in forum C++ Programming
    Replies: 9
    Last Post: 05-09-2002, 04:51 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21