Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hello,

I need an example of simple C/C++ GUI to some console program, with no MFC/ATL :omg:
Maybe just a dialog with 2 or 3 tabs for options and big fat run button.

Do you know of such an application?

All the applications I found were either relying on MFC, or bloated, or in C#, .. :sigh:

Please help.

With my thanks.
Posted

If no MFC, ATL or C#, then you'll have to write it in Win32. Start here[^].

There are PLENTY of articles at CP as well, if you search.
 
Share this answer
 
It's really not worth the time to create a "real" GUI application in plain Win32.
 
Share this answer
 
Actually I find Qt much better compared to Win32 or MFC. If you are not developing a windows specific application like windows service, shell enhancement utilities etc then Qt is much much better then anything else I have seen.

I am not sure how does the size of development tools effect the design of API or of the functionality it provides. You should not choose development tools based on such superficial criterion. The tool should be chosen such that using it you can accomplish the given task.

Would you use a spoon to dig a hole just because spade/shovel is too big and bulky? Win32 is spoon and Qt is shovel - you decide.

-Saurabh
 
Share this answer
 
v2
I´m not shure what exactly your Problem is.

If you want to start other Processes from your own GUI and that should depend on Win32-API (only), here is a skeletton:

1. First create an Win32 App with the Wizard

2. Create some PushButtons
enum WinButtons {IDC_WIN1=1, IDC_WIN2, IDC_WIN3, IDC_WIN4};
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
  int wmId, wmEvent;
  PAINTSTRUCT ps;
  HDC hdc;
  static HWND  hwndButton[2] ;
  static int   cxChar, cyChar ;

  switch (message){

    case WM_CREATE :
       // get average width and height of characters in the system font
       cxChar = LOWORD (GetDialogBaseUnits ()) ;
       cyChar = HIWORD (GetDialogBaseUnits ()) ;
          
       hwndButton[0] = CreateWindow ( TEXT("Button"), TEXT("Notepad"),
                        WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
                        cxChar, cyChar, 20 * cxChar, 7 * cyChar / 4,
                        hWnd, (HMENU)IDC_WIN1,
                        ((LPCREATESTRUCT) lParam)->hInstance, NULL) ;
       hwndButton[1] = CreateWindow ( TEXT("Button"), TEXT("CMD"),
                        WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
                        cxChar, cyChar*3, 20 * cxChar, 7 * cyChar / 4,
                        hWnd, (HMENU)IDC_WIN2,
                        ((LPCREATESTRUCT) lParam)->hInstance, NULL) ;
		break;


Then wait for the Button and execute something with CreateProcess

case WM_COMMAND:
    wmId    = LOWORD(wParam);
    wmEvent = HIWORD(wParam);

    switch (wmId)
    {
    case IDC_WIN1:         // Start the child process for Button1
        CreateMyProzess(TEXT("c:\\windows\\notepad.exe"));
        break;
    case IDC_WIN2:         // Start the child process for Button2
        CreateMyProzess(TEXT("c:\\windows\\system32\\cmd.exe"));
        break;



For more look into Win32-API Book from Charles Petzold
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900