-
Postów
1 103 -
Dołączył
-
Ostatnia wizyta
Typ zawartości
Profile
Forum
Wydarzenia
Treść opublikowana przez kt1117
-
1. Nie rozumiem pytania.(Gościu może strzelać tylko jak jest skierowany w prawo?) 2. Zrozum, i dopiero wtedy kopiuj: GML (Step) if al>29 { instance_create(x,y,obiekt2) al=0 } 3. GML (Step) if keyboard_check_pressed(strzal) { if al<30 al+=1 } else al=0
-
Spróbuje użyć debugera, ale kod to się sam taki długi zrobił. ;) Nie chciało mi się za ardzo pisać to skopiowałem funkcje tworzenia okna, ale krótszym kodem to chyba nie idzie tego zrobić.
-
Ale musisz ją prędzej narysować w Edytorze Path'ów.
-
Gdzie dzielę przez zero? Nie mogę tego znaleść, chyba, że x=x/buf.
-
Kompiluje w Code::Blocks, po kompilacji, ostrzeżenia się usuwają i nie mogę ich przejrzeć, ale mam pomysł, specjalnie zrobię błąd, to może uda mi się przeczytać. E: Jedno variable unused i jedno statement has no effect.
-
Piszę kalkulator w C++, i jak ma mi podać wynik, wyskakuje okienko "Nie wysyłaj", kod plik to: #include <windows.h> #include <string> #include <cmath> #define ID_PRZYCISK16 100 #define ID_PRZYCISK15 101 #define ID_PRZYCISK14 102 #define ID_PRZYCISK13 103 #define ID_PRZYCISK12 104 #define ID_PRZYCISK11 105 #define ID_PRZYCISK10 106 #define ID_PRZYCISK9 107 #define ID_PRZYCISK8 108 #define ID_PRZYCISK7 109 #define ID_PRZYCISK6 110 #define ID_PRZYCISK5 111 #define ID_PRZYCISK4 112 #define ID_PRZYCISK3 113 #define ID_PRZYCISK2 114 #define ID_PRZYCISK1 115 using namespace std; HWND hPrz1; HWND hPrz2; HWND hPrz3; HWND hPrz4; HWND hPrz5; HWND hPrz6; HWND hPrz7; HWND hPrz8; HWND hPrz9; HWND hPrzRown; HWND hPrzycX; HWND hPrzycX2; HWND hPrzDz; HWND hPrzRaz; HWND hPrzDod; HWND hPrzMin; HWND hRownanie; HWND hwnd; HWND hWynik; WNDPROC g_OldWndProc; HDC S1; HDC S2; const char* bufor; int dl; std::string strTekst; int a; int b; int c; int s; int ss; long double x; long double xx; int bb; int buf; int zmienna; int ost=0; int zmiennab; int zmiennaa; int zmiennac; int x1; int x2; int pot(int d,int e) { int f=d; int g; for(g;g<e;g++) { d=d*f; } return d; }; int liczrown1(int a,int b, int c); int liczrown1(int a,int b, int c) { int s; int ss; long double x; long double xx; int bb; int buf; s=pot(b,2)-4*a*c; ss=4*a; ss=ss*c; s=s-ss; bb=b*-1; buf=2*a; if (s>0) { x=bb-pow(s,0.5); x=x/buf; } if (s==0) { x=bb/buf; } if (s<0) { x=0; } return x; } int liczrown2(int a,int b ,int c) { int s; int ss; long double x; long double xx; int bb; int buf; s=pot(b,2)-4*a*c; ss=4*a; ss=ss*c; s=s-ss; bb=b*-1; buf=2*a; if (s>0) { xx=bb+pow(s,0.5); xx=x/buf; } return xx; } /* Declare Windows procedure */ LRESULT CALLBACK NewWndProc( HWND hwnd, UINT mesg, WPARAM wParam, LPARAM lParam ); LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM); /* Make the class name into a global variable */ char szClassName[ ] = "CodeBlocksWindowsApp"; int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nCmdShow) { /* This is the handle for our window */ MSG messages; /* Here messages to the application are saved */ WNDCLASSEX wincl; /* Data structure for the windowclass */ /* The Window structure */ wincl.hInstance = hThisInstance; wincl.lpszClassName = szClassName; wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */ wincl.style = CS_DBLCLKS; /* Catch double-clicks */ wincl.cbSize = sizeof (WNDCLASSEX); /* Use default icon and mouse-pointer */ wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION); wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION); wincl.hCursor = LoadCursor (NULL, IDC_ARROW); wincl.lpszMenuName = NULL; /* No menu */ wincl.cbClsExtra = 0; /* No extra bytes after the window class */ wincl.cbWndExtra = 0; /* structure or the window instance */ /* Use Windows's default colour as the background of the window */ wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND; /* Register the window class, and if it fails quit the program */ if (!RegisterClassEx (&wincl)) return 0; /* The class is registered, let's create the program*/ hwnd = CreateWindowEx ( 0, /* Extended possibilites for variation */ szClassName, /* Classname */ "Code::Blocks Template Windows App", /* Title Text */ WS_OVERLAPPEDWINDOW, /* default window */ CW_USEDEFAULT, /* Windows decides the position */ CW_USEDEFAULT, /* where the window ends up on the screen */ 544, /* The programs width */ 375, /* and height in pixels */ HWND_DESKTOP, /* The window is a child-window to desktop */ NULL, /* No menu */ hThisInstance, /* Program Instance handler */ NULL /* No Window Creation data */ ); /* Make the window visible on the screen */ ShowWindow (hwnd, nCmdShow); hPrz1=CreateWindowEx ( 0, /* Extended possibilites for variation */ "BUTTON", /* Classname */ "1", /* Title Text */ WS_CHILD | WS_VISIBLE, /* default window */ 0, /* Windows decides the position */ 50, /* where the window ends up on the screen */ 50, /* The programs width */ 50, /* and height in pixels */ hwnd, /* The window is a child-window to desktop */ (HMENU) ID_PRZYCISK1, /* No menu */ hThisInstance, /* Program Instance handler */ NULL /* No Window Creation data */ ); hPrz2=CreateWindowEx ( 0, /* Extended possibilites for variation */ "BUTTON", /* Classname */ "2", /* Title Text */ WS_CHILD | WS_VISIBLE, /* default window */ 50, /* Windows decides the position */ 50, /* where the window ends up on the screen */ 50, /* The programs width */ 50, /* and height in pixels */ hwnd, /* The window is a child-window to desktop */ (HMENU) ID_PRZYCISK2, /* No menu */ hThisInstance, /* Program Instance handler */ NULL /* No Window Creation data */ ); hPrz3=CreateWindowEx ( 0, /* Extended possibilites for variation */ "BUTTON", /* Classname */ "3", /* Title Text */ WS_CHILD | WS_VISIBLE, /* default window */ 100, /* Windows decides the position */ 50, /* where the window ends up on the screen */ 50, /* The programs width */ 50, /* and height in pixels */ hwnd, /* The window is a child-window to desktop */ (HMENU) ID_PRZYCISK3, /* No menu */ hThisInstance, /* Program Instance handler */ NULL /* No Window Creation data */ ); hPrz4=CreateWindowEx ( 0, /* Extended possibilites for variation */ "BUTTON", /* Classname */ "4", /* Title Text */ WS_CHILD | WS_VISIBLE, /* default window */ 0, /* Windows decides the position */ 100, /* where the window ends up on the screen */ 50, /* The programs width */ 50, /* and height in pixels */ hwnd, /* The window is a child-window to desktop */ (HMENU) ID_PRZYCISK4, /* No menu */ hThisInstance, /* Program Instance handler */ NULL /* No Window Creation data */ ); hPrz5=CreateWindowEx ( 0, /* Extended possibilites for variation */ "BUTTON", /* Classname */ "5", /* Title Text */ WS_CHILD | WS_VISIBLE, /* default window */ 50, /* Windows decides the position */ 100, /* where the window ends up on the screen */ 50, /* The programs width */ 50, /* and height in pixels */ hwnd, /* The window is a child-window to desktop */ (HMENU) ID_PRZYCISK5, /* No menu */ hThisInstance, /* Program Instance handler */ NULL /* No Window Creation data */ ); hPrz6=CreateWindowEx ( 0, /* Extended possibilites for variation */ "BUTTON", /* Classname */ "6", /* Title Text */ WS_CHILD | WS_VISIBLE, /* default window */ 100, /* Windows decides the position */ 100, /* where the window ends up on the screen */ 50, /* The programs width */ 50, /* and height in pixels */ hwnd, /* The window is a child-window to desktop */ (HMENU) ID_PRZYCISK6, /* No menu */ hThisInstance, /* Program Instance handler */ NULL /* No Window Creation data */ ); hPrz7=CreateWindowEx ( 0, /* Extended possibilites for variation */ "BUTTON", /* Classname */ "7", /* Title Text */ WS_CHILD | WS_VISIBLE, /* default window */ 0, /* Windows decides the position */ 150, /* where the window ends up on the screen */ 50, /* The programs width */ 50, /* and height in pixels */ hwnd, /* The window is a child-window to desktop */ (HMENU) ID_PRZYCISK7, /* No menu */ hThisInstance, /* Program Instance handler */ NULL /* No Window Creation data */ ); hPrz8=CreateWindowEx ( 0, /* Extended possibilites for variation */ "BUTTON", /* Classname */ "8", /* Title Text */ WS_CHILD | WS_VISIBLE, /* default window */ 50, /* Windows decides the position */ 150, /* where the window ends up on the screen */ 50, /* The programs width */ 50, /* and height in pixels */ hwnd, /* The window is a child-window to desktop */ (HMENU) ID_PRZYCISK8, /* No menu */ hThisInstance, /* Program Instance handler */ NULL /* No Window Creation data */ ); hPrz9=CreateWindowEx ( 0, /* Extended possibilites for variation */ "BUTTON", /* Classname */ "9", /* Title Text */ WS_CHILD | WS_VISIBLE, /* default window */ 100, /* Windows decides the position */ 150, /* where the window ends up on the screen */ 50, /* The programs width */ 50, /* and height in pixels */ hwnd, /* The window is a child-window to desktop */ (HMENU) ID_PRZYCISK9, /* No menu */ hThisInstance, /* Program Instance handler */ NULL /* No Window Creation data */ ); hPrzRown=CreateWindowEx ( 0, /* Extended possibilites for variation */ "BUTTON", /* Classname */ "=", /* Title Text */ WS_CHILD | WS_VISIBLE, /* default window */ 0, /* Windows decides the position */ 200, /* where the window ends up on the screen */ 150, /* The programs width */ 50, /* and height in pixels */ hwnd, /* The window is a child-window to desktop */ (HMENU) ID_PRZYCISK13, /* No menu */ hThisInstance, /* Program Instance handler */ NULL /* No Window Creation data */ ); hPrzycX=CreateWindowEx ( 0, /* Extended possibilites for variation */ "BUTTON", /* Classname */ "X", /* Title Text */ WS_CHILD | WS_VISIBLE, /* default window */ 150, /* Windows decides the position */ 50, /* where the window ends up on the screen */ 50, /* The programs width */ 50, /* and height in pixels */ hwnd, /* The window is a child-window to desktop */ (HMENU) ID_PRZYCISK10, /* No menu */ hThisInstance, /* Program Instance handler */ NULL /* No Window Creation data */ ); hPrzycX2=CreateWindowEx ( 0, /* Extended possibilites for variation */ "BUTTON", /* Classname */ "X^2", /* Title Text */ WS_CHILD | WS_VISIBLE, /* default window */ 150, /* Windows decides the position */ 100, /* where the window ends up on the screen */ 50, /* The programs width */ 50, /* and height in pixels */ hwnd, /* The window is a child-window to desktop */ (HMENU) ID_PRZYCISK11, /* No menu */ hThisInstance, /* Program Instance handler */ NULL /* No Window Creation data */ ); //hPrzDz=CreateWindowEx ( // 0, /* Extended possibilites for variation */ // "BUTTON", /* Classname */ // "/", /* Title Text */ // WS_CHILD | WS_VISIBLE, /* default window */ // 220, /* Windows decides the position */ // 150, /* where the window ends up on the screen */ // 50, /* The programs width */ // 50, /* and height in pixels */ // hwnd, /* The window is a child-window to desktop */ // NULL, /* No menu */ // hThisInstance, /* Program Instance handler */ // NULL /* No Window Creation data */ // ); //hPrzRaz=CreateWindowEx ( // 0, /* Extended possibilites for variation */ // "BUTTON", /* Classname */ // "*", /* Title Text */ // WS_CHILD | WS_VISIBLE, /* default window */ // 220, /* Windows decides the position */ //200, /* where the window ends up on the screen */ // 50, /* The programs width */ //50, /* and height in pixels */ // hwnd, /* The window is a child-window to desktop */ // NULL, /* No menu */ // hThisInstance, /* Program Instance handler */ // NULL /* No Window Creation data */ // ); /* Run the message loop. It will run until GetMessage() returns 0 */ //hPrzMin=CreateWindowEx ( //0, /* Extended possibilites for variation */ //"BUTTON", /* Classname */ //"-", /* Title Text */ //WS_CHILD | WS_VISIBLE, /* default window */ //220, /* Windows decides the position */ // 100, /* where the window ends up on the screen */ // 50, /* The programs width */ // 50, /* and height in pixels */ // hwnd, /* The window is a child-window to desktop */ // NULL, /* No menu */ // hThisInstance, /* Program Instance handler */ // NULL /* No Window Creation data */ // ); hPrzDod=CreateWindowEx ( 0, /* Extended possibilites for variation */ "BUTTON", /* Classname */ "+", /* Title Text */ WS_CHILD | WS_VISIBLE, /* default window */ 220, /* Windows decides the position */ 50, /* where the window ends up on the screen */ 50, /* The programs width */ 50, /* and height in pixels */ hwnd, /* The window is a child-window to desktop */ (HMENU) ID_PRZYCISK12, /* No menu */ hThisInstance, /* Program Instance handler */ NULL /* No Window Creation data */ ); hRownanie=CreateWindowEx ( 0, /* Extended possibilites for variation */ "STATIC", /* Classname */ "", /* Title Text */ WS_CHILD | WS_VISIBLE, /* default window */ 0, /* Windows decides the position */ 0, /* where the window ends up on the screen */ 270, /* The programs width */ 50, /* and height in pixels */ hwnd, /* The window is a child-window to desktop */ NULL, /* No menu */ hThisInstance, /* Program Instance handler */ NULL /* No Window Creation data */ ); hWynik=CreateWindowEx ( 0, /* Extended possibilites for variation */ "STATIC", /* Classname */ "", /* Title Text */ WS_CHILD | WS_VISIBLE, /* default window */ 0, /* Windows decides the position */ 250, /* where the window ends up on the screen */ 270, /* The programs width */ 50, /* and height in pixels */ hwnd, /* The window is a child-window to desktop */ NULL, /* No menu */ hThisInstance, /* Program Instance handler */ NULL /* No Window Creation data */ ); S1=GetDC(hRownanie); S2=GetDC(hWynik); while (GetMessage (&messages, NULL, 0, 0)) { /* Translate virtual-key messages into character messages */ TranslateMessage(&messages); /* Send message to WindowProcedure */ DispatchMessage(&messages); } /* The program return-value is 0 - The value that PostQuitMessage() gave */ return messages.wParam; } /* This function is called by the Windows function DispatchMessage() */ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) /* handle the messTextOut (S1,0, 0, bufor,dl);ages */ { case WM_COMMAND: switch( wParam ) { case 100:break; case 101:break; case 102:break; case 103: strTekst+="=0"; dl++; dl++; bufor=strTekst.c_str(); TextOut (S1,0, 0, bufor,dl); ost=0; x1=liczrown1(zmiennaa,zmiennab,zmiennac); x2=liczrown2(zmiennaa,zmiennab,zmiennac); int s; int ss; long double x; long double xx; int bb; int buf; s=pot(b,2)-4*a*c; ss=4*a; ss=ss*c; s=s-ss; bb=b*-1; buf=2*a; if (s>0) { x=bb-pow(s,0.5); x=x/buf; } if (s==0) { x=bb/buf; } if (s<0) { x=0; } x1=(char) x; MessageBox(hwnd,(const char*) x1,"WYNIK",NULL ); break; case 104:if (dl<33) { if (dl!=0) { if (ost==0) { zmiennac+=zmienna; zmienna=0; } strTekst+="+"; dl++; bufor=strTekst.c_str(); TextOut (S1,0, 0, bufor,dl); ost=0; } } break; break; case 105:if (dl<33) { if (ost==0) { if (zmienna==0) { zmiennaa+=1; } else { zmiennaa+=zmienna; zmienna=0; } strTekst+="x^2"; dl++; dl++; dl++; bufor=strTekst.c_str(); TextOut (S1,0, 0, bufor,dl); ost=2; } } break; case 106:if (dl<33) { if (ost==0) { if (zmienna==0) { zmiennab+=1; } else { zmiennab+=zmienna; zmienna=0; } strTekst+="x"; dl++; bufor=strTekst.c_str(); TextOut (S1,0, 0, bufor,dl); ost=1; } } break; break; case 107: if (dl<33) { if (ost==0) { if (zmienna==0) { zmienna=9; } else { zmienna=zmienna*10+9; } strTekst+="9"; dl++; bufor=strTekst.c_str(); TextOut (S1,0, 0, bufor,dl); ost=0; } else { MessageBox(hwnd,"B??d","Okropny",NULL ); } } break; case 108: if (dl<33) { if (ost==0) { if (zmienna==0) { zmienna=8; } else { zmienna=zmienna*10+8; } strTekst+="8"; dl++; bufor=strTekst.c_str(); TextOut (S1,0, 0, bufor,dl); ost=0; } else { MessageBox(hwnd,"B??d","Okropny",NULL ); } break; case 109: if (dl<33) { if (ost==0) { if (zmienna==0) { zmienna=7; } else { zmienna=zmienna*10+7; } strTekst+="7"; dl++; bufor=strTekst.c_str(); TextOut (S1,0, 0, bufor,dl); ost=0; } else { MessageBox(hwnd,"B??d","Okropny",NULL ); } }break; case 110: if (dl<33) { if (ost==0) { if (zmienna==0) { zmienna=6; } else { zmienna=zmienna*10+6; } strTekst+="6"; dl++; bufor=strTekst.c_str(); TextOut (S1,0, 0, bufor,dl); ost=0; } else { MessageBox(hwnd,"B??d","Okropny",NULL ); } } break; case 111: if (dl<33) { if (ost==0) { if (zmienna==0) { zmienna=5; } else { zmienna=zmienna*10+5; } strTekst+="5"; dl++; bufor=strTekst.c_str(); TextOut (S1,0, 0, bufor,dl); ost=0; } else { MessageBox(hwnd,"B??d","Okropny",NULL ); } } break; case 112: if (dl<33) { if (ost==0) { if (zmienna==0) { zmienna=4; } else { zmienna=zmienna*10+4; } strTekst+="4"; dl++; bufor=strTekst.c_str(); TextOut (S1,0, 0, bufor,dl); ost=0; } else { MessageBox(hwnd,"B??d","Okropny",NULL ); } }break; case 113: if (dl<33) { if (ost==0) { if (zmienna==0) { zmienna=3; } else { zmienna=zmienna*10+3; } strTekst+="3"; dl++; bufor=strTekst.c_str(); TextOut (S1,0, 0, bufor,dl); ost=0; } else { MessageBox(hwnd,"B??d","Okropny",NULL ); } } break; case 114: if (dl<33) { if (ost==0) { if (zmienna==0) { zmienna=2; } else { zmienna=zmienna*10+2; } strTekst+="2"; dl++; bufor=strTekst.c_str(); TextOut (S1,0, 0, bufor,dl); ost=0; } else { MessageBox(hwnd,"B??d","Okropny",NULL ); } }break; case 115: if (dl<33) { if (ost==0) { if (zmienna==0) { zmienna=1; } else { zmienna=zmienna*10+1; } strTekst+="1"; dl++; bufor=strTekst.c_str(); TextOut (S1,0, 0, bufor,dl); ost=0; } else { MessageBox(hwnd,"B??d","Okropny",NULL ); } } break; }} break; case WM_DESTROY: PostQuitMessage (0); /* send a WM_QUIT to the message queue */ break; default: /* for messages that we don't deal with */ return DefWindowProc (hwnd, message, wParam, lParam); } return 0; } , błędów, nie ma jest za to kilka ostrzeżeń, których nie zdążyłem przeczytać.
-
Ja też się czeszę - na każdego sylwestra.
-
Możesz dodać wydarzenia losowe np. na początku gry jest tylko sieć ale, jak użytkownik kupi sobie np.CD-Rom, zwiększa się ilość wejść wirusów.
-
GML (Step) move_towards_point(gracz.x,y,speed) if point_distance(x.gracz,y.gracz)<40 { poc=instance_create(x,y,pocisk) kat=point_direction(gracz.x,gracz.y) poc.direction=kat reka.image_angle=kat } E:Za wolno pisałem, proszę o usunięcie posta.
-
Ja moją wysłałem.
-
Dzięki, działa. Ach - zapomniałem o jeszcze jednym, mianowicie, jak używam pliku .rc o treści: 200 MENU { POPUP "Nowy" { } POPUP "Zapisz" { } POPUP "Otwórz" { } POPUP "" { } POPUP "Importuj" { MENUITEM "Tekst", IDM_TEKST1 POPUP "Obraz" { MENUITEM "JPEG", IDM_JPEG1 MENUITEM "Bitmapa", IDM_BITMAPA1 } } POPUP "" { } POPUP "Koniec" { } } w programie o kodzie: #include <windows.h> #include "res.rc" /* Declare Windows procedure */ LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM); HWND hwnd; MSG messages; WNDCLASSEX wincl; /* Make the class name into a global variable */ char szClassName[ ] = "CodeBlocksWindowsApp"; int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nCmdShow) { /* This is the handle for our window */ /* Data structure for the windowclass */ /* The Window structure */ wincl.hInstance = hThisInstance; wincl.lpszClassName = szClassName; wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */ wincl.style = CS_DBLCLKS; /* Catch double-clicks */ wincl.cbSize = sizeof (WNDCLASSEX); /* Use default icon and mouse-pointer */ wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION); wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION); wincl.hCursor = LoadCursor (NULL, IDC_ARROW); wincl.lpszMenuName = NULL; /* No menu */ wincl.cbClsExtra = 0; /* No extra bytes after the window class */ wincl.cbWndExtra = 0; /* structure or the window instance */ /* Use Windows's default colour as the background of the window */ wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND; /* Register the window class, and if it fails quit the program */ if (!RegisterClassEx (&wincl)) return 0; /* The class is registered, let's create the program*/ HMENU hMenu = LoadMenu( hThisInstance, MAKEINTRESOURCE( 200) ); hwnd = CreateWindowEx ( 0, /* Extended possibilites for variation */ szClassName, /* Classname */ "Code::Blocks Template Windows App", /* Title Text */ WS_OVERLAPPEDWINDOW, /* default window */ CW_USEDEFAULT, /* Windows decides the position */ CW_USEDEFAULT, /* where the window ends up on the screen */ 544, /* The programs width */ 375, /* and height in pixels */ HWND_DESKTOP, /* The window is a child-window to desktop */ hMenu, /* No menu */ hThisInstance, /* Program Instance handler */ NULL /* No Window Creation data */ ); /* Make the window visible on the screen */ ShowWindow (hwnd, nCmdShow); /* Run the message loop. It will run until GetMessage() returns 0 */ while (GetMessage (&messages, NULL, 0, 0)) { /* Translate virtual-key messages into character messages */ TranslateMessage(&messages); /* Send message to WindowProcedure */ DispatchMessage(&messages); } /* The program return-value is 0 - The value that PostQuitMessage() gave */ return messages.wParam; } /* This function is called by the Windows function DispatchMessage() */ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) /* handle the messages */ { case WM_DESTROY: PostQuitMessage (0); /* send a WM_QUIT to the message queue */ break; default: /* for messages that we don't deal with */ return DefWindowProc (hwnd, message, wParam, lParam); } return 0; } to C::B wywala błąd: w\ghhjggjgjgj\res.rc|16|error: expected unqualified-id before numeric constant| ||=== Build finished: 1 errors, 0 warnings ===| Jak temu zaradzić? E:Dobra już wiem, wystarczyło tylko usunąć linijkę #include "res.rc", teraz mam następny problem, a mianowicie mam trzy pliki: -res.rc: #include <windows.h> IDD_PASEK DIALOGEX 0, 0, 98, 52 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION EXSTYLE WS_EX_TOOLWINDOW CAPTION "Mój pasek narzędzi" FONT 8, "MS Sans Serif" { PUSHBUTTON "&Pierwszy przycisk", IDC_PRZYC1, 7, 7, 84, 14 PUSHBUTTON "&Drugi przycisk", IDC_PRZYC2, 7, 31, 84, 14 PUSHBUTTON "&Trzeci przycisk", IDC_PRZYC3, 7, 31, 84, 14 } -pasek.h: #define IDD_PASEK 200 #define IDC_PRZYC1 201 #define IDC_PRZYC1 202 #define IDC_PRZYC1 203 oraz - main.cpp: #include <string> #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <windowsx.h> HWND hPrzyc; HWND hwnd; /* This is the handle for our window */ MSG messages; MSG msg; /* Here messages to the application are saved */ WNDCLASSEX wincl; HWND hPasek; HWND dial; /* Declare Windows procedure */ LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM); BOOL CALLBACK DlgProc( HWND, UINT, WPARAM, LPARAM ); /* Make the class name into a global variable */ char szClassName[ ] = "CodeBlocksWindowsApp"; int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil) { /* Data structure for the windowclass */ /* The Window structure */ wincl.hInstance = hThisInstance; wincl.lpszClassName = szClassName; wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */ wincl.style = CS_DBLCLKS; /* Catch double-clicks */ wincl.cbSize = sizeof (WNDCLASSEX); /* Use default icon and mouse-pointer */ wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION); wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION); wincl.hCursor = LoadCursor (NULL, IDC_ARROW); wincl.lpszMenuName = NULL; /* No menu */ wincl.cbClsExtra = 0; /* No extra bytes after the window class */ wincl.cbWndExtra = 0; /* structure or the window instance */ /* Use Windows's default colour as the background of the window */ wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND; /* Register the window class, and if it fails quit the program */ if (!RegisterClassEx (&wincl)) return 0; /* The class is registered, let's create the program*/ hwnd = CreateWindowEx ( 0, /* Extended possibilites for variation */ szClassName, /* Classname */ "Code::Blocks Template Windows App", /* Title Text */ WS_OVERLAPPEDWINDOW, /* default window */ CW_USEDEFAULT, /* Windows decides the position */ CW_USEDEFAULT, /* where the window ends up on the screen */ 544, /* The programs width */ 375, /* and height in pixels */ HWND_DESKTOP, /* The window is a child-window to desktop */ NULL, /* No menu */ hThisInstance, /* Program Instance handler */ NULL /* No Window Creation data */ ); /* Make the window visible on the screen */ ShowWindow (hwnd, nFunsterStil); hPrzyc = CreateWindowEx( 0, "BUTTON", "Dialog", WS_CHILD | WS_VISIBLE, 5, 5, 50, 25, hwnd, NULL, hThisInstance, NULL ); /* Run the message loop. It will run until GetMessage() returns 0 */ while (GetMessage (&messages, NULL, 0, 0)) { if( !IsDialogMessage( hPasek, & msg ) ) { TranslateMessage( & msg ); DispatchMessage( & msg ); } } /* The program return-value is 0 - The value that PostQuitMessage() gave */ return messages.wParam; } /* This function is called by the Windows function DispatchMessage() */ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) /* handle the messages */ { case WM_COMMAND: { // Tutaj wywołujemy nasz dialog CreateDialog(GetModuleHandle( NULL ), MAKEINTRESOURCE(200), hwnd,DlgProc ); } break; case WM_DESTROY: PostQuitMessage (0); /* send a WM_QUIT to the message queue */ break; default: /* for messages that we don't deal with */ return DefWindowProc (hwnd, message, wParam, lParam); } return 0; } BOOL CALLBACK DlgProc( HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam ) { switch( Msg ) { case WM_INITDIALOG: { } break; case WM_COMMAND: {// reakcja na przyciski } break; default: return FALSE; } return TRUE; } . Problem tkwi w tym, iż nie kompiluje się, i wyskakuje błąd: E:\Pulpit\DOKUME~1\PROJEK~1\GHHJGG~1\res.rc|9|syntax error| , gdy wywale te "pushbuttony" (chodzi mi o te trzy linijki zaczynające się od słowa "pushbutton") kompiluje się, lecz nie wyświetla niemodalnego dialogu, a okno jest "nieaktywne", tzn. nie reaguje nawet na zamknięcie krzyżykiem, ani alt+F4.
-
Automatyczne używnie myszki przez program.
kt1117 odpowiedział(a) na Muchaszewski temat w Pytania początkujących
Można napisać takiego dll'a w C++. Chociaż już próbowałem i mi nie wychodziło (ale to ze względu na g*****e IDE, czyli Dev-Cpp). -
Bitamper
kt1117 odpowiedział(a) na iczigo temat w Gotowe Skrypty, przykłady, dodatki, silniki 3D dla GM
I nic nie stoi na przeszkodzie, żeby urozmaicić ten szyfr np. przez dodanie losowości. -
Spróbuj znaleźć polskiego softa ręcznie, albo może jest jakieś spolszczenie.
-
Może masz mobilne IP?
-
Źle skopiowałem kod(Rozsypał się po wklejeniu na linijki), zaraz dam Edita. E: Naprawiłem i działa, zaraz dam edita i powiem jak. E2: Odnoszę się do dobrego uchwytu, kodu nie wkleje, bo nie chce mi się go potem układać. E3: Jeszcze ostatnie pytanie. Co zrobić, żeby w tle nie było okienka konsoli?
-
Mam taki kod: #include <windows.h> HWND uchwytdookna; //uchwyt okna HDC hdc; HPEN hpenZoltePioro; HPEN hpenStarePioro; HBRUSH pedzel=CreateSolidBrush(RGB (255,90,45)); //Procedura zdarzeniowa LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_DESTROY: PostQuitMessage (0); break; case WM_PAINT: hdc=BeginPaint(uchwytdookna,0); hpenZoltePioro = CreatePen(PS_SOLID, 50, RGB(0, 0, 0)); hpenStarePioro = (HPEN) SelectObject(hdc, hpenZoltePioro); MoveToEx(hdc,0,0,0); LineTo (hdc,50,80);//czemu nie ma linii EndPaint(uchwytdookna,0); break; default: return DefWindowProc (hwnd, message, wParam, lParam); } return 0; } //Klasa okna char szClassName[ ] = "CodeBlocksWindowsApp"; int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nCmdShow) { MSG messages; WNDCLASSEX wincl; wincl.hInstance = hThisInstance; wincl.lpszClassName = szClassName; wincl.lpfnWndProc = WindowProcedure; wincl.style = CS_DBLCLKS; wincl.cbSize = sizeof (WNDCLASSEX); wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION); wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION); wincl.hCursor = LoadCursor (NULL, IDC_ARROW); wincl.lpszMenuName = NULL; wincl.cbClsExtra = 0; wincl.cbWndExtra = 0; wincl.hbrBackground = (HBRUSH) pedzel; if (!RegisterClassEx (&wincl)) return 0; uchwytdookna = CreateWindowEx ( 0, szClassName, "Tytuł", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 544, 375, HWND_DESKTOP, NULL, hThisInstance, NULL ); ShowWindow (uchwytdookna, nCmdShow); while (GetMessage (&messages, NULL, 0, 0)) { TranslateMessage(&messages); DispatchMessage(&messages); } return messages.wParam; } i nie wywala błędu, lecz nie rysuje linii, dlaczego? (Dopiero uczę się GDI )
-
Nie jedz mojej księżniczki Panie Smoku! v.0.16
kt1117 odpowiedział(a) na Newman temat w Dema gier i programów
Ja przeszedłem grę z 357 śmierciami. -
To powiedz jak zrobiłeś, żeby i całe forum olśniło. B)
-
Może pomoże Ci ten temat:Tu
-
A może poczekaj przed komputerem z włączonym netem 20 min. i jak pokaże się okienko "Auto-rozłączania" wciśnij "Nie używaj auto-rozłączania" .
-
No nie przesadzaj 2 obiekty to nie kilkadziesiąt. W Draw samochodu jest kod pokazujący takie żółte kółka symbolizujące migacze. Tam są użyte lengdir'y. E: Sorry, nie dwa, ale reszta (poniżej tych 2 pierwszych)jest do zmiany sterowania. E2: Jak chcesz mogę Ci to zrobić bez użycia żadnego klocka, ale nie wiem czy wtedy łatwiej będzie zrozumieć.
-
W Windows XP, można to zmienić w ustawieniach ekranu, na zakładce Wygaszacz ekranu odznaczasz "Po wznowieniu pokaż ekran powitalny", może w 7 nie zmienili tego.