Thread: CreateWindowEx(...) help

  1. #1
    Registered User Dohojar's Avatar
    Join Date
    Feb 2002
    Posts
    115

    CreateWindowEx(...) help

    I was wondering if anyone could tell me why it is this function will return an invalid handle to a window (child or parent). I wrote this code and the hCancel variable keeps returning a NULL handle. I can see no reason for it. If anyone can tell me why windows does this, please let me know. This is not the first time I have had this stupid error but it is the first time I got it from a child window. Anyways here is the code in an attached file. Any help is appreciated.


    Dohojar Moajbuj
    Time is the greatest teacher, too bad it kills all its students

  2. #2
    brainless
    Guest
    I don't think that there is any window class called 'CancelButton'. Why don't you just use the 'button' window class.

  3. #3
    brainless
    Guest
    P.S. GetLastError() and FormatMessage() are your friends.

  4. #4
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    Review the CreateWindowEx() function. The second parameter is a registered Windows class. Unless you have previously registered a class called "CancelButton", windows will not find it and correctly fail. I suspect you want "button" in there.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  5. #5
    Registered User Dohojar's Avatar
    Join Date
    Feb 2002
    Posts
    115
    I changed the "Cancel Button" to just "button" and it works fine now..... so I take it there is a class called button?
    Thanks for all the help guys. it is appreciated.
    Dohojar Moajbuj
    Time is the greatest teacher, too bad it kills all its students

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. CreateWindowEx() failing with 64-bit
    By domokato in forum Windows Programming
    Replies: 7
    Last Post: 07-02-2009, 07:30 PM
  2. CreateWindowEx - GetLastError() = 6
    By cboard_member in forum Windows Programming
    Replies: 9
    Last Post: 04-20-2006, 08:29 AM
  3. Button handler
    By Nephiroth in forum Windows Programming
    Replies: 8
    Last Post: 03-12-2006, 06:23 AM
  4. Having Trouble with CreateWindowEx
    By Eber Kain in forum Windows Programming
    Replies: 10
    Last Post: 06-05-2004, 07:45 AM
  5. Beginner Question: CreateWindowEx Fails.
    By dicky in forum Windows Programming
    Replies: 4
    Last Post: 05-30-2004, 08:56 AM