Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



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

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 08-04-2009
Member
 
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
Quote:
# 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.

Reply With Quote
  #2  
Old 08-04-2009
Member
 
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.
Reply With Quote
  #3  
Old 08-04-2009
Member
 
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 ...
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Inserting a new class in a dialog box (win32 API)"
Thread Thread Starter Forum Replies Last Post
Upgrade Sony Ericsson Xperia Play Micro SD card from class 2 8GB to class 4 32GB Aaryan2011 Portable Devices 8 08-10-2011 11:06 PM
How to use Dialog.AccessibleAWTDialog class? Jagruti23 Software Development 5 23-02-2010 01:38 PM
How to initialize a derived class with an instance of the base class in c#? KAIRU26 Software Development 5 12-02-2010 05:23 PM
Ultra solid drives:Imation M-Class and S-Class Regina Portable Devices 1 03-04-2009 10:34 AM
Good news for CBSE CLASS X & CLASS IX - visit learnnext surya_expert Education Career and Job Discussions 0 13-12-2008 11:09 AM


All times are GMT +5.5. The time now is 09:33 PM.