Пожалуйста, помогите!

Программирование на Visual Basic, главный форум. Обсуждение тем программирования на VB 1—6.
Даже если вы плохо разбираетесь в VB и программировании вообще — тут вам помогут. В разумных пределах, конечно.
Правила форума
Темы, в которых будет сначала написано «что нужно сделать», а затем просьба «помогите», будут закрыты.
Читайте требования к создаваемым темам.
acid2
Начинающий
Начинающий
 
Сообщения: 1
Зарегистрирован: 07.10.2003 (Вт) 23:55

Пожалуйста, помогите!

Сообщение acid2 » 08.10.2003 (Ср) 0:17

Уважаемые пользователи форума.
Помогите мне справится с некоторыми сложностями.
1.
Как в VB.Net подключить OCX-файлы (они же ActiveX,кажись так пишется). В шестой версии всё очень легко, а вот в .Net
я не представляю как. А мне очень надо подключить феньку для работы с архивами зипа.
2.
Я пишу инсталлятор (думаю, знаете что такое). А проблема состоит в том что файлы придётся копировать в системные папки
(ну типа system и мои документы) так как у разных пользователей эти папки могут быть в разных местах могут возникнуть
проблемы. Я уверен, что их можно как-то определить...
Так же есть ещё одна проблема это создание ярлыков в меню Пуск->Программы. Да и вообще как создать ярлыки на рабочем столе
я тоже хотел бы узнать.
3.
В шестой версии все приложения, написанные на VB использовали библиотеку MSVBVM60.dll (как правильно пишется, забыл, время слав
богу час ночи). А как насчёт VB.Net. Я прочел, что всё семейство .Net использует одну общую библиотеку. Если не сложно скажите, где этот
файл(ы) искать.
Всё пока вопросов нет.
ЗЫ
Мне очень надо узнать ответы на эти вопросы.

И спасибо все тем, кто просто прочёл этот текст :)
Водка влияет на эрекцию… сам проверял…

RayShade
Scarmarked
Scarmarked
Аватара пользователя
 
Сообщения: 5511
Зарегистрирован: 02.12.2002 (Пн) 17:11
Откуда: Russia, Saint-Petersburg

Сообщение RayShade » 08.10.2003 (Ср) 10:35

1. Ровно так же как и в шестой. Через меню Project.

2. Нечего изобретать велосипед. Есть огроомное количество инсталяторов которые можно использовать - Wise, MindVision, WSIE, P&D Wizard наконец.

3. Не один файл а я бы сказал большое их количество - называется все вместе NET framework.

A.A.Z.
Член-корреспондент академии VBStreets
Член-корреспондент академии VBStreets
 
Сообщения: 3035
Зарегистрирован: 30.06.2003 (Пн) 13:38

Сообщение A.A.Z. » 08.10.2003 (Ср) 17:55

Насчёт №2:

API-Guide писал(а):
1.
Description:
The GetSystemDirectory function retrieves the path of the Windows system directory. The system directory contains such files as Windows libraries, drivers, and font files.

Declararion:
Код: Выделить всё
Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long


Parameters:
· lpBuffer
Points to the buffer to receive the null-terminated string containing the path. This path does not end with a backslash unless the system directory is the root directory. For example, if the system directory is named WINDOWS\SYSTEM on drive C, the path of the system directory retrieved by this function is C:\WINDOWS\SYSTEM.

· uSize
Specifies the maximum size of the buffer, in characters. This value should be set to at least MAX_PATH.

Return Values:
If the function succeeds, the return value is the length, in characters, of the string copied to the buffer, not including the terminating null character. If the length is greater than the size of the buffer, the return value is the size of the buffer required to hold the path.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Sample:
Код: Выделить всё
Private Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Private Sub Form_Load()
    'KPD-Team 1998
    'URL: http://www.allapi.net/
    'E-Mail: KPDTeam@Allapi.net
    Dim sSave As String, Ret As Long
    'Create a buffer
    sSave = Space(255)
    'Get the system directory
    Ret = GetSystemDirectory(sSave, 255)
    'Remove all unnecessary chr$(0)'s
    sSave = Left$(sSave, Ret)
    'Show the windows directory
    MsgBox "Windows System directory: " + sSave
End Sub




2.
Descrption:
The GetWindowsDirectory function retrieves the path of the Windows directory. The Windows directory contains such files as Windows-based applications, initialization files, and Help files.

Declaration:
Код: Выделить всё
Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long


Parameters:
· lpBuffer
Points to the buffer to receive the null-terminated string containing the path. This path does not end with a backslash unless the Windows directory is the root directory. For example, if the Windows directory is named WINDOWS on drive C, the path of the Windows directory retrieved by this function is C:\WINDOWS. If Windows was installed in the root directory of drive C, the path retrieved is C:\.

· uSize
Specifies the maximum size, in characters, of the buffer specified by the lpBuffer parameter. This value should be set to at least MAX_PATH to allow sufficient room in the buffer for the path.

Return Values:
If the function succeeds, the return value is the length, in characters, of the string copied to the buffer, not including the terminating null character.

If the length is greater than the size of the buffer, the return value is the size of the buffer required to hold the path.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Sample:
Код: Выделить всё
'This project needs a PictureBox, called 'Picture1'

'In general section
Private Declare Function DrawIcon Lib "user32" Alias "DrawIcon" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As Long
Private Declare Function ExtractIcon Lib "shell32.dll" Alias "ExtractIconA" (ByVal hInst As Long, ByVal lpszExeFileName As String, ByVal nIconIndex As Long) As Long
Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long


Private Sub Form_Load()
    'KPD-Team 1998
    'URL: http://www.allapi.net/
    'E-Mail: KPDTeam@Allapi.net

    Dim Path as String, strSave as string
    'Create a buffer string
    strSave = String(200, Chr$(0))
    'Get the windows directory and append '\REGEdit.exe' to it
    Path = Left$(strSave, GetWindowsDirectory(strSave, Len(strSave))) + "\REGEdit.exe"
    'No pictures
    Picture1.Picture = LoadPicture()
    'Set graphicmode to 'persistent
    Picture1.AutoRedraw = True
    'Extract the icon from REGEdit
    return1& = ExtractIcon(Me.hWnd, Path, 2)
    'Draw the icon on the form
    return2& = DrawIcon(Picture1.hdc, 0, 0, return1&)
End Sub



3. Этот пример показывает, как найти папки Юзверей, там, по умолчанию, текущего или всех сразу.

Sample:
Код: Выделить всё
Private Const TOKEN_QUERY = (&H8)
Private Declare Function GetAllUsersProfileDirectory Lib "userenv.dll" Alias "GetAllUsersProfileDirectoryA" (ByVal lpProfileDir As String, lpcchSize As Long) As Boolean
Private Declare Function GetDefaultUserProfileDirectory Lib "userenv.dll" Alias "GetDefaultUserProfileDirectoryA" (ByVal lpProfileDir As String, lpcchSize As Long) As Boolean
Private Declare Function GetProfilesDirectory Lib "userenv.dll" Alias "GetProfilesDirectoryA" (ByVal lpProfileDir As String, lpcchSize As Long) As Boolean
Private Declare Function GetUserProfileDirectory Lib "userenv.dll" Alias "GetUserProfileDirectoryA" (ByVal hToken As Long, ByVal lpProfileDir As String, lpcchSize As Long) As Boolean
Private Declare Function GetCurrentProcess Lib "kernel32" () As Long
Private Declare Function OpenProcessToken Lib "advapi32" (ByVal ProcessHandle As Long, ByVal DesiredAccess As Long, TokenHandle As Long) As Long
Private Sub Form_Load()
    'KPD-Team 2000
    'URL: http://www.allapi.net/
    'E-Mail: KPDTeam@allapi.net
    Dim sBuffer As String, Ret As Long, hToken As Long
    'set the graphics mode of this form to 'persistent'
    Me.AutoRedraw = True
    'create a string buffer
    sBuffer = String(255, 0)
    'retrieve the all users profile directory
    GetAllUsersProfileDirectory sBuffer, 255
    'show the result
    Me.Print StripTerminator(sBuffer)
    'create a string buffer
    sBuffer = String(255, 0)
    'retrieve the user profile directory
    GetDefaultUserProfileDirectory sBuffer, 255
    'show the result
    Me.Print StripTerminator(sBuffer)
    'create a string buffer
    sBuffer = String(255, 0)
    'retrieve the profiles directory
    GetProfilesDirectory sBuffer, 255
    'show the result
    Me.Print StripTerminator(sBuffer)
    'create a string buffer
    sBuffer = String(255, 0)
    'open the token of the current process
    OpenProcessToken GetCurrentProcess, TOKEN_QUERY, hToken
    'retrieve this users profile directory
    GetUserProfileDirectory hToken, sBuffer, 255
    'show the result
    Me.Print StripTerminator(sBuffer)
End Sub
'strips off the trailing Chr$(0)'s
Function StripTerminator(sInput As String) As String
    Dim ZeroPos As Long
    ZeroPos = InStr(1, sInput, Chr$(0))
    If ZeroPos > 0 Then
        StripTerminator = Left$(sInput, ZeroPos - 1)
    Else
        StripTerminator = sInput
    End If
End Function


ЗЫ для папок не обязательно API. Можно также использовать environ.
Код: Выделить всё
Private Sub Form_Load()
Dim a As String, b As String, c As String, d As String, e As String
a = Environ("windir")
b = Environ("programfiles")
c = Environ("systemroot")
d = Environ("temp")
e = Environ("compsrec") 'командная строка
End Sub

ЗЗЫ Надеюсь, с английским у тебя всё хорошо... :wink:
Нет меня больше


Вернуться в Visual Basic 1–6

Кто сейчас на конференции

Сейчас этот форум просматривают: Google-бот и гости: 3

    TopList