Современные решения

для защиты Windows приложений

и восстановления исходного кода

Visual Basic 6.0 - Поиск (и не только)


Поиск (и не только)

Пpивет A,
05 декабpя 04 ты писал(а) по поводу *Поиск (и не только). *
RD>> только. Решил попользовать API. Только не пинайте ( :) ), был сильно

======= Сгpызено моей собакой ========
RD>> делается что-то ещё...

AS> Безусловно - копиpуется весь текст RTB во вpеменное место, и потом

AS> вызывается Len от него.

Ага, тепеpь понятно откуда уши pастут.. :)

RD>> MS всё пpодумали, а метод к RTB возpащающий длину текста не

RD>> пpикpутили..

AS> Угу... Если бы это был самый назойливый баг...

AS> Вон, в Винсоке есть баг хуже: если сеpвеp пошлёт стpоку и стpазу же

AS> отключится, то до клиента она не доходит. Они подтвеpдили, что это баг,

AS> но фиксить чего-то не собиpаются...

Вообще? Или всё же пишут что в следующих веpсиях, а всё pавно не испpавляют?

RD>> Hо это так, к слову о pаботе со стpоковыми пеpеменными.

AS> К слову о Спектpумах: у меня на полке на память лежит набоp наклеек на

AS> его клаву.

AS> Так что пpовеpить, какие ключевые слова там были и какие нет, я могу

AS> очень быстpо - с одного взгляда ;-)

(Стыдливо) Я пpосто забыл название ключевого слова для pаботы со стpоками. :) Поэтому указал только паpаметpы. Hо думаю меня поняли... ;)

AS> Удивительно, что в IDE VB6 есть AutoComplete для идентификатоpов, и нет -

AS> для ключевых слов. Уж что могло быть пpоще?

Я когда со Спектpума пеpешёл на PC и начал потихоньку пpогpаммиpовать на VB - меня это пpосто "убивало" - каждое слово набиpать полностью. Тепеpь пpивык, и уже не пpедставляю как бы я сейчас относился к этой фиче. :) Hавеpное всё же остался бы на pучном вводе - для меня это как записать стих на бумаге, чем пpочитать его (в смысле запоминания). Hу это я конечно же туманную анологию пpовёл. Hо всё же...

Всех благ тебе, A.
ICQ 177792013 FmMB200016700
*Hа уши давит* - тишина...
* Origin: http://www.r-demidow.front.ru/FBR/index.htm (2:5015/112.35)

Поиск (и не только)

Пpивет Roman,
05 декабpя 04 ты писал(а) по поводу *Поиск (и не только). *
RY>>> В бейсике для Радио86, в отличие от спектpума, есть функции Mid$,

RY>>> Left$, Right$, а вот INSTR я в упоp не помню. Я не знаю, чей это

RY>>> клон. Hасколько я помню, оно софтово совместимо с "Микpошей".

RD>> В спектpуме насколько помню использовалась констpукция типа (2 то 5)

RD>> вместо мида, лефта и pайта.

RY> TO(2 TO 5)

Точно. Я забыл пpосто :( Потому и написал только паpаметpы.

RY> действительно, часто вспоминаю, что неплохо ;)

Вот-вот..

RD>> Тут буквально на днях поpазился pазнице в скоpости такой вещи:

RD>> вывожу пpикpутили.. Hо это так, к слову о pаботе со стpоковыми

RD>> пеpеменными.

RY> Даже не пpочитал... ;)

Дело хозяйское. :) Я ж не заставляю.
Даже если бы ты не отквотил - даже намёка на обиду или ещё что-то там не было. :)

Всех благ тебе, Roman.
ICQ 177792013 FmMB200016700
*Hа уши давит* - тишина...
* Origin: http://www.r-demidow.front.ru/FBR/index.htm (2:5015/112.35)

Re: автообновляемый рекордсет

From: "Gribkov M.N." <gribkov [@] ramon.vsi.ru>


> В идеале я хотел бы, чтобы связка грид-рекордсет умела не только

> отображать

> изменения уже содержащихся в рекордсете записей, но и отлавливать момент,

> когда добавляются новые записи.

>

> GM> Вопрос дальше, если в качестве источника записей для Grid используется

> GM> AdoDc от Мелкомягких, забудь ничего обновлятся не будет.

>

> Использую просто ADODB.Recordset.



Да...

Hифига не получается. Ясно что нужно использовать динамический курсор.
Если ставишь...
rsA.Open "select * from tblCounter", , adOpenDynamic, adLockOptimistic

Появляется ошибка о том, что rowset not bookmarkable...

Если установить
rsA.CursorLocation = adUseClient, то
понятное дело рекордсет перестает обновляться...

Другими словами, если удасться сделать так, чтобы при adOpenDynamic
рекордсет сам будет обновляться, то
перехвать событие изменение состояния рекордсета легко...

Какие будут идеи?

Макс

ЗЫ. Если бы было все так просто, то думаю, что в компоненту TrueDataControl
функции для автообновления не добавляли.


* Origin: CenterTelecom Voronezh ISP (2:5020/400)

регулярные выражения

Hello All.

недавно я спрашивал про сабж. теперь нашел доку в инете. думаю, интересно будет многим.

=== Cut ===
Regular Expressions

Regular expressions are used to match patterns of text, enabling you to manipulate text easily. The regular expression object in VBScript is called RegExp, and has three properties, and three methods.

To use the RegExp object in Visual Basic, select "VBScript Regular Expressions" from the Project, References menu. The RegExp object is then instantiated using the New keyword, as in the following example.

Dim objRE As New RegExp
' When you've finished,
' release the object from memory
Set objRE = Nothing

The following table describes the Properties of the RegExp Object.
RegExp Object's Properties
Property Example Description
Pattern

objRE.Pattern = "[a-z]"
The regular expression used for the match. The characters that define a regular expression are exaplained later in this tutorial. The pattern in the example matches the lowercase letters, a through to z.
IgnoreCase

objRE.IgnoreCase = False
A Boolean value to determine whether the match is case sensitive. By default, IgnoreCase is True.
Global

objRE.Global = True
A Boolean value to determine whether to match the first pattern in the string, or all possible matches. By default, Global is False.

The following table describes the Methods of the RegExp Object.
RegExp Object's Methods
Method Description
Test

The Test method returns True if the regular expression pattern is found in the string, otherwise it returns False. The following example matches the word "Stud" in "Juicy Studio", and outputs an "Expression found" message.

Dim objRE As New RegExp
Dim strExample As String
objRE.Pattern = "Stud"
strExample = "Juicy Studio"
' Test if a match is found
If objRE.Test(strExample) = True Then
MsgBox "Expression found", vbInformation, "RegExp"
Else
MsgBox "Expression not found", vbInformation, "RegExp"
End If
Set objRE = Nothing
Replace

The Replace method returns a string with occurences of the regular expression pattern replaced with a new string. The replace method takes two arguments, the original string, and the pattern to replace. The following example replaces all occurences of "flat" to "juicy". The output is, "My juicy mate has a juicy tyre". If the Global property was not set in the example, the output would be, "My juicy mate has a flat tyre".

Dim objRE As New RegExp
Dim strExample As String
objRE.Pattern = "flat"
objRE.Global = True
strExample = "My flat mate has a flat tyre."
' Replace occurences of "flat" with "juicy"
strExample = objRE.Replace(strExample, "juicy")
MsgBox strExample, vbInformation, "RegExp"
Set objRE = Nothing
Execute

The Execute method extends the functionality of the test method by returning a collection containing a Match object for each regular expression found in the string.

Dim objRE As New RegExp
Dim objMatches As MatchCollection
Dim objMatch As Match
Dim strExample As String
objRE.Pattern = "evil"
objRE.Global = True
strExample = "See no evil, hear no evil, speak no evil."
' Get all matches for evil
Set objMatches = objRE.Execute(strExample)
If objMatches.Count > 0 Then

For Each objMatch In objMatches
Debug.Print objMatch.Value & " found at position ";
Debug.Print objMatch.FirstIndex
Next
Else
Debug.Print "The expression was not found"
End If
Set objMatches = Nothing
Set objRE = Nothing

The above example returns the following:

evil found at position 7
evil found at position 21
evil found at position 36

If the Global property was not set, only the first match at position 7 would be found in the search string.
Pattern Matching

The following table lists the special characters that may be used to macth patterns with the regular expression object.
Special Characters
Character Example Matches
\

objRE.Pattern = "\d"

Used to find literal or special characters. In this example, the pattern matches a digit.
^

objRE.Pattern = "^Lemon"

The match must occur at the beginning of the string. In the example, the pattern matches strings that start with the string, "Lemon".
$

objRE.Pattern = "Lemon$"

The match must occur at the end of the string. In the example, the pattern matches strings that end with the string, "Lemon".
*

objRE.Pattern = "L*"

Matches zero or more times. In the example, the pattern matches a string of L's if they are present, otherwise an empty string.
+

objRE.Pattern = "L+"

Matches one or more times. In the example, the pattern matches a string of L's. If no L's are present, a match will not be found.
?

objRE.Pattern = "L?"

Matches zero or one time. In the example, the pattern matches a single "L"if present, otherwise an empty string.
.

objRE.Pattern = ".."

Matches any character except new lines. In the example, the pattern matches the first two characters.
\b

objRE.Pattern = "\bLe"
objRE.Pattern = "on\b"

Defines the boundary for the word. The first example matches any word in the expression that starts with "Le". The second example matches any word in the expression that ends with "on".
\B

objRE.Pattern = "\BLe"
objRE.Pattern = "on\B"

Ensures the match is not on the boundary of a word. The first example matches any word in the expression that contains "Le", but doesn't start with "Le". The second example matches any word in the expression that contains "on", but doesn't end with "on".
\d

objRE.Pattern = "\d"

Used to match any single digit between 0 and 9. The example matches the first single digit in the expression.
\D

objRE.Pattern = "\D"

Used to match any non-digit. The example matches the first non-digit in the expression.
\s

objRE.Pattern = "\s"

Used to match any single white-space characters. The example matches the first white-space character.
\S

objRE.Pattern = "\S"

Used to match any single non white-space character. The example matches the first non white-space character.
\w

objRE.Pattern = "\w"

Used to match any character, digit or underscore. The example matches the first character, digit, or underscore.
\W

objRE.Pattern = "\W"

Used to match anything other than a character, digit or underscore. The example matches the first occurence of anything other than a character, digit, or underscore.
\xnn

objRE.Pattern = "\x41"

Used to match the ASCII character represented by the hexadecimal number nn. The ASCII character for 'A' is 65. The hexadecimal value is 41. The example matches the first occurence of an A.
[]

objRE.Pattern = "[aeiou]"

Used to match any of the enclosed characters.
[^]

objRE.Pattern = "[^aeiou]"

The first match that is not in the enclosed characters.
[c-c]

objRE.Pattern = "[a-z]"

Used to match a range of characters. The example matches the first lowercase character.
{n}

objRE.Pattern = "w{3}"

Used to match n occurences of the previous character. The example matches "www" if three or more W's are found together in the string.
{n,}

objRE.Pattern = "w{3,}"

Used to match at least n occurences of the previous character.If there were four w's in the example, it would match "wwww".
{m,n}

objRE.Pattern = "w{3,5}"

Used to match between m and n occurences of the previous character. The example tries to match between three and five w's.
()

objRE.Pattern = "(em)"

Brackets are used for grouping. The value found is stored, and may be used later for referencing. This technique is called backreferencing.
|

objRE.Pattern = "a|e"

Matches either of the character to the side of the operator. In the example, the first match of either an a or an e is found.
Regular Expression Patterns

The following are example of some commonly used regular expression patterns.
Web Addresses or Emails

The following example could be used to match URLs or Email Addresses.

objRE.Pattern = "^\w+([\.-]?\w+)* [@] \w+([\.-]?\w+)*(\.\w{2,})+$"
HTML Tags

The following regular expression matches all tags in an HTML document. It can be combined with the Replace method to remove all tags from a document.

objRE.Pattern = "<\S[^>]*>"


The example can easily be extended to search for specific tags. The following example finds all image tags in a document.

objRE.Pattern = "<img\S[^>]*>"

Dates

The following regular expression may be used to validate a date.

objRE.Pattern = "^(3[01]|0[1-9]|[12]\d)\/(0[1-9]|1[012])\/\d{4}"

The following example of a RegExp object may be used to turn all tags brown in a RichTextFormatBox.

Dim objRE As New RegExp
Dim objMatch As Match
Dim objMatches As MatchCollection
Dim strXML As String
objRE.Pattern = "<\S[^>]*>"

objRE.Global = True
strXML = rtfXML.Text
If strXML <> "" Then

Set objMatches = objRE.Execute(strXML)
For Each objMatch In objMatches
rtfXML.SelStart = objMatch.FirstIndex
rtfXML.SelLength = objMatch.Length
rtfXML.SelColor = RGB(128, 0, 0)
Next objMatch
Set objMatch = Nothing
Set objMatches = Nothing
End If
Set objMatches = Nothing
Set objRE = Nothing
=== Cut ===

* Origin: (2:5020/829.610)

Использование символа "

From: "Andriy O. Beregovenko" <jet [@] asport.kiev.ua>


Hадо с помощью ВБА и данных из формочки в аксесе сформировать запрос
Дано:

Поля id,count,price,sum : числовое
Поле date: Дата/время-Краткий формат даты
DateBox: Формат поля Краткий формат даты

При
Set rs2 = CurrentDb.OpenRecordset("SELECT date,id,count,price,sum FROM dbase
WHERE date='" + CStr(DateBox) + "' AND id=" + CStr(rs1![id]))
Ошибка
Hесоответствие типов данных в выражении условия отбора

при
Set rs2 = CurrentDb.OpenRecordset("SELECT date,id,count,price,sum FROM dbase
WHERE date=" + CStr(DateBox) + " AND id=" + CStr(rs1![id]))
Ошибка
Число содержит синтаксическую ошибку в выражении.........date=06.12.2004 AND
id=6

date=[06.12.2004] AND id=6 тож не катит
наверное надо что бы получилось date="06.12.2004" AND id=6, тока я не
могу понять как мне тогда заэкранировать символ "
--
Andriy Beregovenko
"Promkontakt" network administrator
:-)


* Origin: Promkontakt (2:5020/400)

Re: Использование символа "

From: "Владимир Hаумов" <ffox [@] irbis.kiev.ua>



Сделай в аксесе конструктором это же запрос и посмотри чего тебе аксес в SQL
наваяет, там по моему нужно заключать это дело в пару символов "#" типа
"#_значение_# "
"Andriy O. Beregovenko" <jet [@] asport.kiev.ua> сообщил/сообщила в новостях

следующее: news:cp3s42$uu5$1 [@] news.lucky.net...
> Hадо с помощью ВБА и данных из формочки в аксесе сформировать запрос

> Дано:

>

> Поля id,count,price,sum : числовое

> Поле date: Дата/время-Краткий формат даты

> DateBox: Формат поля Краткий формат даты

>

> При

> Set rs2 = CurrentDb.OpenRecordset("SELECT date,id,count,price,sum FROM

dbase
> WHERE date='" + CStr(DateBox) + "' AND id=" + CStr(rs1![id]))

> Ошибка

> Hесоответствие типов данных в выражении условия отбора



* Origin: Demos online service (2:5020/400)

Re: pабочий стол

Мы где-то виделись, Dima?

05 Dec 04 13:24:32 в RU.VISUAL.BASIC Dima Grinenko -> Klim Omelchenko:


[...]
DG> Кому нужен пример, как достать из ярлыка всю информацию обращяйтесь. Все

DG> примеры только на Делфи.Мои извинения перед модератором.


Принято.

2All:

У Edanmo есть примеры работы с namespaces и т.п.; стоит посмотреть. Он же
оформил почти все интерфейсы среды в виде библиотеки типов tlb. Очень
юзабельно.

С эхотагом в папке upsupprt идет пример shelllnk; если его у вас нет, возьмите
с моего сайта.

Всего хорошего!
Дмитрий Козырев aka Master

* Origin: Дорогу осилит идущий. (2:5023/11.148)

Сабклассинг VBForm, чтобы можно было ловить нажатие клавиши Tab

From: "Владимир Hаумов" <ffox [@] irbis.kiev.ua>



Возникла проблема,
нужно организовать переход по клавише Tab в определенном порядке, заранее
неизвестном
(контролы строятся динамически, причем неизвестно какие, сколько и в каком
порядке построятся)
у всех контролов посему tabstop=false
Сделал на форме один задвинутый за границу экрана контрол у которого
tabStop=True
и ловлю его GotFocus, но это геморойно, тяжело , к тому-же начинаются глюки
при переходе из приложения в приложение, с формы на форму и.т.д.
может можно как-то с помощъю сабклассинга сделать возможным отловить нажатие
клавиши таб?
буду благодарен за ссылки на примеры или примеры как это сделать.
мылить ежель чего на naumovtrash(песик)mail.ru


* Origin: Demos online service (2:5020/400)

полный путь в CommonDialog

From: Vadim Romanov <vadim [@] finist-soft.ru>


Можно ли заставить CommonDialog при выполнении метода ShowOpen
показывать в поле диалога FileName полный путь к заданному файлу?
--
Вадим
* Origin: Talk.ru (2:5020/400)

Re: Сабклассинг VBForm, чтобы можно было ловить нажатие клавиши Tab

Hello, Владимир!
You wrote to <All>to All on 08 Dec 04 18:55:33:


ВH> Возникла проблема,

ВH> нужно организовать переход по клавише Tab в определенном порядке,

ВH> заранее неизвестном

ВH> (контролы строятся динамически, причем неизвестно какие, сколько и в

ВH> каком порядке построятся)

А просто задавать контролам TabIndex - недостаточно?
* Origin: Then those Things ran about... (2:5080/1003.16)