Results 1 to 4 of 4

Thread: Vs8.0 2005

  1. #1

    Thread Starter
    Fanatic Member prog_tom's Avatar
    Join Date
    May 2001
    Location
    Los Angeles and Little Rock
    Posts
    810

    Vs8.0 2005

    Hi,

    I just got my VS 2005 in the mail today, and it is very nice. But a lot of bugs.


    I tried to compile this, which works fine in 6.0:

    Code:
    #include <windows.h>
    
    const char szTitle[] = "Hello";
    const char szClass[] = "HelloApp";
    
    LRESULT CALLBACK WndProc (HWND hwnd, UINT msg, WPARAM wParam,
    						  LPARAM lParam);
    
    INT WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst,
    					LPSTR lpCmdLine, int nShowCmd)
    {
    	HWND hwnd;
    	MSG  msg ;
    	WNDCLASSEX Wnd;
    
    	Wnd.cbClsExtra = 0;
    	Wnd.cbSize = sizeof(WNDCLASSEX);
    	Wnd.cbWndExtra = 0;
    	Wnd.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
    	Wnd.hCursor = LoadCursor (NULL, IDC_ARROW);
    	Wnd.hIcon   = LoadIcon   (NULL, IDI_APPLICATION);
    	Wnd.hIconSm = LoadIcon   (NULL, IDI_APPLICATION);
    	Wnd.hInstance = hInst;
    	Wnd.lpfnWndProc = WndProc;
    	Wnd.lpszClassName = (LPCWSTR)szClass;
    	Wnd.lpszMenuName =NULL;
    	Wnd.style = CS_HREDRAW | CS_VREDRAW;
    
    	RegisterClassEx(&Wnd);
    
    	hwnd = CreateWindow (szClass, szTitle,
    		                 WS_BORDER | WS_SYSMENU,
    						 0, 0, 200,500,NULL,NULL,hInst,NULL);
    
    	if (!hwnd) return 0;
    
    	ShowWindow(hwnd, SW_SHOWMINIMIZED);
    	UpdateWindow(hwnd);
    
    	while ( GetMessage(&msg, NULL, 0 , 0 ) )
    	{
    		TranslateMessage(&msg);
    		DispatchMessage (&msg);
    	}
    
    	return msg.wParam;
    }
    
    LRESULT CALLBACK WndProc (HWND hwnd, UINT msg, WPARAM wParam,
    						  LPARAM lParam )
    {
    	switch (msg)
    	{
    	case WM_QUIT:
    		PostQuitMessage(0);
    		return 0;
    	case WM_DESTROY:
    		PostQuitMessage(0);
    		return 0;
    	default:
    		return DefWindowProc(hwnd,msg,wParam,lParam);
    	}
    	return 0;
    }
    Now it says it needs to convert char to LPCWSTR for sz_Class and sz_Title...

    And when I do that it compiles, but the title of the window look like some wierd symbol....


    Can someone explain to me how to solve this problem?

    prog_tom
    JOIN THE REVOLUTION!!!! Dual T3 backedup science community.
    http://physics.sviesoft.com/forum

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Vs8.0 2005

    You're compiling as UNICODE, but your code is not written for UNICODE compatibility.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Fanatic Member prog_tom's Avatar
    Join Date
    May 2001
    Location
    Los Angeles and Little Rock
    Posts
    810

    Re: Vs8.0 2005

    how do i fix it...

    prog_tom
    JOIN THE REVOLUTION!!!! Dual T3 backedup science community.
    http://physics.sviesoft.com/forum

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Vs8.0 2005

    I'm not sure. Search the project options for stuff containing "Unicode" and remove it.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width