| | |
| Stránka: 1 z 1
| [ Príspevkov: 2 ] | |
Autor | Správa |
---|
Registrovaný: 27.11.10 Prihlásený: 29.07.12 Príspevky: 38 Témy: 20 |
zdar chalani ak mate niekto cas mrknite sa mi prosim na to. programujem Win32 v Dev-C++ a zacinam chapat ze mi nestaci tak prechadzam na visual studio. program som okopcil a studio mi vyhadzuje chyby a neviem ich odstranit. mohli by ste mi povedat co znamenaju?? diki
tu su errory:
Kód: 2 IntelliSense: argument of type "char *" is incompatible with parameter of type "LPWSTR" c:\users\milos\documents\visual studio 2010\projects\test\test\test.cpp 48 3 IntelliSense: argument of type "const char *" is incompatible with parameter of type "LPCWSTR" c:\users\milos\documents\visual studio 2010\projects\test\test\test.cpp 48 4 IntelliSense: argument of type "char *" is incompatible with parameter of type "LPCWSTR" c:\users\milos\documents\visual studio 2010\projects\test\test\test.cpp 49 5 IntelliSense: argument of type "const char *" is incompatible with parameter of type "LPCWSTR" c:\users\milos\documents\visual studio 2010\projects\test\test\test.cpp 85 6 IntelliSense: argument of type "const char *" is incompatible with parameter of type "LPCWSTR" c:\users\milos\documents\visual studio 2010\projects\test\test\test.cpp 94 7 IntelliSense: argument of type "const char *" is incompatible with parameter of type "LPCWSTR" c:\users\milos\documents\visual studio 2010\projects\test\test\test.cpp 100 8 IntelliSense: argument of type "const char *" is incompatible with parameter of type "LPCWSTR" c:\users\milos\documents\visual studio 2010\projects\test\test\test.cpp 108 9 IntelliSense: argument of type "const char *" is incompatible with parameter of type "LPCWSTR" c:\users\milos\documents\visual studio 2010\projects\test\test\test.cpp 115 10 IntelliSense: argument of type "const char *" is incompatible with parameter of type "LPCWSTR" c:\users\milos\documents\visual studio 2010\projects\test\test\test.cpp 117 11 IntelliSense: argument of type "const char *" is incompatible with parameter of type "LPCWSTR" c:\users\milos\documents\visual studio 2010\projects\test\test\test.cpp 123 12 IntelliSense: argument of type "const char *" is incompatible with parameter of type "LPCWSTR" c:\users\milos\documents\visual studio 2010\projects\test\test\test.cpp 129 13 IntelliSense: argument of type "char *" is incompatible with parameter of type "LPWSTR" c:\users\milos\documents\visual studio 2010\projects\test\test\test.cpp 177 14 IntelliSense: argument of type "char *" is incompatible with parameter of type "LPWSTR" c:\users\milos\documents\visual studio 2010\projects\test\test\test.cpp 178 15 IntelliSense: argument of type "char *" is incompatible with parameter of type "LPWSTR" c:\users\milos\documents\visual studio 2010\projects\test\test\test.cpp 179 16 IntelliSense: a value of type "const char *" cannot be assigned to an entity of type "LPCWSTR" c:\users\milos\documents\visual studio 2010\projects\test\test\test.cpp 214 17 IntelliSense: argument of type "const char *" is incompatible with parameter of type "LPCWSTR" c:\users\milos\documents\visual studio 2010\projects\test\test\test.cpp 216 18 IntelliSense: argument of type "const char *" is incompatible with parameter of type "LPCWSTR" c:\users\milos\documents\visual studio 2010\projects\test\test\test.cpp 216 19 IntelliSense: argument of type "const char *" is incompatible with parameter of type "LPCWSTR" c:\users\milos\documents\visual studio 2010\projects\test\test\test.cpp 218 20 IntelliSense: argument of type "const char *" is incompatible with parameter of type "LPCWSTR" c:\users\milos\documents\visual studio 2010\projects\test\test\test.cpp 229 21 IntelliSense: argument of type "const char *" is incompatible with parameter of type "LPCWSTR" c:\users\milos\documents\visual studio 2010\projects\test\test\test.cpp 229 Error 1 error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source? c:\users\milos\documents\visual studio 2010\projects\test\test\test.cpp 242
no a kod je tento Kód: #include <windows.h>
WNDCLASS WndClass;
HWND hwnd; MSG msg; static HBRUSH background; unsigned int cxChar, cxCaps, cyChar, cxClient, cyClient, color[3], save[3]; CHAR *szName[] = {"CERVENA", "ZELENA", "MODRA"}; COLORREF colors[] = {RGB(255,0,0), RGB(0,255,0), RGB(0,0,255)};
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){ HDC hdc; PAINTSTRUCT ps; static RECT rect; TEXTMETRIC tm; static HWND hwndScroll[2], hwndRight, hwndText[2], hwndEdit[2], hwndReset, hwndGetColor, hwndSave; HINSTANCE hInstance; char ch[5]; switch(message){ case WM_VSCROLL: { int i = GetWindowLong(HWND(lParam), GWL_ID); switch(LOWORD(wParam)){ case SB_PAGEUP: case SB_LINEUP:if(color[i]>0){color[i]--;}break; case SB_PAGEDOWN: case SB_LINEDOWN:if(color[i]<255){color[i]++;}break; case SB_THUMBPOSITION: case SB_THUMBTRACK: color[i] = HIWORD(wParam);break; default:break; } SetScrollPos(hwndScroll[i], SB_CTL, color[i], TRUE); background = CreateSolidBrush(RGB(color[0], color[1], color[2])); SetClassLong(hwnd, GCL_HBRBACKGROUND, (LONG) background); InvalidateRect(hwnd, &rect, TRUE); UpdateWindow(hwnd); if(wParam!=10){ wsprintf(ch, "%d", color[i]); SetWindowText(hwndEdit[i], ch); } } return 0; case WM_CTLCOLORSCROLLBAR:{ int i = GetWindowLong((HWND) lParam, GWL_ID); background = CreateSolidBrush(colors[i]); return (LRESULT) background;} case WM_CTLCOLORSTATIC:{ int i = GetWindowLong((HWND) lParam, GWL_ID); if((HWND)lParam == hwndSave){background = CreateSolidBrush(RGB(save[0], save[1], save[2]));return (LRESULT) background;} if(i>=3){ SetTextColor((HDC) wParam, colors[i%3]); SetBkColor((HDC) wParam, GetSysColor(COLOR_BTNHIGHLIGHT)); background = CreateSolidBrush(GetSysColor(COLOR_BTNHIGHLIGHT)); return (LRESULT) background;} } case WM_CREATE: hdc = GetDC(hwnd); GetTextMetrics(hdc, &tm); ReleaseDC(hwnd, hdc); cxChar = tm.tmAveCharWidth; cyChar = tm.tmHeight + tm.tmExternalLeading; cxCaps = (tm.tmPitchAndFamily & 1 ? 3 : 2) * cxChar/2; hInstance = (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE); hwndRight = CreateWindow( "static",NULL, WS_CHILD | WS_VISIBLE | SS_WHITERECT, 0, 0, 0, 0, hwnd, (HMENU) 9, hInstance, NULL ); for(int i = 0; i<3; i++){ hwndEdit[i] = CreateWindow( "edit",NULL, WS_CHILD | WS_VISIBLE | ES_CENTER | WS_BORDER , 0, 0, 0, 0, hwnd, (HMENU) i+13, ((LPCREATESTRUCT) lParam) -> hInstance, NULL ); hwndText[i] = CreateWindow( "static",szName[i], WS_CHILD | WS_VISIBLE | SS_CENTER, 0, 0, 0, 0, hwnd, (HMENU) i+3, hInstance, NULL ); hwndScroll[i] = CreateWindow( "scrollbar",szName[i], WS_CHILD | WS_VISIBLE/* | WS_TABSTOP*/ | SBS_VERT, 0, 0, 0, 0, hwnd, (HMENU) i, hInstance, NULL ); SetScrollRange(hwndScroll[i], SB_CTL, 0, 255, FALSE); SetWindowText(hwndEdit[i], "0"); } hwndReset = CreateWindow( "button","RESET", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 0, 0, 0, 0, hwnd, (HMENU) 10, hInstance, NULL ); hwndGetColor = CreateWindow( "button","Uloz farbu", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 0, 0, 0, 0, hwnd, (HMENU) 11, hInstance, NULL ); hwndSave = CreateWindow( "static",NULL, WS_CHILD | WS_VISIBLE | SS_CENTER, 0, 0, 0, 0, hwnd, (HMENU) 12, hInstance, NULL ); return 0; case WM_SIZE: cxClient = LOWORD (lParam); cyClient = HIWORD (lParam); rect.left = cxClient/2; rect.right = cxClient; rect.bottom = cyClient; rect.top = 0; MoveWindow(hwndRight, 0, 0, cxClient/2, cyClient, TRUE); for(int i = 0; i<3; i++){ MoveWindow(hwndScroll[i], (cxClient/14)*i+(i+1)*cxClient/14, (cyClient/4)/2, cxClient/10, (cyClient/4)*3, TRUE); MoveWindow(hwndText[i], (cxClient/14)*i+(i+1)*cxClient/14, (cyClient/4)/3, cxClient/10, cyChar, TRUE); MoveWindow(hwndEdit[i], (cxClient/14)*i+(i+1)*cxClient/14, (cyClient/10)*9, cxClient/10, cyChar, TRUE); } MoveWindow(hwndReset, cxClient/7, (cyClient/15)*14, cxClient/10, cyChar, TRUE); MoveWindow(hwndGetColor, (cxClient/28)*8, (cyClient/15)*14, cxClient/10, cyChar, TRUE); MoveWindow(hwndSave, (cxClient/28)*8, (cyClient/30)*29, cxClient/10, cyChar, TRUE); return 0; case WM_COMMAND: switch(LOWORD(wParam)){ case 10:{ for(int i = 0; i < 3; i++){ color[i] = save[i]; SendMessage(hwnd, WM_VSCROLL, 9 , LPARAM(hwndScroll[i]));}break;} case 11: save[0] = color[0]; save[1] = color[1]; save[2] = color[2]; InvalidateRect(hwndSave, NULL, TRUE); UpdateWindow(hwndSave); break; default:break;} if((HWND) lParam == hwndEdit[0] && HIWORD(wParam)==EN_CHANGE){GetWindowText(hwndEdit[0], ch, 4);color[0]=atoi(ch);SendMessage(hwnd, WM_VSCROLL, 10 , LPARAM(hwndScroll[0]));} else if((HWND) lParam == hwndEdit[1] && HIWORD(wParam)==EN_CHANGE){GetWindowText(hwndEdit[1], ch, 4);color[1]=atoi(ch);SendMessage(hwnd, WM_VSCROLL, 10 , LPARAM(hwndScroll[1]));} else if((HWND) lParam == hwndEdit[2] && HIWORD(wParam)==EN_CHANGE){GetWindowText(hwndEdit[2], ch, 4);color[2]=atoi(ch);SendMessage(hwnd, WM_VSCROLL, 10 , LPARAM(hwndScroll[2]));} return 0; /* case WM_PAINT: hdc = BeginPaint(hwnd, &ps); backround = CreateSolidBrush(RGB(0, 255, 0)); SetClassLong(hwnd, GCL_HBRBACKGROUND, (long)backround); EndPaint(hwnd, &ps); return 0;*/ case WM_DESTROY: DeleteObject(background); PostQuitMessage(0); return 0; default:break; } return DefWindowProc(hwnd, message, wParam, lParam); }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){
background = CreateSolidBrush(0); WndClass.style = CS_HREDRAW | CS_VREDRAW; WndClass.lpfnWndProc = WndProc; WndClass.hInstance = hInstance; WndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION); WndClass.hCursor = LoadCursor(NULL,IDC_ARROW); WndClass.hbrBackground = background; WndClass.lpszClassName = "WndClass"; if(!RegisterClass(&WndClass)){ MessageBox(NULL,"Failed registering main Window Class","ERROR",MB_ICONERROR);} hwnd = CreateWindow("WndClass", "FARBY by Milos", WS_OVERLAPPEDWINDOW, 50, 70, 1030, 1050, NULL, NULL, hInstance, NULL); if(hwnd == 0){MessageBox(NULL,"Failed creating window","ERROR",MB_ICONERROR);} ShowWindow(hwnd , nCmdShow); UpdateWindow(hwnd);
while(GetMessage(&msg, NULL, 0, 0)){ TranslateMessage(&msg); DispatchMessage(&msg); }return msg.wParam;
}
|
|
Registrovaný: 11.01.09 Prihlásený: 26.04.24 Príspevky: 1385 Témy: 9 Bydlisko: Hrinova | Napísal Fico: 14.06.2012 23:02 | |
|
Problem je v nastaveni tvojho projektu - zrejme mas nastaveny unicode, ty potrebujes multi-byte znakovu sadu. VS nemam, tak skusim len tak naslepo, co som vyguglil:
- klikni pravym na tvoj projekt a vyber moznost properties
- Configuration Properties
- General
- Use Multi-Byte Character Set
Malo by to zabrat, ak nie, ozvi sa.
|
|
| Stránka: 1 z 1
| [ Príspevkov: 2 ] | |
Podobné témy | Témy | Odpovede | Zobrazenia | Posledný príspevok |
---|
| problem s visual c++ v Assembler, C, C++, Pascal, Java | 1 | 530 | 10.07.2009 15:00 TJ | | visual c++ debug library problem v Assembler, C, C++, Pascal, Java | 4 | 405 | 03.08.2012 15:34 august | | problem s debugovanim vo Visual C++ 2005 v Assembler, C, C++, Pascal, Java | 6 | 716 | 23.08.2007 12:43 stewe | | Napoleon total war problem s Visual C++ 2005 v Počítačové hry | 1 | 599 | 13.05.2010 23:16 prandof | | problem vo winapi v Assembler, C, C++, Pascal, Java | 3 | 298 | 07.06.2012 16:30 Fico | | aky je rozdiel medzi C++ a Visual C++ ? v Assembler, C, C++, Pascal, Java | 8 | 1964 | 19.02.2011 22:46 vendo2 | | Darujem knihy o programovaní (HTML, Java, Visual C++, C++ Builder, Android) v Vymením a darujem | 0 | 431 | 01.04.2019 11:20 tomasteicher | | Builder C++ vs Visual C++ v Assembler, C, C++, Pascal, Java | 1 | 570 | 27.08.2010 19:33 pizet | | Visual C v Assembler, C, C++, Pascal, Java | 9 | 429 | 18.03.2013 14:58 Spixy | | visual c++ verzie v Assembler, C, C++, Pascal, Java | 3 | 457 | 20.08.2012 20:17 Fico | | Microsoft visual C++ v Ovládače | 5 | 767 | 11.12.2012 9:32 majky358 | | Microsoft visual c++ v Assembler, C, C++, Pascal, Java | 25 | 3336 | 20.08.2011 12:52 MAREK17 | | Reinštalácia Visual C++ v Ovládače | 0 | 752 | 04.04.2020 20:44 StroWniss | | Kniznica C [Visual Studio] v Assembler, C, C++, Pascal, Java | 20 | 1181 | 19.06.2012 15:25 reDo | | Microsoft Visual C++ 2015 v Operačné systémy Microsoft | 7 | 1873 | 29.01.2019 0:08 tairikuokami | | chyba - MS Visual C++ v Antivíry a antispywary | 6 | 737 | 13.10.2009 20:42 citizen |
| Nemôžete zakladať nové témy v tomto fóre Nemôžete odpovedať na témy v tomto fóre Nemôžete upravovať svoje príspevky v tomto fóre Nemôžete mazať svoje príspevky v tomto fóre
|
|