NO

Author Topic: Complete Beginner - Looking to adapt example code  (Read 3600 times)

old_guy

  • Guest
Complete Beginner - Looking to adapt example code
« on: November 16, 2012, 05:55:27 PM »
Hi All,
i have found an example project called clock, which is almost perfect for something I need. 

All I want to do is increase the font size and make it bold. 

I have looked through the files but cannot see how to change these 2 properties.

I am not a C programmer but dabbled, many years ago with VB and expected to be able to find these 2 properties quite easily.  if someone could point me in the right direction i would appreciate it.

Regards
Old_Guy

CommonTater

  • Guest
Re: Complete Beginner - Looking to adapt example code
« Reply #1 on: November 16, 2012, 06:37:06 PM »
If you have the source as a pelles C project...

Go into Project -> Zip Project Files and then attach the result to a message in the beginner's section so we can see what you've got.


old_guy

  • Guest
Re: Complete Beginner - Looking to adapt example code
« Reply #2 on: November 18, 2012, 09:46:53 AM »
Hi,
Thanks for the reply.

I got the file from
http://www.pellesc.de/index.php?page=source&lang=en&group=3

I have attached the project file as you asked

I look forward to finding out how to solve this problem

Regards
Old_Guy

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2091
Re: Complete Beginner - Looking to adapt example code
« Reply #3 on: November 18, 2012, 11:41:07 AM »
In MainDlgProc create font for it:
Code: [Select]
...
  static HFONT hFont;
...
    case WM_INITDIALOG:
      hFont = CreateFont(18, -18, 0, 0, 700, 0, 0, 0, 0, 0, 0, 0, 0, TEXT("Arial"));
      SendMessage(GetDlgItem(hwndDlg, txt_Time), WM_SETFONT, (WPARAM)hFont, FALSE);
...
    case WM_CLOSE:
...
      DeleteObject(hFont);
...
May the source be with you

CommonTater

  • Guest
Re: Complete Beginner - Looking to adapt example code
« Reply #4 on: November 20, 2012, 04:15:31 AM »
Hi,
Thanks for the reply.

I got the file from
http://www.pellesc.de/index.php?page=source&lang=en&group=3

I have attached the project file as you asked

I look forward to finding out how to solve this problem

Regards
Old_Guy

Next time please follow instructions ...

Go to your menu ... Project -> Zip  Files ...  attach the resulting zip file to your message.

Also, as a beginner, you should probably read ... THIS 
Starting off with other peoples code, in a Windows GUI program is not the way to learn C.
 
In any case, a copy of the example is attached with a nice big clock... it was simply a matter of changing the font size in the dialog box resource.
« Last Edit: November 20, 2012, 04:34:35 AM by CommonTater »