Форум программистов, компьютерный форум, киберфорум
C++/CLI Windows Forms
Войти
Регистрация
Восстановить пароль
Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 5.00/11: Рейтинг темы: голосов - 11, средняя оценка - 5.00
0 / 0 / 0
Регистрация: 22.08.2012
Сообщений: 15

Русские буквы в Url

14.11.2012, 21:38. Показов 2055. Ответов 6
Метки нет (Все метки)

Студворк — интернет-сервис помощи студентам
Совсем недавно начал изучать С++. Мне дали задание написать программу(браузер) под определенный сайт. В этой программе есть поиск по сайту, путем вставки Url такого вида :

site.com/text?text=Здесь русский текст&search=5 итд..

Но когда он переходит по нужной ссылке, Url кодируется в неизвестно что и сайт не реагирует. Как можно реализовать программный код чтобы при переходе Url не кодировался?

Добавлено через 2 минуты
Или может чтобы кодировал наоборот до перехода по ссылке?

Не знаю как правильнее или лучше..

Добавлено через 10 минут
Не много разобрался, мне нужно чтобы запрос кодировался до передачи браузеру, помогите, как это реализовать?

Добавлено через 12 часов 37 минут
Неужели никто не может помочь?

Добавлено через 5 часов 31 минуту
Может кто подсказать в каком направлении копать, а то что то оно не хочет получатся совсем:
Форма 1
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
#pragma once
#include "FormSearch.h"
#include <string>
#include <iostream>
 
 
 
namespace DiplomProject {
 
    using namespace System;
    using namespace System::ComponentModel;
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System::Data;
    using namespace System::Drawing;
    using namespace System::Web;
    using namespace System::Text;
 
 
 
    /// <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::WebBrowser^  webBrowser1;
    private: System::Windows::Forms::TextBox^  textBox1;
    private: System::Windows::Forms::Button^  button1;
    private: System::Windows::Forms::Button^  button2;
    private: System::Windows::Forms::Button^  button3;
    private: System::Windows::Forms::ToolStrip^  toolStrip1;
    private: System::Windows::Forms::ToolStripButton^  toolStripButton1;
    private: System::Windows::Forms::ToolStripButton^  toolStripButton2;
    private: System::Windows::Forms::ToolStripButton^  toolStripButton3;
    private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator1;
    private: System::Windows::Forms::ToolStripProgressBar^  toolStripProgressBar1;
    private: System::Windows::Forms::ToolStripButton^  toolStripButton4;
    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)
        {
            System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));
            this->webBrowser1 = (gcnew System::Windows::Forms::WebBrowser());
            this->textBox1 = (gcnew System::Windows::Forms::TextBox());
            this->button1 = (gcnew System::Windows::Forms::Button());
            this->button2 = (gcnew System::Windows::Forms::Button());
            this->button3 = (gcnew System::Windows::Forms::Button());
            this->toolStrip1 = (gcnew System::Windows::Forms::ToolStrip());
            this->toolStripButton1 = (gcnew System::Windows::Forms::ToolStripButton());
            this->toolStripButton4 = (gcnew System::Windows::Forms::ToolStripButton());
            this->toolStripSeparator1 = (gcnew System::Windows::Forms::ToolStripSeparator());
            this->toolStripProgressBar1 = (gcnew System::Windows::Forms::ToolStripProgressBar());
            this->toolStripButton2 = (gcnew System::Windows::Forms::ToolStripButton());
            this->toolStripButton3 = (gcnew System::Windows::Forms::ToolStripButton());
            this->toolStrip1->SuspendLayout();
            this->SuspendLayout();
            // 
            // webBrowser1
            // 
            this->webBrowser1->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom) 
                | System::Windows::Forms::AnchorStyles::Left) 
                | System::Windows::Forms::AnchorStyles::Right));
            this->webBrowser1->Location = System::Drawing::Point(-1, 60);
            this->webBrowser1->MinimumSize = System::Drawing::Size(20, 20);
            this->webBrowser1->Name = L"webBrowser1";
            this->webBrowser1->Size = System::Drawing::Size(512, 252);
            this->webBrowser1->TabIndex = 0;
            this->webBrowser1->Url = (gcnew System::Uri(L"http://zakon1.rada.gov.ua/laws/show/254%D0%BA/96-%D0%B2%D1%80", System::UriKind::Absolute));
            this->webBrowser1->ProgressChanged += gcnew System::Windows::Forms::WebBrowserProgressChangedEventHandler(this, &Form1::webBrowser1_ProgressChanged);
            this->webBrowser1->NewWindow += gcnew System::ComponentModel::CancelEventHandler(this, &Form1::webBrowser1_NewWindow);
            // 
            // textBox1
            // 
            this->textBox1->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom) 
                | System::Windows::Forms::AnchorStyles::Left) 
                | System::Windows::Forms::AnchorStyles::Right));
            this->textBox1->Location = System::Drawing::Point(104, 29);
            this->textBox1->Name = L"textBox1";
            this->textBox1->Size = System::Drawing::Size(298, 20);
            this->textBox1->TabIndex = 1;
            // 
            // button1
            // 
            this->button1->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right));
            this->button1->Location = System::Drawing::Point(422, 28);
            this->button1->Name = L"button1";
            this->button1->Size = System::Drawing::Size(74, 26);
            this->button1->TabIndex = 2;
            this->button1->Text = L"Переход";
            this->button1->UseVisualStyleBackColor = true;
            this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
            // 
            // button2
            // 
            this->button2->Location = System::Drawing::Point(7, 28);
            this->button2->Name = L"button2";
            this->button2->Size = System::Drawing::Size(41, 26);
            this->button2->TabIndex = 3;
            this->button2->Text = L"<-";
            this->button2->UseVisualStyleBackColor = true;
            this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
            // 
            // button3
            // 
            this->button3->Location = System::Drawing::Point(57, 28);
            this->button3->Name = L"button3";
            this->button3->Size = System::Drawing::Size(41, 26);
            this->button3->TabIndex = 4;
            this->button3->Text = L"->";
            this->button3->UseVisualStyleBackColor = true;
            this->button3->Click += gcnew System::EventHandler(this, &Form1::button3_Click);
            // 
            // toolStrip1
            // 
            this->toolStrip1->BackColor = System::Drawing::SystemColors::Control;
            this->toolStrip1->GripStyle = System::Windows::Forms::ToolStripGripStyle::Hidden;
            this->toolStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(6) {this->toolStripButton1, 
                this->toolStripButton4, this->toolStripSeparator1, this->toolStripProgressBar1, this->toolStripButton2, this->toolStripButton3});
            this->toolStrip1->Location = System::Drawing::Point(0, 0);
            this->toolStrip1->Name = L"toolStrip1";
            this->toolStrip1->Size = System::Drawing::Size(511, 25);
            this->toolStrip1->TabIndex = 5;
            this->toolStrip1->Text = L"toolStrip1";
            // 
            // toolStripButton1
            // 
            this->toolStripButton1->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Text;
            this->toolStripButton1->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripButton1.Image")));
            this->toolStripButton1->ImageTransparentColor = System::Drawing::Color::Magenta;
            this->toolStripButton1->Name = L"toolStripButton1";
            this->toolStripButton1->Size = System::Drawing::Size(46, 22);
            this->toolStripButton1->Text = L"Поиск";
            this->toolStripButton1->Click += gcnew System::EventHandler(this, &Form1::toolStripButton1_Click);
            // 
            // toolStripButton4
            // 
            this->toolStripButton4->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Text;
            this->toolStripButton4->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripButton4.Image")));
            this->toolStripButton4->ImageTransparentColor = System::Drawing::Color::Magenta;
            this->toolStripButton4->Name = L"toolStripButton4";
            this->toolStripButton4->Size = System::Drawing::Size(65, 22);
            this->toolStripButton4->Text = L"Обновить";
            this->toolStripButton4->Click += gcnew System::EventHandler(this, &Form1::toolStripButton4_Click);
            // 
            // toolStripSeparator1
            // 
            this->toolStripSeparator1->Name = L"toolStripSeparator1";
            this->toolStripSeparator1->Size = System::Drawing::Size(6, 25);
            // 
            // toolStripProgressBar1
            // 
            this->toolStripProgressBar1->Alignment = System::Windows::Forms::ToolStripItemAlignment::Right;
            this->toolStripProgressBar1->Name = L"toolStripProgressBar1";
            this->toolStripProgressBar1->Size = System::Drawing::Size(100, 22);
            // 
            // toolStripButton2
            // 
            this->toolStripButton2->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Text;
            this->toolStripButton2->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripButton2.Image")));
            this->toolStripButton2->ImageTransparentColor = System::Drawing::Color::Magenta;
            this->toolStripButton2->Name = L"toolStripButton2";
            this->toolStripButton2->Size = System::Drawing::Size(71, 22);
            this->toolStripButton2->Text = L"Настройки";
            // 
            // toolStripButton3
            // 
            this->toolStripButton3->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Text;
            this->toolStripButton3->ForeColor = System::Drawing::SystemColors::ActiveBorder;
            this->toolStripButton3->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripButton3.Image")));
            this->toolStripButton3->ImageTransparentColor = System::Drawing::Color::Magenta;
            this->toolStripButton3->Name = L"toolStripButton3";
            this->toolStripButton3->Size = System::Drawing::Size(57, 22);
            this->toolStripButton3->Text = L"Справка";
            // 
            // Form1
            // 
            this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
            this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
            this->BackColor = System::Drawing::SystemColors::Control;
            this->ClientSize = System::Drawing::Size(511, 313);
            this->Controls->Add(this->toolStrip1);
            this->Controls->Add(this->button3);
            this->Controls->Add(this->button2);
            this->Controls->Add(this->button1);
            this->Controls->Add(this->textBox1);
            this->Controls->Add(this->webBrowser1);
            this->Name = L"Form1";
            this->Text = L"Form1";
            this->toolStrip1->ResumeLayout(false);
            this->toolStrip1->PerformLayout();
            this->ResumeLayout(false);
            this->PerformLayout();
 
        }
#pragma endregion
 
    private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
                 webBrowser1->Navigate(textBox1->Text);
                 
             }
    private: System::Void webBrowser1_NewWindow(System::Object^  sender, System::ComponentModel::CancelEventArgs^  e) {
                 e->Cancel=true;
                 webBrowser1->Navigate(webBrowser1->StatusText);
                 
 
             }
    private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {
                 webBrowser1->GoBack();
             }
private: System::Void button3_Click(System::Object^  sender, System::EventArgs^  e) {
             webBrowser1->GoForward();
         }
private: System::Void toolStripButton1_Click(System::Object^  sender, System::EventArgs^  e) {
             //(gcnew FormSearch)->ShowDialog();
             //this->webBrowser1->Url=(gcnew FormSearch)->site;
            
 
 
             FormSearch^ f = gcnew FormSearch();
             f->ShowDialog(this);
            textBox1->Text=f->label6->Text;
 
    
 
            
 
            // this->webBrowser1->Navigate(textBox1->Text);
        
             
 
 
 
 
         }
private: System::Void webBrowser1_ProgressChanged(System::Object^  sender, System::Windows::Forms::WebBrowserProgressChangedEventArgs^  e) {
             //Показ адресной строки в TextBar
             textBox1->Text=webBrowser1->Url->AbsoluteUri;
             // Прогресс бар
             toolStripProgressBar1->Value = e->CurrentProgress;
             toolStripProgressBar1->Maximum = e->MaximumProgress;
             
 
         }
 
 
private: System::Void toolStripButton4_Click(System::Object^  sender, System::EventArgs^  e) {
             webBrowser1->Refresh();
         }
};
}
Форма 2
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
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
#pragma once
#include "std_lib_facilities.h"
 
 
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace System::Net;
 
 
 
 
namespace DiplomProject {
 
    /// <summary>
    /// Summary for FormSearch
    ///
    /// 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 FormSearch : public System::Windows::Forms::Form
    {
    public:
        FormSearch(void)
        {
        
            InitializeComponent();
            //
            //TODO: Add the constructor code here
            //
        }
 
    protected:
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        ~FormSearch()
        {
            if (components)
            {
                delete components;
            }
        }
    private: System::Windows::Forms::Label^  label1;
    protected: 
    private: System::Windows::Forms::Label^  label2;
    private: System::Windows::Forms::Label^  label3;
    private: System::Windows::Forms::Label^  label4;
    private: System::Windows::Forms::Button^  button1;
    private: System::Windows::Forms::Button^  button2;
    private: System::Windows::Forms::TextBox^  textBox1;
    private: System::Windows::Forms::ComboBox^  comboBox1;
    private: System::Windows::Forms::ComboBox^  comboBox2;
    private: System::Windows::Forms::ComboBox^  comboBox3;
    private: System::Windows::Forms::ComboBox^  comboBox4;
    private: System::Windows::Forms::ComboBox^  comboBox5;
    private: System::Windows::Forms::ComboBox^  comboBox6;
    private: System::Windows::Forms::Label^  label5;
    public: System::Windows::Forms::Label^  label6;
 
    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->label1 = (gcnew System::Windows::Forms::Label());
            this->label2 = (gcnew System::Windows::Forms::Label());
            this->label3 = (gcnew System::Windows::Forms::Label());
            this->label4 = (gcnew System::Windows::Forms::Label());
            this->button1 = (gcnew System::Windows::Forms::Button());
            this->button2 = (gcnew System::Windows::Forms::Button());
            this->textBox1 = (gcnew System::Windows::Forms::TextBox());
            this->comboBox1 = (gcnew System::Windows::Forms::ComboBox());
            this->comboBox2 = (gcnew System::Windows::Forms::ComboBox());
            this->comboBox3 = (gcnew System::Windows::Forms::ComboBox());
            this->comboBox4 = (gcnew System::Windows::Forms::ComboBox());
            this->comboBox5 = (gcnew System::Windows::Forms::ComboBox());
            this->comboBox6 = (gcnew System::Windows::Forms::ComboBox());
            this->label5 = (gcnew System::Windows::Forms::Label());
            this->label6 = (gcnew System::Windows::Forms::Label());
            this->SuspendLayout();
            // 
            // label1
            // 
            this->label1->AutoSize = true;
            this->label1->Font = (gcnew System::Drawing::Font(L"Times New Roman", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
                static_cast<System::Byte>(0)));
            this->label1->Location = System::Drawing::Point(24, 27);
            this->label1->Name = L"label1";
            this->label1->Size = System::Drawing::Size(106, 15);
            this->label1->TabIndex = 0;
            this->label1->Text = L"Текст для пошуку";
            // 
            // label2
            // 
            this->label2->AutoSize = true;
            this->label2->Font = (gcnew System::Drawing::Font(L"Times New Roman", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
                static_cast<System::Byte>(0)));
            this->label2->Location = System::Drawing::Point(24, 49);
            this->label2->Name = L"label2";
            this->label2->Size = System::Drawing::Size(88, 15);
            this->label2->TabIndex = 1;
            this->label2->Text = L"Місце пошуку";
            // 
            // label3
            // 
            this->label3->AutoSize = true;
            this->label3->Font = (gcnew System::Drawing::Font(L"Times New Roman", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
                static_cast<System::Byte>(0)));
            this->label3->Location = System::Drawing::Point(24, 71);
            this->label3->Name = L"label3";
            this->label3->Size = System::Drawing::Size(91, 15);
            this->label3->TabIndex = 2;
            this->label3->Text = L"Дата публікації";
            // 
            // label4
            // 
            this->label4->AutoSize = true;
            this->label4->Font = (gcnew System::Drawing::Font(L"Times New Roman", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
                static_cast<System::Byte>(0)));
            this->label4->Location = System::Drawing::Point(24, 93);
            this->label4->Name = L"label4";
            this->label4->Size = System::Drawing::Size(73, 15);
            this->label4->TabIndex = 3;
            this->label4->Text = L"Сортування";
            // 
            // button1
            // 
            this->button1->Location = System::Drawing::Point(110, 127);
            this->button1->Name = L"button1";
            this->button1->Size = System::Drawing::Size(95, 31);
            this->button1->TabIndex = 4;
            this->button1->Text = L"Шукати";
            this->button1->UseVisualStyleBackColor = true;
            this->button1->Click += gcnew System::EventHandler(this, &FormSearch::button1_Click);
            // 
            // button2
            // 
            this->button2->Location = System::Drawing::Point(276, 127);
            this->button2->Name = L"button2";
            this->button2->Size = System::Drawing::Size(95, 31);
            this->button2->TabIndex = 5;
            this->button2->Text = L"Скасувати";
            this->button2->UseVisualStyleBackColor = true;
            this->button2->Click += gcnew System::EventHandler(this, &FormSearch::button2_Click);
            // 
            // textBox1
            // 
            this->textBox1->Location = System::Drawing::Point(157, 22);
            this->textBox1->Name = L"textBox1";
            this->textBox1->Size = System::Drawing::Size(315, 20);
            this->textBox1->TabIndex = 6;
            // 
            // comboBox1
            // 
            this->comboBox1->FormattingEnabled = true;
            this->comboBox1->Items->AddRange(gcnew cli::array< System::Object^  >(4) {L"Всюди", L"У заголовку", L"В анонсі", L"У тексті"});
            this->comboBox1->Location = System::Drawing::Point(157, 43);
            this->comboBox1->Name = L"comboBox1";
            this->comboBox1->Size = System::Drawing::Size(116, 21);
            this->comboBox1->TabIndex = 7;
            // 
            // comboBox2
            // 
            this->comboBox2->FormattingEnabled = true;
            this->comboBox2->ImeMode = System::Windows::Forms::ImeMode::On;
            this->comboBox2->Items->AddRange(gcnew cli::array< System::Object^  >(3) {L"дорівнює", L"раніше ніж", L"пізніше за"});
            this->comboBox2->Location = System::Drawing::Point(157, 65);
            this->comboBox2->Name = L"comboBox2";
            this->comboBox2->Size = System::Drawing::Size(79, 21);
            this->comboBox2->TabIndex = 8;
            this->comboBox2->SelectedIndexChanged += gcnew System::EventHandler(this, &FormSearch::comboBox2_SelectedIndexChanged);
            // 
            // comboBox3
            // 
            this->comboBox3->FormattingEnabled = true;
            this->comboBox3->Items->AddRange(gcnew cli::array< System::Object^  >(22) {L"0", L"2012", L"2011", L"2010", L"2009", L"2008", 
                L"2007", L"2006", L"2005", L"2004", L"2003", L"2002", L"2001", L"2000", L"1999", L"1998", L"1997", L"1996", L"1995", L"1994", 
                L"1993", L"1992"});
            this->comboBox3->Location = System::Drawing::Point(242, 65);
            this->comboBox3->Name = L"comboBox3";
            this->comboBox3->Size = System::Drawing::Size(48, 21);
            this->comboBox3->TabIndex = 9;
            // 
            // comboBox4
            // 
            this->comboBox4->FormattingEnabled = true;
            this->comboBox4->Items->AddRange(gcnew cli::array< System::Object^  >(13) {L"0", L"1-Січень", L"2-Лютий", L"3-Березень", L"4-Квітень", 
                L"5-Травень", L"6-Червень", L"7-Липень", L"8-Серпень", L"9-Вересень", L"10-Жовтень", L"11-Листопад", L"12-Грудень"});
            this->comboBox4->Location = System::Drawing::Point(296, 65);
            this->comboBox4->Name = L"comboBox4";
            this->comboBox4->Size = System::Drawing::Size(79, 21);
            this->comboBox4->TabIndex = 10;
            // 
            // comboBox5
            // 
            this->comboBox5->FormattingEnabled = true;
            this->comboBox5->Items->AddRange(gcnew cli::array< System::Object^  >(32) {L"0", L"1", L"2", L"3", L"4", L"5", L"6", L"7", 
                L"8", L"9", L"10", L"11", L"12", L"13", L"14", L"15", L"16", L"17", L"18", L"19", L"20", L"21", L"22", L"23", L"24", L"25", L"26", 
                L"27", L"28", L"29", L"30", L"31"});
            this->comboBox5->Location = System::Drawing::Point(381, 65);
            this->comboBox5->Name = L"comboBox5";
            this->comboBox5->Size = System::Drawing::Size(65, 21);
            this->comboBox5->TabIndex = 11;
            // 
            // comboBox6
            // 
            this->comboBox6->FormattingEnabled = true;
            this->comboBox6->Items->AddRange(gcnew cli::array< System::Object^  >(2) {L"за релевантністю", L"по даті публікації"});
            this->comboBox6->Location = System::Drawing::Point(157, 87);
            this->comboBox6->Name = L"comboBox6";
            this->comboBox6->Size = System::Drawing::Size(116, 21);
            this->comboBox6->TabIndex = 12;
            // 
            // label5
            // 
            this->label5->AutoSize = true;
            this->label5->Font = (gcnew System::Drawing::Font(L"Times New Roman", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
                static_cast<System::Byte>(0)));
            this->label5->Location = System::Drawing::Point(121, 4);
            this->label5->Name = L"label5";
            this->label5->Size = System::Drawing::Size(348, 15);
            this->label5->TabIndex = 13;
            this->label5->Text = L"Пошук за реквiзитами (мiнiмальна довжина слова 3 символи)";
            // 
            // label6
            // 
            this->label6->AutoSize = true;
            this->label6->Location = System::Drawing::Point(12, 108);
            this->label6->Name = L"label6";
            this->label6->Size = System::Drawing::Size(35, 13);
            this->label6->TabIndex = 14;
            this->label6->Text = L"label6";
            // 
            // FormSearch
            // 
            this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
            this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
            this->BackColor = System::Drawing::SystemColors::ActiveCaption;
            this->ClientSize = System::Drawing::Size(484, 162);
            this->Controls->Add(this->label6);
            this->Controls->Add(this->label5);
            this->Controls->Add(this->comboBox6);
            this->Controls->Add(this->comboBox5);
            this->Controls->Add(this->comboBox4);
            this->Controls->Add(this->comboBox3);
            this->Controls->Add(this->comboBox2);
            this->Controls->Add(this->comboBox1);
            this->Controls->Add(this->textBox1);
            this->Controls->Add(this->button2);
            this->Controls->Add(this->button1);
            this->Controls->Add(this->label4);
            this->Controls->Add(this->label3);
            this->Controls->Add(this->label2);
            this->Controls->Add(this->label1);
            this->MaximumSize = System::Drawing::Size(500, 200);
            this->MinimumSize = System::Drawing::Size(500, 200);
            this->Name = L"FormSearch";
            this->Text = L"FormSearch";
            this->Shown += gcnew System::EventHandler(this, &FormSearch::FormSearch_Shown);
            this->ResumeLayout(false);
            this->PerformLayout();
 
        }
#pragma endregion
    private: System::Void comboBox2_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
            
             }
private: System::Void FormSearch_Shown(System::Object^  sender, System::EventArgs^  e) {
             comboBox2->SelectedIndex=0;
             comboBox1->SelectedIndex=0;
             comboBox6->SelectedIndex=0;
             comboBox3->SelectedIndex=0;
             comboBox4->SelectedIndex=0;
             comboBox5->SelectedIndex=0;
         }
private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {
            this->Close();
         }
public: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
 
int search = 0;
int date=0;
int day=0;
int month=0;
int sort=0;
 
 
 
search = comboBox1->SelectedIndex;
date = (comboBox2->SelectedIndex) +1;
day = comboBox4->SelectedIndex;
month = comboBox5->SelectedIndex;
sort = (comboBox6->SelectedIndex) +1;
 
 
label6->Text = "iportal.rada.gov.ua/search?search="+(textBox1->Text)+"&field="+search+"&date_type="+date+"&year="+(comboBox3->SelectedItem)+"&month="+month+"&day="+day+"&sort="+sort+"&submit_form=true";
            //Close();
            
        
 
         }
 
};
}
0
cpp_developer
Эксперт
20123 / 5690 / 1417
Регистрация: 09.04.2010
Сообщений: 22,546
Блог
14.11.2012, 21:38
Ответы с готовыми решениями:

Как записать в файл русские буквы?
Здравствуйте. Делаю в Windows Forms небольшой проект и нужно при нажатии на кнопку записать в файл некоторый текст. Пример кода: ...

Не отображаются русские буквы в приложении на VC++.NET
Не отображаются русские буквы в заголовках меню. Вместо них обычные зюки, как при слетевших кодировках. Помогите пожалуйста настроить...

При чтении из файла, пропадают русские буквы
Подскажите пожалуйста. Разбираю пример. http://msdn.microsoft.com/ru-ru/library/system.io.file(v=vs.110).aspx При чтении из файла,...

6
873 / 771 / 173
Регистрация: 11.01.2012
Сообщений: 1,942
15.11.2012, 11:53
Цитата Сообщение от Anhedonia Посмотреть сообщение
site.com/text?text=Здесь русский текст&search=5 итд..
Но когда он переходит по нужной ссылке, Url кодируется в неизвестно что и сайт не реагирует
А это где в коде ?
У себя стал запускать уже здесь не работает
C++
1
2
3
4
5
6
7
8
9
private: System::Void webBrowser1_ProgressChanged(System::Object^  sender, System::Windows::Forms::WebBrowserProgressChangedEventArgs^  e) {
             //Показ адресной строки в TextBar
             textBox1->Text=webBrowser1->Url->AbsoluteUri;
             // Прогресс бар
             toolStripProgressBar1->Value = e->CurrentProgress;
             toolStripProgressBar1->Maximum = e->MaximumProgress;
             
 
         }
Насколько понял страница если долго грузится то получаем переполнение .


Вот так запускается без ошибок
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
private: System::Void webBrowser1_ProgressChanged(System::Object^  sender, System::Windows::Forms::WebBrowserProgressChangedEventArgs^  e) {
          
             //Показ адресной строки в TextBar
            if ( webBrowser1->Url == nullptr)
                 textBox1->Text = " Адрес не получен ";  
            else
                 textBox1->Text = webBrowser1->Url->AbsoluteUri;
 
 
             // Прогресс бар
 
            toolStripProgressBar1->Minimum = 1;         
            toolStripProgressBar1->Maximum = 1000;
            toolStripProgressBar1->Step = 5;
            
            if (e->CurrentProgress > 0 &&  e->CurrentProgress < toolStripProgressBar1->Maximum )
               toolStripProgressBar1->Value = e->CurrentProgress;
             
 
         }
Цитата Сообщение от Anhedonia Посмотреть сообщение
чтобы при переходе Url не кодировался?
А где основную ошибку искать не понял
0
0 / 0 / 0
Регистрация: 22.08.2012
Сообщений: 15
15.11.2012, 12:57  [ТС]
Вот форма 2, я просто записал его в лейбл чтобы видеть что получается на выходе, ну и не стал переделывать его, просто поставил чтобы брало текст с лейбла.
C++
1
label6->Text = "iportal.rada.gov.ua/search?search="+(textBox1->Text)+"&field="+search+"&date_type="+date+"&year="+(comboBox3->SelectedItem)+"&month="+month+"&day="+day+"&sort="+sort+"&submit_form=true";

Оно все хорошо передает, переходит по ссылке, вот только мне нужно чтобы (textBox1->Text) кодировался сначала в юрл, а потом передавался в форму 1. Я уже что только не перепробовал, не получается его закодировать.
0
873 / 771 / 173
Регистрация: 11.01.2012
Сообщений: 1,942
15.11.2012, 22:27
Цитата Сообщение от Anhedonia Посмотреть сообщение
Оно все хорошо передает, переходит по ссылке
Так в чем дело ? Все же работает . Ладно это уже без меня .

Цитата Сообщение от Anhedonia Посмотреть сообщение
вот только мне нужно чтобы (textBox1->Text) кодировался сначала в юрл
Ну а поиск чего ?
Вот вбил в поиск - получил http://motevich.blogspot.ru/20... ormat.html
На СИ функция написана
Для .NET что нибудь сами подберете если понадобиться .

Добавлено через 9 минут
Функцию надо чуть подкорректировать для русских символов .
В форме добавите ее также как обработчик кнопок
Как то так
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
   private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) 
{
            .........................................   
                 
             }
private: char *EncodePlainToURL(const char *sIn, char *sOut)
{
    int i;
    char cCurChar;
    char sCurStr[4] = {0};
 
    sOut[0] = '\0';
 
    for (i = 0; cCurChar = sIn[i]; i++)
    {
        // if this is a digit or an alphabetic letter
        if (
            ( cCurChar >= 'А' &&  cCurChar <= 'Я') || 
            ( cCurChar >= 'а' &&  cCurChar <= 'я') ||
            ( cCurChar >= 'A' &&  cCurChar <= 'Z') ||
            ( cCurChar >= 'a' &&  cCurChar <= 'z') ||
            ( cCurChar >= '0' &&  cCurChar <= '9') 
            )
        {
            // then write the current character "as is"
            sprintf(sCurStr, "%c", cCurChar);
        }
        else
        {
            // else convert it to hex-form. "_" -> "%5F"
            sprintf(sCurStr, "%%%X", cCurChar);
        }
 
        // append current item to the output string
        strcat(sOut, sCurStr);
    }
 
    return sOut;
}
 
   private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {
           
                 
             }
Добавлено через 9 минут
И вызоваете где вам нужно
Примерно так
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
private: System::Void button_Click(System::Object^  sender, System::EventArgs^  e) {
 
//
///////////////////////////////////////////////////////////
     //          ВЫЗОВ
//////////////////////////////////////////////////////////
           char str[100];
            
              // Строку из   textBox  конвертируем  в char*
         char* chstring = (char*) Marshal::StringToHGlobalAnsi(textBox1->Text).ToPointer();
             
                           //  Выводим в другой   textBox 
                            //  EncodePlainToURL  - это наша функция  
            textBox2->Text = gcnew String (EncodePlainToURL( chstring, str));
 
                             //  освобождаем выделенную память 
             Marshal::FreeHGlobal(IntPtr(chstring));
                 
             }
0
0 / 0 / 0
Регистрация: 22.08.2012
Сообщений: 15
16.11.2012, 13:12  [ТС]
Сегодня ближе к вечеру буду дома и попробую ваш способ. Надеюсь что он сработает)
0
873 / 771 / 173
Регистрация: 11.01.2012
Сообщений: 1,942
16.11.2012, 17:08
Цитата Сообщение от Anhedonia Посмотреть сообщение
Надеюсь что он сработает
не забудьте подключить
C++
1
using namespace System::Runtime::InteropServices;
можно чуть поправить , преобразования внутрь запихать
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
private: String^ EncodePlainToURL( String ^ cliStr)
{
    char *sIn = (char*) Marshal::StringToHGlobalAnsi(cliStr).ToPointer();
    int i;
    char cCurChar;
    char sCurStr[4] = {0};
    char sOut[500];
 
    sOut[0] = '\0';
 
    for (i = 0; cCurChar = sIn[i]; i++)
    {
        // if this is a digit or an alphabetic letter
        if (
            ( cCurChar >= 'А' &&  cCurChar <= 'Я') || 
            ( cCurChar >= 'а' &&  cCurChar <= 'я') ||
            ( cCurChar >= 'A' &&  cCurChar <= 'Z') ||
            ( cCurChar >= 'a' &&  cCurChar <= 'z') ||
            ( cCurChar >= '0' &&  cCurChar <= '9') 
            )
        {
            // then write the current character "as is"
            sprintf(sCurStr, "%c", cCurChar);
        }
        else
        {
            // else convert it to hex-form. "_" -> "%5F"
            sprintf(sCurStr, "%%%X", cCurChar);
        }
        // append current item to the output string
        strcat(sOut, sCurStr);
    }
 
     Marshal::FreeHGlobal(IntPtr(sIn));
 
    return ( gcnew String(sOut));
}
и вызывать уже напрямую
C++
1
2
3
4
5
private: System::Void button_Click(System::Object^  sender, System::EventArgs^  e) {
 
            textBox1->Text = "Русский текст";
 
textBox2->Text = (EncodePlainToURL( textBox1->Text));
А эту тему смотрели ? Как закодировать русские символы в URL для WebBrowser

Вот готовые методы есть System::Uri::EscapeDataString
System::Uri::EscapeUriString

Вызов будет таким же
C++
1
2
3
4
5
private: System::Void button_Click(System::Object^  sender, System::EventArgs^  e) {
 
            textBox1->Text = "Русский текст";
 
textBox2->Text = System::Uri::EscapeDataString( textBox1->Text);
1
0 / 0 / 0
Регистрация: 22.08.2012
Сообщений: 15
16.11.2012, 19:37  [ТС]
Пока не предоставляется возможности сесть за комп, но как только сяду сразу отпишу, работает или нет. Спасибо за проделанную работу)
0
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
raxper
Эксперт
30234 / 6612 / 1498
Регистрация: 28.12.2010
Сообщений: 21,154
Блог
16.11.2012, 19:37
Помогаю со студенческими работами здесь

Русские буквы в URL
Несколько дней назад перенес сайт на сервер (CentOS 6.4) с панелью VESTA. Вчера заметил что в галереи не работают ссылки на изображения...

URL и русские буквы
Процедура в потоке не воспринимает русские буквы: procedure TMyThread.Execute; var q:tmemorystream; begin ...

русские буквы в url форума
Добрый день, на днях столкнулся с таким моментом на одном форуме, пример:...

Гугловский синтезатор речи и русские буквы в URL
Пытаюсь использовать Гугловский голосовой синтезатор. Набираю в свежей версии Opera адрес типа:...

Заменить в исходном файле русские буквы ‘к’ на буквы ‘т’, буквы ‘т’ на буквы ‘к’, буквы ‘л’ на буквы ‘в’, буквы ‘в’ на
Задание: Заменить в исходном файле русские буквы ‘к’ на буквы ‘т’, буквы ‘т’ на буквы ‘к’, буквы ‘л’ на буквы ‘в’, буквы ‘в’ на буквы ‘л’.


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
7
Ответ Создать тему
Новые блоги и статьи
SDL3 для Web (WebAssembly): Обработчик клика мыши в браузере ПК и касания экрана в браузере на мобильном устройстве
8Observer8 02.02.2026
Содержание блога Для начала пошагово создадим рабочий пример для подготовки к экспериментам в браузере ПК и в браузере мобильного устройства. Потом напишем обработчик клика мыши и обработчик. . .
Философия технологии
iceja 01.02.2026
На мой взгляд у человека в технических проектах остается роль генерального директора. Все остальное нейронки делают уже лучше человека. Они не могут нести предпринимательские риски, не могут. . .
SDL3 для Web (WebAssembly): Вывод текста со шрифтом TTF с помощью SDL3_ttf
8Observer8 01.02.2026
Содержание блога В этой пошаговой инструкции создадим с нуля веб-приложение, которое выводит текст в окне браузера. Запустим на Android на локальном сервере. Загрузим Release на бесплатный. . .
SDL3 для Web (WebAssembly): Сборка C/C++ проекта из консоли
8Observer8 30.01.2026
Содержание блога Если вы откроете примеры для начинающих на официальном репозитории SDL3 в папке: examples, то вы увидите, что все примеры используют следующие четыре обязательные функции, а. . .
SDL3 для Web (WebAssembly): Установка Emscripten SDK (emsdk) и CMake для сборки C и C++ приложений в Wasm
8Observer8 30.01.2026
Содержание блога Для того чтобы скачать Emscripten SDK (emsdk) необходимо сначало скачать и уставить Git: Install for Windows. Следуйте стандартной процедуре установки Git через установщик. . . .
SDL3 для Android: Подключение Box2D v3, физика и отрисовка коллайдеров
8Observer8 29.01.2026
Содержание блога Box2D - это библиотека для 2D физики для анимаций и игр. С её помощью можно определять были ли коллизии между конкретными объектами. Версия v3 была полностью переписана на Си, в. . .
Инструменты COM: Сохранение данный из VARIANT в файл и загрузка из файла в VARIANT
bedvit 28.01.2026
Сохранение базовых типов COM и массивов (одномерных или двухмерных) любой вложенности (деревья) в файл, с возможностью выбора алгоритмов сжатия и шифрования. Часть библиотеки BedvitCOM Использованы. . .
SDL3 для Android: Загрузка PNG с альфа-каналом с помощью SDL_LoadPNG (без SDL3_image)
8Observer8 28.01.2026
Содержание блога SDL3 имеет собственные средства для загрузки и отображения PNG-файлов с альфа-каналом и базовой работы с ними. В этой инструкции используется функция SDL_LoadPNG(), которая. . .
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2026, CyberForum.ru