C++ Builder
| Главная | Уроки | Статьи | FAQ | Форум | Downloads | Литература | Ссылки | RXLib | Диски |

 
Не проходит пользовательское сообщение форме
PATRIOT
Отправлено: 26.09.2005, 02:03


Ученик-кочегар

Группа: Участник
Сообщений: 17



Проблема в следующем:
при выполнении строки с меткой "l1", строка "l2" не выполняется. Там стоит breakpoint, так что пропустить исполнение не должен.
CODE

Unit1.h
...
#define WM_MyMess WM_USER
...

//==========================================
Unit1.cpp
...
l1: SendMessage(Form2->Handle, WM_MyMess, 0, 0);
...
//==========================================

Unit2.h
...
#define WM_MyMess WM_USER
...
private:
 void OnMes(Messages::PMessage& a);
public:  
 BEGIN_MESSAGE_MAP
     MESSAGE_HANDLER(WM_MyMess, Messages::PMessage, OnMes);
 END_MESSAGE_MAP(TForm)
...

//==========================================
Unit2.cpp
...
void TForm2::OnMess(Messages::PMessage& a){
l2:     i++;
}



olegenty
Отправлено: 26.09.2005, 07:26


Ветеран

Группа: Модератор
Сообщений: 2412



давай весь код опять, где-то ты напортачил.
PATRIOT
Отправлено: 28.09.2005, 06:30


Ученик-кочегар

Группа: Участник
Сообщений: 17



QUOTE (olegenty @ 26/09/2005, 07:26)
давай весь код опять, где-то ты напортачил.

Весь код это довольно много
вот "скелет"
CODE

GUI.cpp
//---------------------------------------------------------------------------

#include <clx.h>
#pragma hdrstop
AnsiString tt="0";


#include "gui.h"
#include "interface.cpp"
#include "TFRegistrs.h"
#include "SysUtils.hpp"
#include "About.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "TFRegistrs"
#pragma resource "*.xfm"
TFormMain *FormMain;

//---------------------------------------------------------------------------
__fastcall TFormMain::TFormMain(TComponent* Owner): TForm(Owner) {
}//---------------------------------------------------------------------------

void TFormMain::InitialConditions(void){
}//--------------------------------------------------------------------------------------

void TFormMain::Initialization(void){
}//=====================================================================================

void TFormMain::AllUpdate(TObject *Sender, byte Flag){
}//=====================================================================================

void TFormMain::MemLoad(AnsiString HF){// HF — HexFile
}//================================================================

void TFormMain::MemSave(AnsiString HF){// HF — HexFile
}//================================================================

void TFormMain::CfgLoad(void){
}//-------------------------------------------------------------------

void TFormMain::StackUpdate(void){
}//---------------------------------------------------------------------------

void __fastcall TFormMain::MStackClick(TObject *Sender){
}//---------------------------------------------------------------------------

void __fastcall TFormMain::MStackKeyDown(TObject *Sender, WORD &Key, TShiftState Shift){Key=0;}

void __fastcall TFormMain::MStackKeyUp(TObject *Sender, WORD &Key, TShiftState Shift){
} //-------------------------------------------------------------------

void __fastcall TFormMain::MStackKeyPress(TObject *Sender, char &Key){
}//-------------------------------------------------------------------

void TFormMain::PortUpdate(void){
}//---------------------------------------------------------------------------

void __fastcall TFormMain::MPortClick(TObject *Sender){
}//---------------------------------------------------------------------------

void __fastcall TFormMain::MPortKeyDown(TObject *Sender, WORD &Key, TShiftState Shift){Key=0;}

void __fastcall TFormMain::MPortKeyUp(TObject *Sender, WORD &Key, TShiftState Shift){
} //-------------------------------------------------------------------


void __fastcall TFormMain::MPortKeyPress(TObject *Sender, char &Key){
}//-------------------------------------------------------------------


void TFormMain::Memory1Update(void){
}//---------------------------------------------------------------------------

void TFormMain::Memory2Update(void){
}//---------------------------------------------------------------------------

void __fastcall TFormMain::MMemoryClick(TObject *Sender){
}//---------------------------------------------------------------------------

void __fastcall TFormMain::MMemoryKeyDown(TObject *Sender, WORD &Key, TShiftState Shift) {
}//---------------------------------------------------------------------------

void __fastcall TFormMain::MMemoryKeyUp(TObject *Sender, WORD &Key, TShiftState Shift){
} //---------------------------------------------------------------------------

void __fastcall TFormMain::MMemoryKeyPress(TObject *Sender, char &Key){
}

void TFormMain::MCodingUpdate(void){
}//---------------------------------------------------------------------------

void TFormMain::DebugUpdate(void){
}//---------------------------------------------------------------------------

void TFormMain::MDeAsmUpdate(void){
}//---------------------------------------------------------------------------

void __fastcall TFormMain::MDeAsmClick(TObject *Sender){
}//---------------------------------------------------------------------------

void __fastcall TFormMain::MDeAsmKeyDown(TObject *Sender, WORD &Key, TShiftState Shift) {
}//---------------------------------------------------------------------------

void __fastcall TFormMain::MDeAsmKeyUp(TObject *Sender, WORD &Key, TShiftState Shift){
} //---------------------------------------------------------------------------

void __fastcall TFormMain::MDeAsmKeyPress(TObject *Sender, char &Key){
}

void __fastcall TFormMain::EDeAsmKeyDown(TObject *Sender, WORD &Key, TShiftState Shift) {
}//---------------------------------------------------------------------------

void __fastcall TFormMain::EDeAsmKeyUp(TObject *Sender, WORD &Key, TShiftState Shift){
} //---------------------------------------------------------------------------

void __fastcall TFormMain::EDeAsmKeyPress(TObject *Sender, char &Key){
} //---------------------------------------------------------------------------

void __fastcall TFormMain::EDeAsmExit(TObject *Sender){
}//---------------------------------------------------------------------------

void __fastcall TFormMain::EDeAsmLineKeyPress(TObject *Sender, char &Key){
}//---------------------------------------------------------------------------

void __fastcall TFormMain::EDeAsmLineKeyUp(TObject *Sender, WORD &Key, TShiftState Shift){
}//---------------------------------------------------------------------------

void __fastcall TFormMain::CDeAsmClick(TObject *Sender){
}//---------------------------------------------------------------------------


void __fastcall TFormMain::B_RunClick(TObject *Sender) {
SendMessage(FormPort->Handle, WM_StepTimer, 0, 0);
}//--------------------------------------------------------------------------

void __fastcall TFormMain::B_MultiRunClick(TObject *Sender){
}//---------------------------------------------------------------------------


void __fastcall TFormMain::AboutClick(TObject *Sender){
FormAbout->ShowModal();
}//---------------------------------------------------------------------------

void __fastcall TFormMain::Menu_Coding_DOSClick(TObject *Sender){
}//---------------------------------------------------------------------------

void __fastcall TFormMain::Menu_DeAsmClick(TObject *Sender){
}//---------------------------------------------------------------------------

void __fastcall TFormMain::ShowPortClick(TObject *Sender) {
FormPort->Show();
}//---------------------------------------------------------------------------

void __fastcall TFormMain::Menu_FileOpenClick(TObject *Sender) {
if (DOpenHexFile->Execute()){
MemLoad(DOpenHexFile->FileName);
}
}//---------------------------------------------------------------------------

void __fastcall TFormMain::Menu_FileSaveClick(TObject *Sender){
if (DSaveHexFile->Execute()){
s=DSaveHexFile->FileName;
if (!s.Pos(".hex")){s+=".hex";}
MemSave(s);
}
}//---------------------------------------------------------------------------

//===========================================================================
void TFormMain::Emulate(void) {
}//--------------------------------------------------------------------------

void TFormMain::StepTimer(){
}//---------------------------------------------------------------------------

void TFormMain::SetStepTimer(int Delay ,byte Line){
}//---------------------------------------------------------------------------

void __fastcall TFormMain::SwitchMSelect(TObject *Sender) {
}
//---------------------------------------------------------------------------
//=============================================

CODE

GUI.h
//---------------------------------------------------------------------------

#ifndef guiH
#define guiH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <QControls.hpp>
#include <QStdCtrls.hpp>
#include <QForms.hpp>
#include <QMenus.hpp>
#include <QTypes.hpp>
#include <QDialogs.hpp>
#include "inifiles.hpp"
#include "UPort.h"
#include "TFRegistrs.h"
//---------------------------------------------------------------------------

#define WM_StepTimer WM_USER

//---------------------------------------------------------------------------

class TFormMain : public TForm{
__published: // IDE-managed Components
TMemo *MMemory1;
TButton *B_Run;
TF_Registr *F_Registr;
TButton *B_MultiRun;
TEdit *E_MultiRun;
TMemo *MStack;
TMemo *MDebug;
TLabel *LData;
TComboBox *SwitchM1;
TComboBox *SwitchM2;
TMemo *MPort;
TMemo *MMemory2;
TMemo *MCoding;
TMainMenu *MainMenu;
TMenuItem *Help;
TMenuItem *About;
TMemo *MDeAsm;
TMenuItem *Menu_DeAsm;
TMenuItem *N1;
TMenuItem *Menu_Coding_DOS;
TEdit *EDeAsmSeg;
TLabel *LDeAsm;
TEdit *EDeAsmPoint;
TEdit *EDeAsmLine;
TCheckBox *CDeAsm;
TLabel *LDeAsm2;
TMenuItem *Menu_File;
TMenuItem *Menu_FileOpen;
TMenuItem *Menu_FileSave;
TOpenDialog *DOpenHexFile;
TSaveDialog *DSaveHexFile;
TMenuItem *ShowPort;
void __fastcall B_RunClick(TObject *Sender);
void __fastcall B_MultiRunClick(TObject *Sender);
void __fastcall MMemoryKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
void __fastcall MMemoryKeyPress(TObject *Sender, char &Key);
void __fastcall MMemoryKeyUp(TObject *Sender, WORD &Key, TShiftState Shift);
void __fastcall MMemoryClick(TObject *Sender);
void __fastcall SwitchMSelect(TObject *Sender);
void __fastcall MStackKeyPress(TObject *Sender, char &Key);
void __fastcall MStackClick(TObject *Sender);
void __fastcall MStackKeyUp(TObject *Sender, WORD &Key, TShiftState Shift);
void __fastcall MStackKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
void __fastcall MPortKeyPress(TObject *Sender, char &Key);
void __fastcall MPortClick(TObject *Sender);
void __fastcall MPortKeyUp(TObject *Sender, WORD &Key, TShiftState Shift);
void __fastcall MPortKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
void __fastcall AboutClick(TObject *Sender);
void __fastcall Menu_Coding_DOSClick(TObject *Sender);
void __fastcall Menu_DeAsmClick(TObject *Sender);
void __fastcall MDeAsmKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
void __fastcall MDeAsmKeyPress(TObject *Sender, char &Key);
void __fastcall MDeAsmKeyUp(TObject *Sender, WORD &Key, TShiftState Shift);
void __fastcall EDeAsmKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
void __fastcall EDeAsmKeyPress(TObject *Sender, char &Key);
void __fastcall EDeAsmKeyUp(TObject *Sender, WORD &Key, TShiftState Shift);
void __fastcall EDeAsmExit(TObject *Sender);
void __fastcall EDeAsmLineKeyPress(TObject *Sender, char &Key);
void __fastcall EDeAsmLineKeyUp(TObject *Sender, WORD &Key, TShiftState Shift);
void __fastcall CDeAsmClick(TObject *Sender);
void __fastcall Menu_FileOpenClick(TObject *Sender);
void __fastcall Menu_FileSaveClick(TObject *Sender);
void __fastcall MDeAsmClick(TObject *Sender);
void __fastcall ShowPortClick(TObject *Sender);
private: // User declarations
public: // User declarations
enum mCalling{mEmulator, mPort};
void InitialConditions(void);
void Initialization(void);
TIniFile *cfg;
int MouseX, MouseY;
int dX,dY,X0,Y0;
void MemLoad(AnsiString HexFile);
void MemSave(AnsiString HexFile);
void CfgLoad(void);
void AllUpdate(TObject *Sender, byte);
void Memory1Update(void);
void Memory2Update(void);
void MCodingUpdate(void);
void DebugUpdate(void);
void MDeAsmUpdate(void);
void StackUpdate(void);
void PortUpdate(void);
void EPortUpdate(void);
void Emulate(void);
void StepTimer();
void SetStepTimer(int Delay, byte Line);
__fastcall TFormMain(TComponent* Owner);
};//---------------------------------------------------------------------------
extern PACKAGE TFormMain *FormMain;
//---------------------------------------------------------------------------
#endif

CODE

UPort.cpp
//---------------------------------------------------------------------------

#include <clx.h>
#pragma hdrstop

#include "UPort.h"
#include "interface.cpp"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.xfm"



#define WM_StepTimer WM_USER

//---------------------------------------------------------------------------
__fastcall TFormPort::TFormPort(TComponent* Owner):TForm(Owner) {
}//---------------------------------------------------------------------------

void TFormPort::ScanningTimer(TObject *Sender){
}//---------------------------------------------------------------------------

void TFormPort::SendingOut(Word Sending){
}//---------------------------------------------------------------------------

void TFormPort::SendingIn(Word Sending){
}//---------------------------------------------------------------------------


void __fastcall TFormPort::EPortInKeyPress(TObject *Sender, char &Key){
}//---------------------------------------------------------------------------

void __fastcall TFormPort::EPortSpeedKeyPress(TObject *Sender, char &Key){
}//---------------------------------------------------------------------------

void TFormPort::OnStepTimer(Messages::TMessage& a){
i++;
ShowMessage(AnsiString(a.Msg));
}//

CODE

UPort.h
//---------------------------------------------------------------------------

#ifndef UPortH
#define UPortH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <QControls.hpp>
#include <QStdCtrls.hpp>
#include <QForms.hpp>
#include "gui.h"
#include <QExtCtrls.hpp>
#include <QTypes.hpp>

#define WM_StepTimer WM_USER
//---------------------------------------------------------------------------
class TFormPort : public TForm{
__published: // IDE-managed Components
TEdit *EEvent;
TEdit *EPortIn;
TEdit *EPortOut;
TEdit *EPortSpeed;
void __fastcall EPortInKeyPress(TObject *Sender, char &Key);
void __fastcall EPortSpeedKeyPress(TObject *Sender, char &Key);
private: // User declarations
void OnStepTimer(Messages::TMessage& a);
public: // User declarations
void SendingOut(Word Sending);
void SendingIn(Word Sending);
void ScanningTimer(TObject *Sender);
BEGIN_MESSAGE_MAP
VCL_MESSAGE_HANDLER(WM_StepTimer,Messages::TMessage, OnStepTimer);
END_MESSAGE_MAP(TFormPort)

__fastcall TFormPort(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TFormPort *FormPort;
//---------------------------------------------------------------------------
#endif


Отредактировано PATRIOT — 28/09/2005, 06:32

Вернуться в Вопросы программирования в C++Builder