Не компилируется проект
21.03.2015, 17:30. Показов 2158. Ответов 8
Помогите пожалуйста исправить ошибки в проекте
| C++ | 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
| #include <windows.h>
#include <mmsystem.h>
#include <vcl.h>
#pragma hdrstop
#include "IniFiles.hpp"
#include <Tlhelp32.h>
#include "Unit1.h"
#include <tchar.h>
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
wchar_t *pName;
TMenuItem *M;
UnicodeString Start;
UnicodeString Plus;
String Capt;
String CFG;
int A;
void DeleteDir(String Folder)
{
if(DirectoryExists(Folder))
{
TCHAR cDest[MAX_PATH] = {0};
_tcscpy(cDest, Folder.c_str());
SHFILEOPSTRUCT fos;
memset(&fos, 0, sizeof(SHFILEOPSTRUCT));
fos.hwnd = Application->Handle;
fos.wFunc = FO_DELETE;
fos.pFrom = cDest;
fos.fFlags = FOF_SILENT | FOF_NOERRORUI | FOF_NOCONFIRMATION;
SHFileOperation(&fos);
}
}
void __fastcall TForm1::N1Click(TObject *Sender)
{
Capt = ((TMenuItem *)Sender)->Caption;
((TMenuItem *)Sender)->Checked = true;
A = ((TMenuItem *)Sender)->Tag;
BitBtn1->Enabled = true;
SetLaunchParam();
}
void __fastcall TForm1::OpenFolderClick(TObject *Sender)
{
ShellExecute(NULL, L"open", ExtractFilePath(Application->ExeName).c_str(), NULL,NULL,SW_SHOWNORMAL);
}
void __fastcall TForm1::BitBtn1Click(TObject *Sender)
{
if(FileExists(L"click.wav"))
{
PlaySound(L"click.wav", NULL, SND_FILENAME);
}
ShellExecute(NULL,L"open",Start.c_str(),Plus.c_str(),NULL,SW_SHOW);
}
bool ProcessStart(wchar_t *pName)
{
HANDLE Hndl = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if(Hndl == INVALID_HANDLE_VALUE) return false;
PROCESSENTRY32 ProcessEntry;
ProcessEntry.dwSize = sizeof(ProcessEntry);
bool Loop = Process32First(Hndl, &ProcessEntry);
while (Loop)
{
if (wcscmp(ProcessEntry.szExeFile, pName) == 0)
{
CloseHandle(Hndl);
return true;
}
Loop = Process32Next(Hndl, &ProcessEntry);
}
return false;
}
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
pName = String(ExtractFileName(Start)).c_str();
if(! ProcessStart(pName))
{
DeleteDir(L"Folder1");
DeleteDir(L"Folder2");
DeleteDir(L"Folder3");
TSearchRec SR;
if(FindFirst("*.log", faAnyFile, SR) == 0)
{
do
DeleteFile(SR.Name);
while (FindNext(SR) == 0);
FindClose(SR);
}
ChDir(ExtractFilePath(Application->ExeName));
BitBtn1->Caption = "Старт " + Capt + " [Off]";
BitBtn1->Enabled = true;
Menu->Enabled = true;
EnableMenuItem(GetSystemMenu(Handle, false), SC_CLOSE, MF_ENABLED);
}
else
{
BitBtn1->Caption = Capt + " [On]"; /
BitBtn1->Enabled = false;
Menu->Enabled = false;
EnableMenuItem(GetSystemMenu(Handle, false), SC_CLOSE, MF_GRAYED);
}
Application->ProcessMessages();
}
enum MouseInButton_e {emibLeave, emibEnter, emibDown, emibUp};
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner),
ColorEnter(StringToColor(L"0xdf0064")),
ColorLeave(StringToColor(L"0x7a0055")),
ColorEnterExit(StringToColor(L"0x0000c8")),
ColorLeaveExit(StringToColor(L"0x000064")),
ButtonWidth(20),
ButtonHeight(30),
CaptionPanelHeight(30)
{
#ifndef FormStyle
MouseLBDown = false;
#endif
}
void __fastcall TForm1::FormCreate(TObject *Sender)
{
CaptionPanel = new TPanel( this );
CaptionPanel->Parent = this;
CaptionPanel->Height = CaptionPanelHeight;
CaptionPanel->Align = alTop;
CaptionPanel->ParentBackground = false;
CaptionPanel->Color = ColorLeave;
CaptionPanel->OnMouseDown = this->PanelMouseDown;
CaptionPanel->OnMouseUp = this->PanelMouseUp;
CaptionPanel->OnMouseMove = this->PanelMouseMove;
CaptionPanel->Caption = this->Caption;
CaptionPanel->Font->Style = TFontStyles() << fsBold;
CaptionPanel->Font->Color = clWhite;
SBMin = new TShape( this );
SBExt = new TShape( this );
TShape *pTempShape;
for( unsigned index = 0; index < this->ComponentCount; ++index )
if( this->Components[index]->ClassNameIs( L"TShape" ) )
{
pTempShape = static_cast<TShape*>( Components[index] );
pTempShape->Parent = CaptionPanel;
pTempShape->Width = ButtonWidth;
pTempShape->Height = ButtonHeight;
pTempShape->Top = CaptionPanel->Height/2 - ButtonHeight/2;
pTempShape->Shape = stRoundSquare;
pTempShape->Tag = emibLeave;
pTempShape->Brush->Color = ColorLeave;
pTempShape->Pen->Color = clWhite;
pTempShape->OnMouseLeave = this->ShapeMouseLeave;
pTempShape->OnMouseEnter = this->ShapeMouseEnter;
pTempShape->OnMouseDown = this->ShapeMouseDown;
pTempShape->OnMouseUp = this->ShapeMouseUp;
}
SBMin->Name = L"SBMin";
SBMin->Hint = L"Свернуть";
SBExt->Name = L"SBExit";
SBExt->Hint = L"Закрыть";
SBExt->Brush->Color = ColorLeaveExit;
SBMin->Left = CaptionPanel->Width - ButtonWidth * 1.8 ;
SBExt->Left = CaptionPanel->Width - ButtonWidth/2;
this->BorderStyle = bsNone;
this->Position = poDesktopCenter;
CFG = ExtractFilePath(Application->ExeName) + L"Settings.cfg";
if(FileExists(CFG))
{
TIniFile *Ini = new TIniFile(CFG);
int mTag = Ini->ReadInteger("MENU","CHECKED",0);
for(int i = 0; i < Form1->ComponentCount; i++)
{
if(Components[i]->ClassNameIs("TMenuItem"))
if(((TMenuItem *)Components[i])->Tag == mTag)
{
A = mTag;
((TMenuItem *)Components[i])->Checked = true;
Capt = ((TMenuItem *)Components[i])->Caption;
BitBtn1->Caption = Capt;
SetLaunchParam();
}
}
delete Ini;
}
}
void __fastcall TForm1::ShapeMouseEnter(TObject *Sender)
{
static_cast<TShape*>( Sender )->Tag = emibEnter;
ButtonUpdate();
}
void __fastcall TForm1::ShapeMouseLeave(TObject *Sender)
{
static_cast<TShape*>( Sender )->Tag = emibLeave;
ButtonUpdate();
}
void __fastcall TForm1::ButtonUpdate()
{
TColor CurrColor(0);
for( unsigned index=0; index<this->ComponentCount; ++index )
if( this->Components[index]->ClassNameIs( L"TShape" ) )
{
if( static_cast<TShape*>( Components[index] )->Tag == emibEnter )
{
if( !static_cast<TShape*>( Components[index] )->Name.Pos( L"Exit" ) )
CurrColor = ColorEnter;
else
CurrColor = ColorEnterExit;
}
else
{
if( !static_cast<TShape*>( Components[index] )->Name.Pos( L"Exit" ) )
CurrColor = ColorLeave;
else
CurrColor = ColorLeaveExit;
}
static_cast<TShape*>( Components[index] )->Brush->Color = CurrColor;
}
}
void __fastcall TForm1::PanelMouseMove(TObject *Sender, TShiftState Shift, int X, int Y)
{
#ifndef FormStyle
if( MouseLBDown )
{
static TPoint tp;
tp.X = X;
tp.Y = Y;
tp = ClientToScreen(tp);
this->Left = tp.x - MouseDownCaptionXY.X;
this->Top = tp.Y - MouseDownCaptionXY.Y;
}
#endif
}
void __fastcall TForm1::PanelMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift,
int X, int Y)
{
#ifndef FormStyle
MouseLBDown = true;
MouseDownCaptionXY.X = X;
MouseDownCaptionXY.Y = Y;
#else
long SC_DRAGMOVE = 0xF012;
if(Button == mbLeft)
{
ReleaseCapture();
SendMessage(Handle, WM_SYSCOMMAND, SC_DRAGMOVE, 0);
}
#endif
}
void __fastcall TForm1::PanelMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift,
int X, int Y)
{
#ifndef FormStyle
MouseLBDown = false;
#endif
}
void __fastcall TForm1::ShapeMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift,
int X, int Y)
{
static_cast<TShape*>( Sender )->Tag = emibDown;
ButtonUpdate();
}
void __fastcall TForm1::ShapeMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift,
int X, int Y)
{
static_cast<TShape*>(Sender)->Tag = emibUp;
ButtonUpdate();
if(static_cast<TShape*>(Sender)->Name.Pos(L"Min")) this->WindowState = wsMinimized;
if(static_cast<TShape*>(Sender)->Name.Pos(L"Exit")) this->Close();
}
void __fastcall TForm1::FormCloseQuery(TObject *Sender, bool &CanClose)
{
TIniFile *Ini = new TIniFile(CFG);
Ini->WriteString("MENU","CHECKED",IntToStr(A));
delete Ini;
CanClose = true;
}
void __fastcall TForm1::SetLaunchParam()
{
switch(A)
{
case 1 :Start = L"name.exe"; Plus = L"параметры запуска(ключ)";
break;
case 2 :Start = L"name.exe"; Plus = L"параметры запуска(ключ)";
break;
}
Timer1->Enabled = true;
} |
|
| C++ | 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
| #ifndef Unit1H
#define Unit1H
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
#include <Vcl.Menus.hpp>
#include <Vcl.ExtCtrls.hpp>
#include <Vcl.Buttons.hpp>
#define FormStyle
class TForm1 : public TForm
{
__published: // IDE-managed Components
TMainMenu *MainMenu1;
TMenuItem *Menu;
TMenuItem *N1;
TMenuItem *N2;
TTimer *Timer1;
TMenuItem *OpenFolder;
TMenuItem *SEPARATOR1;
TBitBtn *BitBtn1;
void __fastcall FormCreate(TObject *Sender);
void __fastcall FormCloseQuery(TObject *Sender, bool &CanClose);
void __fastcall N1Click(TObject *Sender);
void __fastcall Timer1Timer(TObject *Sender);
void __fastcall OpenFolderClick(TObject *Sender);
void __fastcall BitBtn1Click(TObject *Sender);
void __fastcall ShapeMouseEnter(TObject *Sender);
void __fastcall ShapeMouseLeave(TObject *Sender);
void __fastcall ShapeMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y);
void __fastcall ShapeMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y);
void __fastcall PanelMouseMove(TObject *Sender, TShiftState Shift, int X, int Y);
void __fastcall PanelMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y);
void __fastcall PanelMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y);
private: // User declarations
const unsigned ButtonWidth, ButtonHeight, CaptionPanelHeight;
const TColor ColorEnter, ColorLeave, ColorEnterExit, ColorLeaveExit;
void __fastcall ButtonUpdate();
TPanel *CaptionPanel;
TShape *SBMin, *SBMax, *SBExt;
#ifndef FormStyle
bool MouseLBDown;
TPoint MouseDownCaptionXY;
void __fastcall SetLaunchParam();
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
extern PACKAGE TForm1 *Form1;
#endif |
|
| C++ | 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
| #include <vcl.h>
#pragma hdrstop
#include <tchar.h>
USEFORM ("Unit1.cpp", Form1);
int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int)
{
try
{
CreateMutex(NULL,true,L"MyApp");
if (GetLastError() == ERROR_ALREADY_EXISTS)
{
MessageBox(NULL,L"Не удалось запустить (Приложение уже запущено).","Fatal Error",MB_OK | MB_ICONERROR);
exit(0);
}
Application->Initialize();
Application->MainFormOnTaskBar = true;
Application->CreateForm(__classid(TForm1), &Form1);
Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
catch (...)
{
try
{
throw Exception("");
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
}
return 0;
} |
|
| PureBasic | 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
| Checking project dependencies...
Compiling Project1.cbproj (Debug, Win32)
bcc32 command line for "Project1.cpp"
c:\program files (x86)\embarcadero\studio\15.0\bin\bcc32.exe -D_DEBUG -DUSEPACKAGES -n.\Win32\Debug -I"c:\program files
(x86)\embarcadero\studio\15.0\include\windows\vcl";"C:\Program Files (x86)\Embarcadero\Studio\15.0\include\boost_1_39\boost\tr1\tr1";"C:\Program
Files (x86)\Embarcadero\Studio\15.0\include\boost_1_39";"c:\program files (x86)\embarcadero\studio\15.0\include";"c:\program files
(x86)\embarcadero\studio\15.0\include\dinkumware";"c:\program files (x86)\embarcadero\studio\15.0\include\windows\crtl";"c:\program files
(x86)\embarcadero\studio\15.0\include\windows\sdk";"c:\program files (x86)\embarcadero\studio\15.0\include\windows\rtl";"c:\program files
(x86)\embarcadero\studio\15.0\include\windows\vcl";"c:\program files (x86)\embarcadero\studio\15.0\include\windows\fmx";"C:\Program Files
(x86)\FastReports\LibD21";"C:\Program Files (x86)\Raize\CS5\Lib\RS-XE7\Win32";C:\Users\Public\Documents\Embarcadero\Studio\15.0\hpp\Win32 -y -Q -k
-r- -c -tR -tM -tU -tW -C8 -o.\Win32\Debug\Project1.obj -w-par -Od -v -vi- -H=.\Win32\Debug\Project1.pch -H Project1.cpp
[bcc32 Error] Project1.cpp(17): E2034 Cannot convert 'char const[12]' to 'const wchar_t *'
Full parser context
Project1.cpp(10): parsing: int __stdcall wWinMain(HINSTANCE__ *,HINSTANCE__ *,wchar_t *,int)
[bcc32 Error] Project1.cpp(17): E2342 Type mismatch in parameter 'lpCaption' (wanted 'const wchar_t *', got 'const char *')
Full parser context
Project1.cpp(10): parsing: int __stdcall wWinMain(HINSTANCE__ *,HINSTANCE__ *,wchar_t *,int)
Failed
Elapsed time: 00:00:01.1 |
|
0
|