Results 1 to 3 of 3

Thread: Inserting a new class in a dialog box (win32 API)

  1. #1
    Join Date
    Feb 2009
    Posts
    78

    Inserting a new class in a dialog box (win32 API)

    Hello to all,

    As written in the title, I use the win32 API EXCLUSIVELY to create my application (not MFC).

    My problem is to create a dialog box, then insert a new component, ie a HWND that would call for a new class WNDCLASS with its own callback.

    I have therefore two callback, one for the dialog box and one for my new code.So I wrote the following code:

    Code:
    # include "resource.h" 
      # include <windows.h> 
      # include <commctrl.h> 
      # include <richedit.h> 
    
    
      / / 
      / / Dialog resources 
      / / 
      IDD_DIALOG1 DIALOG 0, 0, 275, 222 
      STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_VISIBLE | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP | WS_SYSMENU 
      CAPTION "Dialog" 
      FONT 8, "MS Shell Dlg 2" 
      BEGIN 
          DEFPUSHBUTTON "OK" idők, 220, 203, 50, 14 
          PUSHBUTTON "Cancel", IDCANCEL, 165, 203, 50, 14 
          PUSHBUTTON "Load ...", IDC_BUTTON1, 220, 184, 50, 14 
          EDITTEXT IDC_EDIT1, 5, 184, 210, 14, ES_AUTOHSCROLL 
          CONTROL "", IDC_SLIDER1, TRACKBAR_CLASS, WS_TABSTOP | TBS_BOTH | TBS_NOTICKS, 5, 133, 210, 15 
      END
    # ifndef IDC_STATIC
    # define IDC_STATIC (-1)
    # endif

    # define IDD_DIALOG1 100
    # define IDC_SLIDER1 1000
    # define IDC_BUTTON1 1001
    # define IDC_EDIT1 1002
    # define IDC_CUSTOM1 1003
    But then, my dialog box does not my new component and the program enters an infinite loop, it's very disappointing ...

    I think the problem comes from the callback of the dlg that returns TRUE when it should return FALSE or vice versa, but I am not of course me ... I tried different configuration of TRUE or FALSE in my switch (uMsg), but I do not get better results.

    So, if anyone can tell me how I do that I will be very grateful.

    Thank you.

  2. #2
    Join Date
    Dec 2008
    Posts
    161

    Re: Inserting a new class in a dialog box (win32 API)

    Hello,

    Already a DLGPROC returns a INT_PTR not a lResult, so change it and remove your cast function pointer.
    Then, only a DLGPROC should return TRUE or FALSE (and for all messages untreated, it should return FALSE). One must call DefWindowProc WndProc ().
    dAreaProc () is a WndProc.
    We must add a 1 in hbrBackground
    What does your loop before the loop messages?
    Loop for your message, you must verify that getMessage () is greater than zero, not only different.
    This allows you to leave the loop on error.

  3. #3
    Join Date
    Feb 2009
    Posts
    78

    Re: Inserting a new class in a dialog box (win32 API)

    I made the changes you told me to do and my window is not displayed yet ... I have no infinite loop (since I retired, sorry again... ), But I should see a window open in my DialogBox, since I do a CreateWindowEx in WM_INITDIALOG my box ...

Similar Threads

  1. Replies: 8
    Last Post: 08-10-2011, 11:06 PM
  2. How to use Dialog.AccessibleAWTDialog class?
    By Jagruti23 in forum Software Development
    Replies: 5
    Last Post: 23-02-2010, 02:38 PM
  3. Replies: 5
    Last Post: 12-02-2010, 06:23 PM
  4. Ultra solid drives:Imation M-Class and S-Class
    By Regina in forum Portable Devices
    Replies: 1
    Last Post: 03-04-2009, 10:34 AM
  5. Good news for CBSE CLASS X & CLASS IX - visit learnnext
    By surya_expert in forum Education Career and Job Discussions
    Replies: 0
    Last Post: 13-12-2008, 12:09 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,649,557.98942 seconds with 17 queries