C window code - How easy is it to intergrate cmd code

This is a discussion on C window code - How easy is it to intergrate cmd code within the C Programming forums, part of the General Programming Boards category; Did your comments need to be repeated Bob? I didn't think so....

  1. #16
    Registered User
    Join Date
    Feb 2009
    Posts
    93
    Did your comments need to be repeated Bob?

    I didn't think so.

  2. #17
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,183
    Did your comments need to be repeated Bob?

    I didn't think so.
    Grow up.

    This is a forum, not your elementary school.

    You are not paying us to answer your questions, and he used his very own precious time to give you valuable advices, and that's all he gets?

  3. #18
    Registered User
    Join Date
    Feb 2009
    Posts
    93
    What is the point in telling the mods to move this thread to a windows forum when he has told me that at this stage of coding I have zero chance of being able to complete it? Then he says the supplied code is crap, despite coming from a MICROSOFT VS tutorial.

    I dont want to start an argument but honestly....

  4. #19
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,183
    Well he did point out what's wrong with it. I have 0 experience with Windows API, so I can't agree or disagree.

    despite coming from a MICROSOFT VS tutorial.
    A bug is a bug, no matter who wrote it.

  5. #20
    Registered User
    Join Date
    Feb 2009
    Posts
    93
    Just seems slightly funny how he would condem this code assuming it was mine, because im a "script kiddie", when actually it came from Microsoft. I mean ive only been coding for a matter of days on and off, with no tuition. Why am i asking such stupid questions then i must be brilliant by now.

    Im not going to argue, mods can go ahead and delete this thread. Thanks to those that helped me.

  6. #21
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,183
    Probably just a misunderstanding, then.

    Script kiddie is a term used to refer to people who copy code with no idea what it does.

  7. #22
    'Allo, 'Allo, Allo
    Join Date
    Apr 2008
    Posts
    611
    Bob's commenting on others' code quality? Wow, I guess Elysia will be porting all her code to C# after all.

    This is totally unlike any MS tutorial I've ever seen.
    Open VS
    File->New Project->Win32 Project->Name: KJLJL->OK->Finish
    Exactly the same code

  8. #23
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,059
    Quote Originally Posted by adeyblue View Post
    Bob's commenting on others' code quality? Wow, I guess Elysia will be porting all her code to C# after all.


    Open VS
    File->New Project->Win32 Project->Name: KJLJL->OK->Finish
    Exactly the same code

    Nope it's NOT exactly the SAME code because the posted code has one very simple glaring mistake that has an extremely high probability of not having the code run at all. The user will execute the code and nothing will happen. No GUI window at all. It's an extremely common mistake that most rookie Win32 programmers make. As a matter of fact, this very same problem has been referenced a few times on the Windows forum.
    Last edited by BobS0327; 04-19-2009 at 09:39 PM.

  9. #24
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,059
    Quote Originally Posted by spadez View Post
    Hi,

    As a project im required to make a cmd program. The teacher said it would be better if we are able to intergrate it into a windowed program but didnt give us any information on it.

    If i have a CSV reader code working in cmd and i have this working window code:

    Code:
    // kjljl.cpp : Defines the entry point for the application.
    //
    
    #include "stdafx.h"
    #include "kjljl.h"
    
    #define MAX_LOADSTRING 100
    
    // Global Variables:
    HINSTANCE hInst;								// current instance
    TCHAR szTitle[MAX_LOADSTRING];					// The title bar text
    TCHAR szWindowClass[MAX_LOADSTRING];			// the main window class name
    
    // Forward declarations of functions included in this code module:
    ATOM				MyRegisterClass(HINSTANCE hInstance);
    BOOL				InitInstance(HINSTANCE, int);
    LRESULT CALLBACK	WndProc(HWND, UINT, WPARAM, LPARAM);
    INT_PTR CALLBACK	About(HWND, UINT, WPARAM, LPARAM);
    
    int APIENTRY _tWinMain(HINSTANCE hInstance,
                         HINSTANCE hPrevInstance,
                         LPTSTR    lpCmdLine,
                         int       nCmdShow)
    {
    	UNREFERENCED_PARAMETER(hPrevInstance);
    	UNREFERENCED_PARAMETER(lpCmdLine);
    
     	// TODO: Place code here.
    	MSG msg;
    	HACCEL hAccelTable;
    
    	// Initialize global strings
    	LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
    	LoadString(hInstance, IDC_KJLJL, szWindowClass, MAX_LOADSTRING);
    	MyRegisterClass(hInstance);
    
    	// Perform application initialization:
    	if (!InitInstance (hInstance, nCmdShow))
    	{
    		return FALSE;
    	}
    
    	hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_KJLJL));
    
    	// Main message loop:
    	while (GetMessage(&msg, NULL, 0, 0))
    	{
    		if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
    		{
    			TranslateMessage(&msg);
    			DispatchMessage(&msg);
    		}
    	}
    
    	return (int) msg.wParam;
    }
    
    
    
    //
    //  FUNCTION: MyRegisterClass()
    //
    //  PURPOSE: Registers the window class.
    //
    //  COMMENTS:
    //
    //    This function and its usage are only necessary if you want this code
    //    to be compatible with Win32 systems prior to the 'RegisterClassEx'
    //    function that was added to Windows 95. It is important to call this function
    //    so that the application will get 'well formed' small icons associated
    //    with it.
    //
    ATOM MyRegisterClass(HINSTANCE hInstance)
    {
    	WNDCLASSEX wcex;
    
    	wcex.cbSize = sizeof(WNDCLASSEX);
    
    	wcex.style			= CS_HREDRAW | CS_VREDRAW;
    	wcex.lpfnWndProc	= WndProc;
    	wcex.cbClsExtra		= 0;
    	wcex.cbWndExtra		= 0;
    	wcex.hInstance		= hInstance;
    	wcex.hIcon			= LoadIcon(hInstance, MAKEINTRESOURCE(IDI_KJLJL));
    	wcex.hCursor		= LoadCursor(NULL, IDC_ARROW);
    	wcex.hbrBackground	= (HBRUSH)(COLOR_WINDOW+1);
    	wcex.lpszMenuName	= MAKEINTRESOURCE(IDC_KJLJL);
    	wcex.lpszClassName	= szWindowClass;
    	wcex.hIconSm		= LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
    
    	return RegisterClassEx(&wcex);
    }
    
    //
    //   FUNCTION: InitInstance(HINSTANCE, int)
    //
    //   PURPOSE: Saves instance handle and creates main window
    //
    //   COMMENTS:
    //
    //        In this function, we save the instance handle in a global variable and
    //        create and display the main program window.
    //
    BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
    {
       HWND hWnd;
    
       hInst = hInstance; // Store instance handle in our global variable
    
       hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
          CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
    
       if (!hWnd)
       {
          return FALSE;
       }
    
       ShowWindow(hWnd, nCmdShow);
       UpdateWindow(hWnd);
    
       return TRUE;
    }
    
    //
    //  FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
    //
    //  PURPOSE:  Processes messages for the main window.
    //
    //  WM_COMMAND	- process the application menu
    //  WM_PAINT	- Paint the main window
    //  WM_DESTROY	- post a quit message and return
    //
    //
    LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
    	int wmId, wmEvent;
    	PAINTSTRUCT ps;
    	HDC hdc;
    
    	switch (message)
    	{
    	case WM_COMMAND:
    		wmId    = LOWORD(wParam);
    		wmEvent = HIWORD(wParam);
    		// Parse the menu selections:
    		switch (wmId)
    		{
    		case IDM_ABOUT:
    			DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
    			break;
    		case IDM_EXIT:
    			DestroyWindow(hWnd);
    			break;
    		default:
    			return DefWindowProc(hWnd, message, wParam, lParam);
    		}
    		break;
    	case WM_PAINT:
    		hdc = BeginPaint(hWnd, &ps);
    		// TODO: Add any drawing code here...
    		EndPaint(hWnd, &ps);
    		break;
    	case WM_DESTROY:
    		PostQuitMessage(0);
    		break;
    	default:
    		return DefWindowProc(hWnd, message, wParam, lParam);
    	}
    	return 0;
    }
    
    // Message handler for about box.
    INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
    {
    	UNREFERENCED_PARAMETER(lParam);
    	switch (message)
    	{
    	case WM_INITDIALOG:
    		return (INT_PTR)TRUE;
    
    	case WM_COMMAND:
    		if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
    		{
    			EndDialog(hDlg, LOWORD(wParam));
    			return (INT_PTR)TRUE;
    		}
    		break;
    	}
    	return (INT_PTR)FALSE;
    }
    How easy would it be to display my CSV output in the window instead of in cmd?
    @spadez,

    This board has a policy that frowns on providing complete homework examples. But if you are serious about writing this assignment in a WIN32 GUI environment, then I suggest that you post a message requesting assistance in developing a Win32 scrollable window to the WIN32 newsgroups. When I see your message, I will post the complete source to a GUI app which can load dynamic CSV data into a resizable window that has horizontal and verticall scrolling bars. In other words, it's your complete homework project in a GUI app.

    I still don't think your instructor wants you to go this route since it's my undrstanding that you have no more than two months coding experience. That's one totally awesome experience jump from writing hello world console apps to writing dynamic GUI apps in two months. Hopefully, seeing the code will make you reconsider contacting your instructor for a clarification on this project. Otherwise, you'd better thoroughly study and understand the code. Your instructor will definitely want to you explain the code to him and probably the class.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Button positioning
    By Lionmane in forum Windows Programming
    Replies: 76
    Last Post: 10-21-2005, 05:22 AM
  2. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  3. my wndProc is out of scope
    By Raison in forum Windows Programming
    Replies: 35
    Last Post: 06-25-2004, 07:23 AM
  4. opengl code not working
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 02-14-2002, 09:01 PM
  5. Winamp Vis if anyone can help
    By Unregistered in forum Windows Programming
    Replies: 6
    Last Post: 01-26-2002, 11:43 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21