NO

Author Topic: Cwiz.exe template tool, need help with Fatal errors...  (Read 3956 times)

vmars316

  • Guest
Cwiz.exe template tool, need help with Fatal errors...
« on: April 24, 2012, 01:15:47 AM »
Greetings,
I stumbled across this CWiz.zip (~39 kB).
A cool template tool for Pelles C.
http://www.smorgasbordet.com/pellesc/sourcecode.htm

but I get errors @
C:\PellesC\vmPelles-C\cwiz_zip\main.c(2053): warning #2234: Argument 3 to 'sprintf' does not match the format string; expected 'int' but found 'HWND'.
 
and
 
C:\PellesC\vmPelles-C\cwiz_zip\main.c(2111): warning #2234: Argument 3 to 'sprintf' does not match the format string; expected 'int' but found 'HWND'.
 
When I change the HWND to int, it works, but I get FATAL ERROR trying to compile.
 
Can anyone get me going? Or Post a working cwiz.exe ?

Thanks...Vernon

CommonTater

  • Guest
Re: Cwiz.exe template tool, need help with Fatal errors...
« Reply #1 on: April 24, 2012, 03:03:41 AM »
I downloaded it here and it compiled (with a couple of minor warnings) just fine.

What you need to do is unzip the file into a folder in your Pelles C Projects and then click on the .ppj file to load the project.   From there, just click Run and it should compile, link then execute for you.


 

Offline Bitbeisser

  • Global Moderator
  • Member
  • *****
  • Posts: 772
Re: Cwiz.exe template tool, need help with Fatal errors...
« Reply #2 on: April 24, 2012, 07:53:10 AM »
Well, I downloaded the file as well, extracted it into a folder in in the Pelle's C project folder and loaded the .ppj file and when executing a build, I get a series of warnings, including the one that the OP posted:
Code: [Select]
Building main.RES.
Building main.OBJ.
C:\Documents and Settings\Ralf\My Documents\Pelles C Projects\cwiz\main.c(247): warning #2229: Local 'c' is potentially used without being initialized.
C:\Documents and Settings\Ralf\My Documents\Pelles C Projects\cwiz\main.c(522): warning #2115: Local 'lenkwd' is initialized but never used.
C:\Documents and Settings\Ralf\My Documents\Pelles C Projects\cwiz\main.c(617): warning #2115: Local 'size' is initialized but never used.
C:\Documents and Settings\Ralf\My Documents\Pelles C Projects\cwiz\main.c(2053): warning #2234: Argument 3 to 'sprintf' does not match the format string; expected 'int' but found 'HWND'.
C:\Documents and Settings\Ralf\My Documents\Pelles C Projects\cwiz\main.c(2113): warning #2234: Argument 3 to 'sprintf' does not match the format string; expected 'int' but found 'HWND'.
Building cwiz.EXE.
Done.
At a first glance, the first warning is due to some really bad C programming, which indeed has the variable C uninitialized when called in this while loop
Code: [Select]
while(EOF!=c && pszBuf<bufferend){
(*pszBuf++)=c=(getc(pFile));
}
The second and third warnings are kind of ok, as they are just local variables defined to avoid a void typecasting of a function return.
However, the error message(s) that the OP posted does (at least at this time of the day for me) not make much sense, as it shows up on these lines of code
Code: [Select]
sprintf(text,"%d is the HWND of this window. For use as Parent Window for CreateWindowEx. cWiz.",hwndtest);
and
Code: [Select]
sprintf(text,"HWND of last created Window: %d: ",hwndex);
??? Looks like a strange parsing error to me where the text HWND somehow is evaluated by some macro, which should not happen...

Ralf
« Last Edit: April 24, 2012, 08:09:22 AM by Bitbeisser »

CommonTater

  • Guest
Re: Cwiz.exe template tool, need help with Fatal errors...
« Reply #3 on: April 24, 2012, 11:47:08 AM »
Try %u instead of %d  ....  or better use %x ... since window handles are pointers.


vmars316

  • Guest
Re: Cwiz.exe template tool, need help with Fatal errors...
« Reply #4 on: April 24, 2012, 04:36:12 PM »
Thanks Tater!...vm

Offline Bitbeisser

  • Global Moderator
  • Member
  • *****
  • Posts: 772
Re: Cwiz.exe template tool, need help with Fatal errors...
« Reply #5 on: April 24, 2012, 04:52:42 PM »
Try %u instead of %d  ....  or better use %x ... since window handles are pointers.
Doh! Darn, I didn't realize that when I checked into this last night. Should teach me not to do things like this after a 19h workday...  :-[

Ralf

JohnF

  • Guest
Re: Cwiz.exe template tool, need help with Fatal errors...
« Reply #6 on: April 24, 2012, 06:05:21 PM »
I would have thought that it would be better to use %p

John

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2091
Re: Cwiz.exe template tool, need help with Fatal errors...
« Reply #7 on: April 24, 2012, 07:02:53 PM »
That code uses GetDlgItemInt(), so better to use %u for parent window string.
Function can't convert hexadecimal string.
May the source be with you

JohnF

  • Guest
Re: Cwiz.exe template tool, need help with Fatal errors...
« Reply #8 on: April 24, 2012, 08:19:14 PM »
Quite so, I'd not taken GetDlgItemInt() into account.

John