Re: How to create/display a modal window? And surplus of win32 code
Thanks ovidiucucu, I will check out the threads ... and upload the source Just got a bit sidetracked by something You already know I'm using plain WinAPI, which means the look of the buttons is very very basic, I'd say ugly, but I thought, oh well, that's the price I have to pay for not using wrappers. But I've noticed in one of the signatures of one of the members here on this board a link to nice buttons for the use with Win32. So I've downloaded the "SDK" for those buttons, and sure thing it didn't work, even the example code. The thing is, it uses this headers (and libs):
#include <uxtheme.h>
#include <tmschema.h>
I've searched those on my machine but did not find anywhere. Then I searched the net and found out they are part of Platform SDK. Ok, I downloaded Platform SDK April 2005 release ... only to find out it is incompatible with VC++ 6.0 (which is what I'm using), so I though I need an older SDK, and from what I've read I needed 2003 February edition. I downloaded that, installed, but I still keep getting almost 270 warnings + errors, and lots of them do not make any sense. Yes I added the include directory to Include paths, and same with Lib path, but that's it... also ticked the option to register environmental variables during the install. Rebooted, created fresh project but still no go. For several hours I'm trying to make this code to compile. Here's approx what errors compiler is giving me:
Code:
d:\program files\microsoft visual studio\myprojects\example\imagebutton.h(37) : warning C4028: formal parameter 2 different from declaration
d:\program files\microsoft visual studio\myprojects\example\imagebutton.h(37) : warning C4028: formal parameter 3 different from declaration
d:\program files\microsoft visual studio\myprojects\example\imagebutton.h(38) : warning C4031: second formal parameter list longer than the first list
d:\program files\microsoft visual studio\myprojects\example\imagebutton.h(38) : warning C4028: formal parameter 2 different from declaration
d:\program files\microsoft visual studio\myprojects\example\imagebutton.h(38) : warning C4028: formal parameter 3 different from declaration
[...]
d:\program files\microsoft visual studio\myprojects\example\buttontest.c(17) : error C2146: syntax error : missing ';' before identifier 'hPulsante'
d:\program files\microsoft visual studio\myprojects\example\buttontest.c(17) : error C2065: 'hPulsante' : undeclared identifier
d:\program files\microsoft visual studio\myprojects\example\buttontest.c(18) : warning C4047: '=' : 'int ' differs in levels of indirection from 'struct HWND__ *'
d:\program files\microsoft visual studio\myprojects\example\buttontest.c(22) : warning C4047: 'function' : 'char *' differs in levels of indirection from 'const int '
d:\program files\microsoft visual studio\myprojects\example\buttontest.c(22) : warning C4024: 'ImageButton_Create' : different types for formal and actual parameter 2
d:\program files\microsoft visual studio\myprojects\example\buttontest.c(22) : warning C4020: 'ImageButton_Create' : too many actual parameters
d:\program files\microsoft visual studio\myprojects\example\buttontest.c(23) : warning C4047: 'function' : 'struct HINSTANCE__ *' differs in levels of indirection from 'const int '
d:\program files\microsoft visual studio\myprojects\example\buttontest.c(23) : warning C4024: 'ImageButton_SetBitmap' : different types for formal and actual parameter 2
[...]
d:\program files\microsoft visual studio\vc98\include\windef.h(281) : see declaration of 'COLORREF'
d:\program files\microsoft visual studio\myprojects\example\imagebutton.c(622) : error C2146: syntax error : missing ';' before identifier 'crPixel'
d:\program files\microsoft visual studio\myprojects\example\imagebutton.c(623) : error C2275: 'BYTE' : illegal use of this type as an expression
d:\program files\microsoft visual studio\vc98\include\windef.h(143) : see declaration of 'BYTE'
d:\program files\microsoft visual studio\myprojects\example\imagebutton.c(623) : error C2146: syntax error : missing ';' before identifier 'byNewPixel'
d:\program files\microsoft visual studio\myprojects\example\imagebutton.c(625) : warning C4018: '<' : signed/unsigned mismatch
d:\program files\microsoft visual studio\myprojects\example\imagebutton.c(627) : warning C4018: '<' : signed/unsigned mismatch
d:\program files\microsoft visual studio\myprojects\example\imagebutton.c(682) : error C2275: 'DWORD' : illegal use of this type as an expression
and so on.... long long list.
I probably should have started a new thread, but anyway, maybe somebody of you could help with this?
wThemeCaption was not initiaized so crashes on delete [] wThemeCaption;
I think it's better to ask the author, for me it's prety enough for this evening.
Last edited by ovidiucucu; January 16th, 2006 at 01:41 PM.
Re: How to create/display a modal window? And surplus of win32 code
well d'oh !! I didn't know VC++ treats *.c files as code written in C I mean, it's pretty incorrect to *identify* files by its extension ... there are better ways, such as headers e.g., of course this is not a binary file ... but if it's VC++ then it must treat the whole code as C++ unless explicitly specified by some #define or something... That's why I said some erors did not make any sense, I thought "why would it yield about simple overloading...everything's all right there", but I didn't think the problem was in the extension, so I didn't rename. Furthermore, how could he write this code with this .c extension if it should not have compiled this way? And also I see no point in renaming it to .c to make confusion. Anyway, odd. But thanks again, at least it complies now. I've already noticed errors too, I will see if I can fix them.
Re: How to create/display a modal window? And surplus of win32 code
Oh, now i see. I'm gonna fix them immediately.
PS: sorry for the .c file. Dev-cpp don't look at the extension. In fact it compiled ImageButton.c as a cpp file and i didn't care nor look at the extension
Last edited by kkez; January 17th, 2006 at 06:31 AM.
Re: How to create/display a modal window? And surplus of win32 code
If you consider that C/CPP extension problem mentioned here is a real problem (which I think it's not) you can report it to MS. Who knows, maybe in a furture implementation...
Anyhow that code is wrtitten in C++ as long as it uses overloaded functions, operator new and delete, and so on.
IMO it's a mistake of the author to put C++ code in .C source files, at least from "good style programming" point of view.
...however it's an alternative to define WINVER before including <windows.h>
Code:
#define WINVER 0x0500
#include <windows.h>
But this can scare some guys because of this ugly obsolete note:
Code:
Compiling...
buttontest.cpp
NOTE: WINVER has been defined as 0x0500 or greater which enables
Windows NT 5.0 and Windows 98 features. When these headers were released,
Windows NT 5.0 beta 1 and Windows 98 beta 2.1 were the current versions.
For this release when WINVER is defined as 0x0500 or greater, you can only
build beta or test applications. To build a retail application,
set WINVER to 0x0400 or visit http://www.microsoft.com/msdn/sdk
to see if retail Windows NT 5.0 or Windows 98 headers are available.
See the SDK release notes for more information.
Of course in newer VC++ versions this note nomore appears.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.