Thread: Re: [Dev-C++] DialogBox returns -1
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: metalseb <met...@fr...> - 2002-09-19 10:56:51
|
Hi Vlada You should check out which button was pressed pressed inside the "about" dialog box in its own message loop processing. Reading the Win32 API doc, DialogBox does not return the value of the button you pressed but the value returned by the EndDialog API call inside the message loop You also say that ret is equal to -1. It indicates that the DialogBox failed. That's why it doesn't display anything. If you want, just send me your full code, I will check and post an explanation here just after. Kind regards -- Seb |
|
From: metalseb <met...@fr...> - 2002-09-19 17:00:10
|
Good evening Djura Hummm, just tried your code and it works without any problem here... Did you try to compile by a "make clean" (CTRL-F11) to get sure that all files, including resources were parsed and compiled together ? Just replaced the IDC_STATIC flag by -1 of the groupbox and the ctext because Windres showed me a parse error with this in my 4.9.4.1 package. Forget what I said regarding the return value of DialogBox. In the chunk of code you showed this afternoon, there was no way of knowing you were sending the ID of the pressed button as return var from the EndDialog call.... Sorry for any misunderstanding ! If you have any further questions, feel free to email me Kind regards -- Seb |
|
From: Vlada D. <dj...@im...> - 2002-09-20 10:20:17
|
Hi,metalseb I just tried your advice and it works. Thanks! I just don't understand why I had to replace IDC_STATIC with -1? And another question: does anybody know if there is some kind of manual on DevC++ or Win32 API(except MSDN)? Regards, Djura -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of metalseb Sent: cetvrtak, 19. septembar 2002 19:02 To: Vlada Djurovic; devcpp mailing list Subject: RE: [Dev-C++] DialogBox returns -1 Good evening Djura Hummm, just tried your code and it works without any problem here... Did you try to compile by a "make clean" (CTRL-F11) to get sure that all files, including resources were parsed and compiled together ? Just replaced the IDC_STATIC flag by -1 of the groupbox and the ctext because Windres showed me a parse error with this in my 4.9.4.1 package. Forget what I said regarding the return value of DialogBox. In the chunk of code you showed this afternoon, there was no way of knowing you were sending the ID of the pressed button as return var from the EndDialog call.... Sorry for any misunderstanding ! If you have any further questions, feel free to email me Kind regards -- Seb ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
|
From: metalseb <met...@fr...> - 2002-09-19 17:01:00
|
Good evening Djura Hummm, just tried your code and it works without any problem here... Did you try to compile by a "make clean" (CTRL-F11) to get sure that all files, including resources were parsed and compiled together ? Just replaced the IDC_STATIC flag by -1 of the groupbox and the ctext because Windres showed me a parse error with this in my 4.9.4.1 package. Forget what I said regarding the return value of DialogBox. In the chunk of code you showed this afternoon, there was no way of knowing you were sending the ID of the pressed button as return var from the EndDialog call.... Sorry for any misunderstanding ! If you have any further questions, feel free to email me Kind regards -- Seb |
|
From: metalseb <met...@fr...> - 2002-09-20 13:53:28
|
Hi Djura >I just tried your advice and it works. Glad to see it's ok now. >I just don't understand >why I had to replace IDC_STATIC with -1? Well, that's because from Windres' view, IDC_STATIC is unknown and is considered as a label which must be defined in the include file corresponding with the resource one. Like this : #define IDC_STATIC 2000 or everything else. But when I design a GUI, each time I know a static element won't be used by the program, I set its ID to -1. >anybody know if there is some kind of manual on DevC++ or Win32 >API(except MSDN)? Well, there is an online manual for DevC++ on bloodhed's site I think. Regarding Win32 API, I suggest you to buy the MS SDK CDROM online on MSDN. It costs USD 17 for anybody which lives in Europe and it is a *must buy* for anybody who wants to develop anything on Win platforms. This CD is worth hundreds of Euros in programming books, if you can find any nowadays on plain Win32 API programming, so sad.... But if you need a good start, just check out Forger's tutorial (Grab the URL using Google, haven't got it on this computer now) and find the basic "win32.hlp" file anywhere else. Kind regards -- Seb |
|
From: Abhijit S. <mu...@gm...> - 2002-09-20 16:19:45
|
> >I just don't understand > >why I had to replace IDC_STATIC with -1? > > Well, that's because from Windres' view, IDC_STATIC is unknown and is considered as a label > which must be defined in the include file corresponding with the resource one. > Actually, it's defined in <winuser.h>, so you can use it if you've #include'd <windows.h>, but it is worth knowing that it's -1. ___________________________________________________________ Abhijit Shylanath E-mail: mu...@gm... || ibr...@bi... Web-site: http://mudeth.tripod.com/ |
|
From: Vlada D. <dj...@im...> - 2002-09-23 07:18:16
|
OK. Thanks for your help. -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of metalseb Sent: petak, 20. septembar 2002 15:55 To: devcpp mailing list Subject: RE: [Dev-C++] DialogBox returns -1 Hi Djura >I just tried your advice and it works. Glad to see it's ok now. >I just don't understand >why I had to replace IDC_STATIC with -1? Well, that's because from Windres' view, IDC_STATIC is unknown and is considered as a label which must be defined in the include file corresponding with the resource one. Like this : #define IDC_STATIC 2000 or everything else. But when I design a GUI, each time I know a static element won't be used by the program, I set its ID to -1. >anybody know if there is some kind of manual on DevC++ or Win32 >API(except MSDN)? Well, there is an online manual for DevC++ on bloodhed's site I think. Regarding Win32 API, I suggest you to buy the MS SDK CDROM online on MSDN. It costs USD 17 for anybody which lives in Europe and it is a *must buy* for anybody who wants to develop anything on Win platforms. This CD is worth hundreds of Euros in programming books, if you can find any nowadays on plain Win32 API programming, so sad.... But if you need a good start, just check out Forger's tutorial (Grab the URL using Google, haven't got it on this computer now) and find the basic "win32.hlp" file anywhere else. Kind regards -- Seb ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
|
From: Abhijit S. <mu...@gm...> - 2002-09-21 17:24:45
|
> Browsing winuser.h shows up that RC_INVOKED must be defined to get the
winuser.h file to be
> included.
>
> Defining it at the top of the sourcecode gives me a huge number of compile
errors...
>
> Can you explain this ?
I'm not really sure, but I think RC_INVOKED is automatically #define'd by
the compiler when it's calling from a resource file, to block-out parts of
the code inapplicable to it (like function prototypes, etc.). Try
#ifdef RC_INVOKED
#error some message
#endif
in a header, and include it *only* in a resource file and then only in a
code file. It should error only when included from the rc.
___________________________________________________________
Abhijit Shylanath
E-mail: mu...@gm... || ibr...@bi...
Web-site: http://mudeth.tripod.com/
|
|
From: Vlada D. <dj...@im...> - 2002-09-19 13:42:26
|
Hi, metalseb Thanks for your inerest in this thing. The code is in the attachment. -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of metalseb Sent: cetvrtak, 19. septembar 2002 12:59 To: Vlada Djurovic; devcpp mailing list Subject: Re: [Dev-C++] DialogBox returns -1 Hi Vlada You should check out which button was pressed pressed inside the "about" dialog box in its own message loop processing. Reading the Win32 API doc, DialogBox does not return the value of the button you pressed but the value returned by the EndDialog API call inside the message loop You also say that ret is equal to -1. It indicates that the DialogBox failed. That's why it doesn't display anything. If you want, just send me your full code, I will check and post an explanation here just after. Kind regards -- Seb ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |