Skocz do zawartości

Dołącz do społeczności!

👋 Witaj na MPCForum!

Przeglądasz forum jako gość, co oznacza, że wiele świetnych funkcji jest jeszcze przed Tobą! 😎

  • ✅ Pełny dostęp do działów i ukrytych treści
  • ✅ Możliwość pisania i odpowiadania w tematach
  • ✅ System prywatnych wiadomości
  • ✅ Zbieranie reputacji i rozwijanie swojego profilu
  • ✅ Członkostwo w jednej z największych społeczności graczy

👉 Dołączenie zajmie Ci mniej niż minutę – a zyskasz znacznie więcej!

Zarejestruj się teraz

C++ Open Close

Rekomendowane odpowiedzi

Opublikowano

Mam pytanie mam program i chce zrobić tak

1.button nazwa zamknij (to już mam i wiem jak to zrobić) który zamyka aplikacje

2.po naciśnięciu buttona wyskakuje message box i jeszcze sie pyta czy napewno zamknąć jak to zrobić i są jeszcze 2 buttony 1. tak drugi .nie

 

chce to w c++ 2010 miscrosoft

 

będą plusy !!!!

 

 

!!!!!

Opublikowano

if (Messagebox(0,"Czy na pewno?", "Pytanie", MB_YESNO)==IDYES)

{

// tutaj twoj kod wyjscia z programu

}

pierdut.pl/pytanie-27-oddam_konto_do_metina_za_darmo

Opublikowano
  • Autor

if (Messagebox(0,"Czy na pewno?", "Pytanie", MB_YESNO)==IDYES)

{

// tutaj twoj kod wyjscia z programu

}

dałęm plusa ale jak to wklejam to mam 3 błędy że jest a zresztą masz tu te 3 błędy to zobaczysz

 

1>------ Build started: Project: instrukcja yeah, Configuration: Debug Win32 ------
1>  instrukcja yeah.cpp
1>c:\users\user\desktop\nowy folder (2)\instrukcja yeah\instrukcja yeah\Form1.h(186): error C2653: 'Messagebox' : is not a class or namespace name
1>c:\users\user\desktop\nowy folder (2)\instrukcja yeah\instrukcja yeah\Form1.h(186): error C2065: 'MB_YESNO' : undeclared identifier
1>c:\users\user\desktop\nowy folder (2)\instrukcja yeah\instrukcja yeah\Form1.h(186): error C2065: 'IDYES' : undeclared identifier
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Opublikowano

#include <windows.h>

/*  Declare Windows procedure  */
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
HWND g_hZamknij;
/*  Make the class name into a global variable  */
char szClassName[ ] = "WindowsApp";

int WINAPI WinMain (HINSTANCE hThisInstance,
                   HINSTANCE hPrevInstance,
                   LPSTR lpszArgument,
                   int nFunsterStil)

{
   HWND hwnd;               /* 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 color 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 */
          "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 */
          );
   // PRZYCISK ZAMKNIJ ******************************************************
   g_hZamknij = CreateWindowEx(0, "BUTTON", "Zamknij", WS_CHILD | WS_VISIBLE,
   5, 5, 150, 30, hwnd, NULL, hThisInstance, NULL);
   // ***********************************************************************
   /* Make the window visible on the screen */
   ShowWindow (hwnd, nFunsterStil);

   /* 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_COMMAND:
            if((HWND) lParam == g_hZamknij)
                if (MessageBox(0,"Czy na pewno?", "Pytanie", MB_YESNO)==IDYES)
                   {
                   SendMessage(hwnd, WM_DESTROY, wParam, lParam);
                   }
             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;
}

 

Trzymaj, w dev c++ dziala, w microsoft visual c++ pewnie będziesz musiał zmienić we właściwościach z unicode na multi-byte.

RAsfepN.png
Opublikowano
  • Autor

ja robie program w c++ i windows form aplication mam juz takie okno na którym wszystko widzę co się dzieje a to co dałes to tyle errorów mi wyskoczyło że oje&&&*** masz tu cały kod programy a klawisz czyli button 4 ma zamykać aplikacje ż tym że ma sie pytać i ma wyskoczyc okenko z zapytaniem tak lub nie jak zroi okno i zamknąc to ja wiem ale jak zrobić żeby w jednym oknie byłu 2 buttony i każdy miał inną funkcje ??? tu jest cały kod programu z tym twoim co mi tyle errorów wyskoczyło

 #pragma once

namespace instrukcjayeah {

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;

    /// <summary>
/// Summary for Form1
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
	Form1(void)
	{
		InitializeComponent();
		//
		//TODO: Add the constructor code here
		//
	}

protected:
	/// <summary>
	/// Clean up any resources being used.
	/// </summary>
	~Form1()
	{
		if (components)
		{
			delete components;
		}
	}
private: System::Windows::Forms::Button^  button1;
protected: 
private: System::Windows::Forms::Button^  button2;
private: System::Windows::Forms::Button^  button3;
private: System::Windows::Forms::Button^  button4;
private: System::Windows::Forms::Button^  button5;
private: System::Windows::Forms::Button^  button6;


private: 
















private:
	/// <summary>
	/// Required designer variable.
	/// </summary>
	System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
	/// <summary>
	/// Required method for Designer support - do not modify
	/// the contents of this method with the code editor.
	/// </summary>
	void InitializeComponent(void)
	{
		this->button1 = (gcnew System::Windows::Forms::Button());
		this->button2 = (gcnew System::Windows::Forms::Button());
		this->button3 = (gcnew System::Windows::Forms::Button());
		this->button4 = (gcnew System::Windows::Forms::Button());
		this->button5 = (gcnew System::Windows::Forms::Button());
		this->button6 = (gcnew System::Windows::Forms::Button());
		this->SuspendLayout();
		// 
		// button1
		// 
		this->button1->BackColor = System::Drawing::Color::Lime;
		this->button1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 8.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
			static_cast<System::Byte>(238)));
		this->button1->ForeColor = System::Drawing::Color::FromArgb(static_cast<System::Int32>(static_cast<System::Byte>(64)), static_cast<System::Int32>(static_cast<System::Byte>(0)), 
			static_cast<System::Int32>(static_cast<System::Byte>(0)));
		this->button1->Location = System::Drawing::Point(12, 22);
		this->button1->Name = L"button1";
		this->button1->Size = System::Drawing::Size(91, 43);
		this->button1->TabIndex = 0;
		this->button1->Text = L"Opcje hacka ";
		this->button1->TextAlign = System::Drawing::ContentAlignment::TopCenter;
		this->button1->UseVisualStyleBackColor = false;
		this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
		// 
		// button2
		// 
		this->button2->BackColor = System::Drawing::Color::Red;
		this->button2->Font = (gcnew System::Drawing::Font(L"Times New Roman", 9, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
			static_cast<System::Byte>(238)));
		this->button2->ForeColor = System::Drawing::Color::Yellow;
		this->button2->Location = System::Drawing::Point(130, 22);
		this->button2->Name = L"button2";
		this->button2->Size = System::Drawing::Size(128, 43);
		this->button2->TabIndex = 1;
		this->button2->Text = L"Adresy użyte do hacka";
		this->button2->UseVisualStyleBackColor = false;
		this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
		// 
		// button3
		// 
		this->button3->ForeColor = System::Drawing::SystemColors::MenuHighlight;
		this->button3->Location = System::Drawing::Point(12, 71);
		this->button3->Name = L"button3";
		this->button3->Size = System::Drawing::Size(75, 61);
		this->button3->TabIndex = 2;
		this->button3->Text = L"Jak uruchomić nie które z opcji Hack ";
		this->button3->UseVisualStyleBackColor = true;
		this->button3->Click += gcnew System::EventHandler(this, &Form1::button3_Click);
		// 
		// button4
		// 
		this->button4->Location = System::Drawing::Point(166, 210);
		this->button4->Name = L"button4";
		this->button4->Size = System::Drawing::Size(102, 40);
		this->button4->TabIndex = 3;
		this->button4->Text = L"Zmaknij";
		this->button4->UseVisualStyleBackColor = true;
		this->button4->Click += gcnew System::EventHandler(this, &Form1::button4_Click_1);
		// 
		// button5
		// 
		this->button5->BackColor = System::Drawing::Color::FromArgb(static_cast<System::Int32>(static_cast<System::Byte>(192)), static_cast<System::Int32>(static_cast<System::Byte>(255)), 
			static_cast<System::Int32>(static_cast<System::Byte>(255)));
		this->button5->BackgroundImageLayout = System::Windows::Forms::ImageLayout::Zoom;
		this->button5->Cursor = System::Windows::Forms::Cursors::Arrow;
		this->button5->Font = (gcnew System::Drawing::Font(L"Snap ITC", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
			static_cast<System::Byte>(0)));
		this->button5->ForeColor = System::Drawing::Color::Red;
		this->button5->Location = System::Drawing::Point(140, 71);
		this->button5->Name = L"button5";
		this->button5->Size = System::Drawing::Size(101, 61);
		this->button5->TabIndex = 4;
		this->button5->Text = L"TUT Jak Zrobić Hacka";
		this->button5->TextAlign = System::Drawing::ContentAlignment::TopCenter;
		this->button5->UseVisualStyleBackColor = false;
		this->button5->Click += gcnew System::EventHandler(this, &Form1::button5_Click);
		// 
		// button6
		// 
		this->button6->BackColor = System::Drawing::Color::FromArgb(static_cast<System::Int32>(static_cast<System::Byte>(128)), static_cast<System::Int32>(static_cast<System::Byte>(255)), 
			static_cast<System::Int32>(static_cast<System::Byte>(128)));
		this->button6->Font = (gcnew System::Drawing::Font(L"Ravie", 9, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point, 
			static_cast<System::Byte>(0)));
		this->button6->Location = System::Drawing::Point(5, 138);
		this->button6->Name = L"button6";
		this->button6->Size = System::Drawing::Size(98, 66);
		this->button6->TabIndex = 5;
		this->button6->Text = L"Hacki do odpalenia";
		this->button6->UseVisualStyleBackColor = false;
		this->button6->Click += gcnew System::EventHandler(this, &Form1::button6_Click);
		// 
		// Form1
		// 
		this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
		this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
		this->BackColor = System::Drawing::Color::FromArgb(static_cast<System::Int32>(static_cast<System::Byte>(128)), static_cast<System::Int32>(static_cast<System::Byte>(255)), 
			static_cast<System::Int32>(static_cast<System::Byte>(255)));
		this->ClientSize = System::Drawing::Size(280, 262);
		this->Controls->Add(this->button6);
		this->Controls->Add(this->button5);
		this->Controls->Add(this->button4);
		this->Controls->Add(this->button3);
		this->Controls->Add(this->button2);
		this->Controls->Add(this->button1);
		this->ForeColor = System::Drawing::Color::FromArgb(static_cast<System::Int32>(static_cast<System::Byte>(0)), static_cast<System::Int32>(static_cast<System::Byte>(64)), 
			static_cast<System::Int32>(static_cast<System::Byte>(0)));
		this->Name = L"Form1";
		this->Text = L"Kamo Instrukcja 0.2 dla MPC";
		this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
		this->ResumeLayout(false);

	}
#pragma endregion
private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
			 MessageBox::Show("1. 5 slot.\n3.premium.\n4.NFD.\n5.Fast All.\n6.No Spawn.\n7.NO Reciol.\n8.No Spread.\n9.Extra Ammo.\n10.FUll Bright.\n11.Speed Hack.\n12.Super Jump.\n13.No Fog.\n14.Scoup.\n15.No Weapone Gravity.");

 }
private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {
			 MessageBox::Show("Slot5 0x1021A4.\nPREMIUM 0x57c.\nNFD 0x103A8.\nfastall_Addie1 0xA483F4.\nNo_Spawn1 0xA4AF5C.\nNo_Spawn2 0xA4AF54.\nNOSPREAD 0xA44F48.\nNORECOIL1 0x1C.\nNORECOIL2 (OFS_NORECOIL1+0x4).\nNORECOIL3 (OFS_NORECOIL1+0x4*2).\nExtra_Ammo1 0xA44F2C.\nFull_Bright_1 0x00A4ADA8.\nFull_Bright_2 0x00A4ADAC.\nFull_Bright_3 0x00A4ADB0.\nSpeed 0x8F37B4.\nOFS_Z czyli super jump 0x102D8.\nGlassWalls_FarFog 0x00A4AE4C.\nNear_Fog 0x00A4AE48.\nSCOPE  0x968618.\nWEAPONGRAVITY 0x008E6EC0");


		 }

private: System::Void button3_Click(System::Object^  sender, System::EventArgs^  e) {
MessageBox::Show("NO weapone Gravity num pad 8.\nNo Spread num pad 7 i tak samo się wyłacza.\nSuper Jump ctrl.\nFull Bright insert trzeba właczyc zawsze po wejściu na plansze.\nScoup PPM.");
	 }
private: System::Void button4_Click_1(System::Object^  sender, System::EventArgs^  e) { 
		 *  Declare Windows procedure  */
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
HWND g_hZamknij;
/*  Make the class name into a global variable  */
char szClassName[ ] = "WindowsApp";

int WINAPI WinMain (HINSTANCE hThisInstance,
                   HINSTANCE hPrevInstance,
                   LPSTR lpszArgument,
                   int nFunsterStil)

{
   HWND hwnd;               /* 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 color 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 */
          "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 */
          );
   // PRZYCISK ZAMKNIJ ******************************************************
   g_hZamknij = CreateWindowEx(0, "BUTTON", "Zamknij", WS_CHILD | WS_VISIBLE,
   5, 5, 150, 30, hwnd, NULL, hThisInstance, NULL);
   // ***********************************************************************
   /* Make the window visible on the screen */
   ShowWindow (hwnd, nFunsterStil);

   /* 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_COMMAND:
            if((HWND) lParam == g_hZamknij)
                if (MessageBox(0,"Czy na pewno?", "Pytanie", MB_YESNO)==IDYES)
                   {
                   SendMessage(hwnd, WM_DESTROY, wParam, lParam);
                   }
             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;
}

{
Close();
} 
	 }
private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
	 }
#pragma endregion
private: System::Void button5_Click(System::Object^  sender, System::EventArgs^  e) {
		 MessageBox::Show("Po pierwsze trzeba znaleść aktualne adresy.\nPo drugie aby napisać hacka trzeba mieć program C++.\nklikamy new project,WIN 32 potem klikamy WIN 32 project dajemy nazwę i klikamy next wyskakuje okienko jeszcze raz next .\n zaznaczamy DLL i potem na dole mamy empty project też zaznaczamy klikamy finish.\n Po lewej stronie znajdujemy zakładkę Source Files klikamy ppm najeżdżamy na add i new item.\n i zaznaczamy C++ File nadajemy nazwę i klikamy finish mamy już nasze pole pracy.\nw 1 linijce wpisujemy #include <windows.h> w drugiej #define player pointer i adres w trzeciej server pointer i adres.");
		 }
		private: System::Void saveFileDialog1_FileOk(System::Object^  sender, System::ComponentModel::CancelEventArgs^  e) {
				 }
private: System::Void linkLabel1_LinkClicked(System::Object^  sender, System::Windows::Forms::LinkLabelLinkClickedEventArgs^  e) {
	 }
private: System::Void textBox1_TextChanged(System::Object^  sender, System::EventArgs^  e) {
	 }
private: System::Void button6_Click(System::Object^  sender, System::EventArgs^  e) {

	 }
};
}

Ostatnio przeglądający 0

  • Brak zarejestrowanych użytkowników przeglądających tę stronę.

Konto

Nawigacja

Skonfiguruj powiadomienia push w przeglądarce

Chrome (Android)
  1. Stuknij ikonę kłódki obok paska adresu.
  2. Stuknij Uprawnienia → Powiadomienia.
  3. Dostosuj swoje ustawienie.
Chrome (Komputer)
  1. Kliknij ikonę kłódki na pasku adresu.
  2. Wybierz Ustawienia witryny.
  3. Znajdź Powiadomienia i dostosuj swoje ustawienie.