-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSearchf.cpp
153 lines (136 loc) · 4.64 KB
/
Searchf.cpp
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
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Searchf.h"
#include "Aspi.h"
#include "Device.h"
#include "Stdlib.h"
#include "Stdio.h"
#include "String.h"
#include "CDVDMain.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TSearch_Box *Search_Box;
//---------------------------------------------------------------------------
__fastcall TSearch_Box::TSearch_Box(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TSearch_Box::FormCreate(TObject *Sender)
{
int i=0;
char vendor[8];
char model[8];
char tempvar[20];
char tempvar2[20];
char firmware[4];
char title[40];
char *spacer;
char *spacer2;
Device* dev = devices;
int pos = deviceCount-Main_Form->ComboBox->ItemIndex-1;
for (i=0; i < pos; i++)
{
dev = dev->next;
}
//sprintf(dev->vendor_name,"PLEXTOR CD-R PX-W3434");
//sprintf(dev->vendor_name,"HL-DT-STDVD-ROM GDR8160B");
//sprintf(dev->vendor_name,"YAMAHA CRW8424E ");
//sprintf(dev->vendor_name,"SONY DVD RW DRU-500A");
//sprintf(dev->vendor_name,"PIONEER DVD-RW DVR-104");
if (!isalnum(dev->firmware_version[0]))
{
sprintf(firmware,"%s","????");
} else
{
sprintf(firmware,"%s",Trim(AnsiString(dev->firmware_version)));
}
sprintf(title,"%s [%s]",Trim(AnsiString(dev->vendor_name)),firmware);
TheName->Caption=Trim(AnsiString(title));
memcpy(vendor, dev->vendor_name, 8);
vendor[8] = 0;
VendorBox->Caption=Trim(AnsiString(vendor));
sprintf(tempvar2,"%s",Trim(AnsiString(dev->vendor_name+8)));
spacer=strstr(tempvar2," ");
if (spacer!=NULL)
{
spacer++;
sprintf(tempvar,"%s",TrimRight(AnsiString(spacer)));
spacer2=strstr(tempvar," ");
if (spacer2!=NULL)
{
spacer2++;
sprintf(tempvar,"%s",spacer2);
}
}
if (spacer==NULL)
{
ModelBox->Caption=Trim(AnsiString(dev->vendor_name+8));
} else
{
ModelBox->Caption=Trim(AnsiString(tempvar));
}
}
//---------------------------------------------------------------------------
void __fastcall TSearch_Box::CloseBtnClick(TObject *Sender)
{
TSearch_Box::Close();
}
//---------------------------------------------------------------------------
void __fastcall TSearch_Box::SrchButtonClick(TObject *Sender)
{
char search[500];
if (VendorBox->Checked && ModelBox->Checked)
{
sprintf(search,"http://forum.rpc1.org/dl_result.php?kaj=1&isces=%s %s",VendorBox->Caption,ModelBox->Caption);
}
if (VendorBox->Checked && !ModelBox->Checked)
{
sprintf(search,"http://forum.rpc1.org/dl_result.php?kaj=1&isces=%s",VendorBox->Caption);
}
if (!VendorBox->Checked && ModelBox->Checked)
{
sprintf(search,"http://forum.rpc1.org/dl_result.php?kaj=1&isces=%s",ModelBox->Caption);
}
if (!VendorBox->Checked && !ModelBox->Checked)
{
Application->MessageBox ("You have to check at least one option.", "Error", MB_OK | MB_ICONSTOP);
return;
}
ShellExecute(Application->Handle,"open",search,"","",0);
}
//---------------------------------------------------------------------------
void __fastcall TSearch_Box::VendorBoxKeyPress(TObject *Sender, char &Key)
{
if (Key == 'x' || Key == 'X' || Key == VK_ESCAPE)
{
TSearch_Box::Close();
}
}
//---------------------------------------------------------------------------
void __fastcall TSearch_Box::ModelBoxKeyPress(TObject *Sender, char &Key)
{
if (Key == 'x' || Key == 'X' || Key == VK_ESCAPE)
{
TSearch_Box::Close();
}
}
//---------------------------------------------------------------------------
void __fastcall TSearch_Box::SrchButtonKeyPress(TObject *Sender, char &Key)
{
if (Key == 'x' || Key == 'X' || Key == VK_ESCAPE)
{
TSearch_Box::Close();
}
}
//---------------------------------------------------------------------------
void __fastcall TSearch_Box::CloseBtnKeyPress(TObject *Sender, char &Key)
{
if (Key == 'x' || Key == 'X' || Key == VK_ESCAPE)
{
TSearch_Box::Close();
}
}
//---------------------------------------------------------------------------