www.digitalmars.com         C & C++   DMDScript  

c++ - Windows control classes fails

reply john <john_member pathlink.com> writes:
When i use non standard Windows control classes like "SysListView32" or
"msctls_progress32" the dialogbox function fails and return -1

Works fine with standard control like edit, button, combobox,...
Whats wrong ?


here a sample of my rc file :

/* ares.rc file */
#pragma res32
#include <windows.h>
#include "ares.h"


DLG_100 DIALOGEX 58, 28, 247, 189
STYLE DS_CENTER | DS_3DLOOK | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_STATICEDGE
CAPTION "ACAPTION"
FONT 8, "MS Sans Serif"
BEGIN
CONTROL "caption", 101, "SysListView32", 0x241 | WS_BORDER, 83, 35, 70, 70
END

/* EOF */
Jul 04 2003
parent reply "Matthew Wilson" <matthew stlsoft.org> writes:
Are you calling InitCommonControls() ?

"john" <john_member pathlink.com> wrote in message
news:be3k99$1th4$1 digitaldaemon.com...
 When i use non standard Windows control classes like "SysListView32" or
 "msctls_progress32" the dialogbox function fails and return -1

 Works fine with standard control like edit, button, combobox,...
 Whats wrong ?


 here a sample of my rc file :

 /* ares.rc file */
 #pragma res32
 #include <windows.h>
 #include "ares.h"


 DLG_100 DIALOGEX 58, 28, 247, 189
 STYLE DS_CENTER | DS_3DLOOK | WS_POPUP | WS_CAPTION | WS_SYSMENU
 EXSTYLE WS_EX_STATICEDGE
 CAPTION "ACAPTION"
 FONT 8, "MS Sans Serif"
 BEGIN
 CONTROL "caption", 101, "SysListView32", 0x241 | WS_BORDER, 83, 35, 70, 70
 END

 /* EOF */
Jul 04 2003
parent reply John <John_member pathlink.com> writes:
Yes, like this :


int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{

void InitCommonControls();

DialogBox(hInstance,MAKEINTRESOURCE(DLG_100),NULL,MyProc);

return 0;
}





In article <be3raq$246j$1 digitaldaemon.com>, Matthew Wilson says...
Are you calling InitCommonControls() ?

"john" <john_member pathlink.com> wrote in message
news:be3k99$1th4$1 digitaldaemon.com...
 When i use non standard Windows control classes like "SysListView32" or
 "msctls_progress32" the dialogbox function fails and return -1

 Works fine with standard control like edit, button, combobox,...
 Whats wrong ?


 here a sample of my rc file :

 /* ares.rc file */
 #pragma res32
 #include <windows.h>
 #include "ares.h"


 DLG_100 DIALOGEX 58, 28, 247, 189
 STYLE DS_CENTER | DS_3DLOOK | WS_POPUP | WS_CAPTION | WS_SYSMENU
 EXSTYLE WS_EX_STATICEDGE
 CAPTION "ACAPTION"
 FONT 8, "MS Sans Serif"
 BEGIN
 CONTROL "caption", 101, "SysListView32", 0x241 | WS_BORDER, 83, 35, 70, 70
 END

 /* EOF */
Jul 04 2003
parent reply "Matthew Wilson" <matthew stlsoft.org> writes:
You've made a declaration, not a call. Remove the "void" and it should work

"John" <John_member pathlink.com> wrote in message
news:be3u40$26vk$1 digitaldaemon.com...
 Yes, like this :


 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
 LPSTR lpCmdLine, int nCmdShow)
 {

 void InitCommonControls();

 DialogBox(hInstance,MAKEINTRESOURCE(DLG_100),NULL,MyProc);

 return 0;
 }





 In article <be3raq$246j$1 digitaldaemon.com>, Matthew Wilson says...
Are you calling InitCommonControls() ?

"john" <john_member pathlink.com> wrote in message
news:be3k99$1th4$1 digitaldaemon.com...
 When i use non standard Windows control classes like "SysListView32" or
 "msctls_progress32" the dialogbox function fails and return -1

 Works fine with standard control like edit, button, combobox,...
 Whats wrong ?


 here a sample of my rc file :

 /* ares.rc file */
 #pragma res32
 #include <windows.h>
 #include "ares.h"


 DLG_100 DIALOGEX 58, 28, 247, 189
 STYLE DS_CENTER | DS_3DLOOK | WS_POPUP | WS_CAPTION | WS_SYSMENU
 EXSTYLE WS_EX_STATICEDGE
 CAPTION "ACAPTION"
 FONT 8, "MS Sans Serif"
 BEGIN
 CONTROL "caption", 101, "SysListView32", 0x241 | WS_BORDER, 83, 35, 70,
70
 END

 /* EOF */
Jul 04 2003
parent reply john <john_member pathlink.com> writes:
OK , I just forgot to link comctl32.lib.

But thanks.


In article <be3vft$2862$1 digitaldaemon.com>, Matthew Wilson says...
You've made a declaration, not a call. Remove the "void" and it should work

"John" <John_member pathlink.com> wrote in message
news:be3u40$26vk$1 digitaldaemon.com...
 Yes, like this :


 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
 LPSTR lpCmdLine, int nCmdShow)
 {

 void InitCommonControls();

 DialogBox(hInstance,MAKEINTRESOURCE(DLG_100),NULL,MyProc);

 return 0;
 }





 In article <be3raq$246j$1 digitaldaemon.com>, Matthew Wilson says...
Are you calling InitCommonControls() ?

"john" <john_member pathlink.com> wrote in message
news:be3k99$1th4$1 digitaldaemon.com...
 When i use non standard Windows control classes like "SysListView32" or
 "msctls_progress32" the dialogbox function fails and return -1

 Works fine with standard control like edit, button, combobox,...
 Whats wrong ?


 here a sample of my rc file :

 /* ares.rc file */
 #pragma res32
 #include <windows.h>
 #include "ares.h"


 DLG_100 DIALOGEX 58, 28, 247, 189
 STYLE DS_CENTER | DS_3DLOOK | WS_POPUP | WS_CAPTION | WS_SYSMENU
 EXSTYLE WS_EX_STATICEDGE
 CAPTION "ACAPTION"
 FONT 8, "MS Sans Serif"
 BEGIN
 CONTROL "caption", 101, "SysListView32", 0x241 | WS_BORDER, 83, 35, 70,
70
 END

 /* EOF */
Jul 04 2003
parent "Matthew Wilson" <matthew stlsoft.org> writes:
You're welcome.

However, linking would not have made a difference (which is obvious from the
fact that you didn't get a link error), because

int f1()
{
  int f2();

 return 0;
}

is a function f1() within which is a declaration for a function f2(), _not_
a call to f2(). This is termed, by Scott Meyers, as C++'s vexing parse.

In any case, glad to be of help.

:)

"john" <john_member pathlink.com> wrote in message
news:be4v1d$a72$1 digitaldaemon.com...
 OK , I just forgot to link comctl32.lib.

 But thanks.


 In article <be3vft$2862$1 digitaldaemon.com>, Matthew Wilson says...
You've made a declaration, not a call. Remove the "void" and it should
work
"John" <John_member pathlink.com> wrote in message
news:be3u40$26vk$1 digitaldaemon.com...
 Yes, like this :


 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
 LPSTR lpCmdLine, int nCmdShow)
 {

 void InitCommonControls();

 DialogBox(hInstance,MAKEINTRESOURCE(DLG_100),NULL,MyProc);

 return 0;
 }





 In article <be3raq$246j$1 digitaldaemon.com>, Matthew Wilson says...
Are you calling InitCommonControls() ?

"john" <john_member pathlink.com> wrote in message
news:be3k99$1th4$1 digitaldaemon.com...
 When i use non standard Windows control classes like "SysListView32"
or
 "msctls_progress32" the dialogbox function fails and return -1

 Works fine with standard control like edit, button, combobox,...
 Whats wrong ?


 here a sample of my rc file :

 /* ares.rc file */
 #pragma res32
 #include <windows.h>
 #include "ares.h"


 DLG_100 DIALOGEX 58, 28, 247, 189
 STYLE DS_CENTER | DS_3DLOOK | WS_POPUP | WS_CAPTION | WS_SYSMENU
 EXSTYLE WS_EX_STATICEDGE
 CAPTION "ACAPTION"
 FONT 8, "MS Sans Serif"
 BEGIN
 CONTROL "caption", 101, "SysListView32", 0x241 | WS_BORDER, 83, 35,
70,
70
 END

 /* EOF */
Jul 04 2003