Originally Posted by
RVC
Currently I'm using Code::Blocks and MINGW. For the little I have done so far they seem to be fine. Is there a reason I would consider switching to your PellesC? Thanks also for the rest of the info. Wonder how long it will take before I get to the point where I can use it.
At any rate, thanks again.
RVC
Both are fully capable compilers... so lets not debate that.
But, windows GUI apps include resources... menus, dialogs, string tables, message tables, icons, manifests, bitmaps, imagelists, versioninfo, code signing and other things imbedded right into the executable image.
With Code::Blocks, you will need to find editors for all these things separately and iron out the incompatibilities yourself... and good luck finding a free standing Message Table editor; if it's out there I've never seen it.
Pelle's IDE has all that built right in from the git go... As I said, it's a real nice "all in one" solution, everything you need to produce a fully marketable Windows application... GUI or Console.
How long till this matters? Well, it probably matters a little bit right now... GCC has some extensions Pelle decided not to include. Pelles C has some stuff GCC lacks... I believe PellesC is closer to the C-99 standard. So for these issues you probably should make your choice fairly early on and get used to the included libraries etc. before climbing into Windows.
The transition from console to gui programming is kind of like learning a whole new language... the underbelly is still C but GUI programs are totally different... they even have a different entry point procedure winmain() instead of main()... So you need to be ready to take on a whole new programming scenario, based on the same syntax, when making the transition.
Just to give you some idea, here is a skeletal windows program... Just enough to put a window on the screen and let you close it.
Code:
#include <windows.h>
#include <commctrl.h>
HINSTANCE gInst; // global instance handle
HWND MainWind; // global main window handle
HWND Win[9]; // windows handle array
HACCEL Accel =NULL; // keyboard accelerator
//////////////////////////////////////////////////////////////////////////////////////////
// Message Loop
//
LRESULT CALLBACK MsgProc(HWND wnd,UINT msg,WPARAM wp,LPARAM lp)
{ switch (msg)
{ case WM_COMMAND :
switch (LOWORD(wp))
{ case 100 :
Beep(500,100);
return 0;
default :
return DefWindowProc(wnd,msg,wp,lp); }
// NC Exit button
case WM_CLOSE :
DestroyWindow(Win[0]);
return 0;
case WM_DESTROY :
PostQuitMessage(0);
return 0;
default :
return DefWindowProc(wnd,msg,wp,lp); } }
//////////////////////////////////////////////////////////////////////////////////////////
// Main UI
//
BOOL CreateMainUI(void)
{ WNDCLASS wc; // window class
// register App Class
memset(&wc,0,sizeof(wc));
wc.style = CS_CLASSDC;
wc.hInstance = gInst;
wc.hIcon = LoadIcon(gInst,"APPICON");
wc.hCursor = LoadCursor(NULL,IDC_ARROW);
wc.hbrBackground = CreateSolidBrush(GetSysColor(COLOR_3DFACE));
wc.lpfnWndProc = &MsgProc;
wc.lpszClassName = "PROGNAME_CLASS";
if (!RegisterClass(&wc))
return 0;
// create the main window
Win[0] = CreateWindowEx( WS_EX_CONTROLPARENT,"PROGNAME_CLASS","Win Gui Wizard",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,CW_USEDEFAULT,400,200,0,0,gInst,NULL);
MainWind = Win[0];
UpdateWindow(Win[0]);
ShowWindow(Win[0], SW_SHOWNORMAL);
return 1; }
//////////////////////////////////////////////////////////////////////////////////////////
// Program Entry Procedure
//
int WINAPI WinMain(HINSTANCE hinst, HINSTANCE pinst, LPSTR cmdl, int show)
{ gInst = hinst;
MSG msg;
// Test if first copy. If not first copy
CreateMutex(NULL,1,"PROGNAME_MUTEX");
if (GetLastError() == ERROR_ALREADY_EXISTS)
return 0;
// at this point we're pretty sure we're the first copy
InitCommonControls();
// save instance handle
CreateMainUI();
// dispatch window messages
while (GetMessage(&msg,NULL,0,0) > 0)
if(!TranslateAccelerator(MainWind,Accel,&msg))
if(!IsDialogMessage(GetForegroundWindow(),&msg))
{ TranslateMessage(&msg);
DispatchMessage(&msg); }
// cleanup and exit
return 0; }