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

[Pytanie] Klawiaturka

Rekomendowane odpowiedzi

Opublikowano

Siemka chciałem ostatnio napisać sobie w c++ klawiaturę (mini) taką na kilka guzików, skorzystałem z pewnej opcji c++ aby nie pisać tego całego i wkleiłem jeden BUTTON (przycisk) i teraz chce aby po naciśnięciu na niego było tak jak bym na klawiaturze nacisnął na NUMPAD1 nie wiem jak to zrobić cały kod podałem niżej i zaznaczyłem kolorem to co sam napisałem proszę o poprawienie mojego kodu za pomoc dam 5.

 

KOD

 

 

#pragma once

 

 

namespace klawi1 {

 

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

///

/// WARNING: If you change the name of this class, you will need to change the

/// 'Resource File Name' property for the managed resource compiler tool

/// associated with all .resx files this class depends on. Otherwise,

/// the designers will not be able to interact properly with localized

/// resources associated with this form.

/// </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:

 

protected:

 

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->SuspendLayout();

//

// button1

//

this->button1->Location = System::Drawing::Point(43, 206);

this->button1->Name = L"button1";

this->button1->Size = System::Drawing::Size(75, 23);

this->button1->TabIndex = 0;

this->button1->Text = L"button1";

this->button1->UseVisualStyleBackColor = true;

this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click_1);

//

// Form1

//

this->AutoScaleDimensions = System::Drawing::SizeF(8, 16);

this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;

this->ClientSize = System::Drawing::Size(282, 255);

this->Controls->Add(this->button1);

this->Name = L"Form1";

this->Text = L"Form1";

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)

{

 

}

private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {

}

private: System::Void button1_Click_1(System::Object^ sender, System::EventArgs^ e)

{

VK_NUMPAD1;

}

};

}

Pomogłem daj 5

Opublikowano
  • Autor

Siemka jeszcze raz, jedna przeszkoda została pokonana ale została mi jeszcze jedna jak zrobić by ta klawiatura działała w grze warrock?

Za pomoc dam drugą 5 xD

Pomogłem daj 5

Opublikowano

Jeśli działasz na laptopie i nie masz numpad to klikasz Fn i chyba poszczególne cyfry... coś takiego. Chyba, że chcesz mieć taki programik.

iloverock.png

Opublikowano

Jeśli działasz na laptopie i nie masz numpad to klikasz Fn i chyba poszczególne cyfry... coś takiego. Chyba, że chcesz mieć taki programik.

 

Tutaj chodzi o taki programik :)

  • 2 tygodnie później...
Opublikowano

aha a gdzie mam to w tym kodzie umiescic?

 

#pragma once

 

namespace klawixD {

 

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

///

/// WARNING: If you change the name of this class, you will need to change the

/// 'Resource File Name' property for the managed resource compiler tool

/// associated with all .resx files this class depends on. Otherwise,

/// the designers will not be able to interact properly with localized

/// resources associated with this form.

/// </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:

/// <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->SuspendLayout();

//

// button1

//

this->button1->Location = System::Drawing::Point(19, 24);

this->button1->Name = L"button1";

this->button1->Size = System::Drawing::Size(76, 58);

this->button1->TabIndex = 0;

this->button1->Text = L"button1";

this->button1->UseVisualStyleBackColor = true;

this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);

//

// Form1

//

this->AutoScaleDimensions = System::Drawing::SizeF(8, 16);

this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;

this->ClientSize = System::Drawing::Size(140, 100);

this->Controls->Add(this->button1);

this->Name = L"Form1";

this->Text = L"Form1";

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) {

System::Windows::Forms::SendKeys::Send("{ENTER}");

}

private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {

}

};

}

Pomogłem daj 5

Opublikowano

zrób petle w nieskończoność w nowym Wąteku

 

DWORD WINAPI watek(LPVOID lParam)
{

	while(0)
{
if (GetKeyState(kod klawisza) &1)
{
tu twoje kody czy co tam chcesz
}

}




return 0;
}

 

 

tam gdzie masz

System::Windows::Forms::SendKeys::Send("{ENTER}");

 

daj

 

 

CreateThread(0, 0, watek, (LPVOID)"paarameter", 0, 0);

 

jak klikniesz na tego buttona włączy ci sie watek "watel" wtedy włączy się pętla w nieskończoność

Opublikowano

Ok. Tylko ja chce tego by mój program, który napisałem powyżej szlo przywołać za pomocą klawisza np. jak jestem w grze warrock i wcisnę klawisz to program mi nie pokarze. Oczywiście po wcześniejszym jego włączeniu.

Pomogłem daj 5

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.