CoGetInstanceFromFile()

Программирование на Visual Basic, главный форум. Обсуждение тем программирования на VB 1—6.
Даже если вы плохо разбираетесь в VB и программировании вообще — тут вам помогут. В разумных пределах, конечно.
Правила форума
Темы, в которых будет сначала написано «что нужно сделать», а затем просьба «помогите», будут закрыты.
Читайте требования к создаваемым темам.
Boris_BGB
Флудер-Энтузиаст
Флудер-Энтузиаст
 
Сообщения: 661
Зарегистрирован: 11.12.2002 (Ср) 11:41

CoGetInstanceFromFile()

Сообщение Boris_BGB » 29.09.2003 (Пн) 11:35

CoGetInstanceFromFile()
Расскажите плиз об этой АПИ функции.

Boris_BGB
Флудер-Энтузиаст
Флудер-Энтузиаст
 
Сообщения: 661
Зарегистрирован: 11.12.2002 (Ср) 11:41

Сообщение Boris_BGB » 30.09.2003 (Вт) 12:53

Не верю, что никто о ней ничего не знает!

Vi
Постоялец
Постоялец
 
Сообщения: 739
Зарегистрирован: 25.01.2002 (Пт) 11:03
Откуда: Россия, Ижевск

Сообщение Vi » 30.09.2003 (Вт) 14:04

Эта функция не для VB. Проще пользоваться GetObject("имя файла") с тем же результатом.
Vita
Выше головы не прыгнешь, ниже земли не упадешь, дальше границы не убежишь! (с) КВН

Boris_BGB
Флудер-Энтузиаст
Флудер-Энтузиаст
 
Сообщения: 661
Зарегистрирован: 11.12.2002 (Ср) 11:41

Сообщение Boris_BGB » 30.09.2003 (Вт) 18:35

Ну и чего она делает?

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

Сообщение A.A.Z. » 30.09.2003 (Вт) 23:14

API-Guide писал(а):The GetObject function obtains information about a specified graphics object.

Declaration:
Код: Выделить всё
Declare Function GetObject Lib "gdi32" Alias "GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, lpObject As Any) As Long


Parameters:
· hgdiobj
A handle to the graphics object of interest. This can be a handle to one of the following: a logical bitmap, a brush, a font, a palette, a pen, or a device independent bitmap created by calling the CreateDIBSection function.

· cbBuffer
Specifies the number of bytes of information to be written to the buffer.

· lpvObject
Points to a buffer that is to receive the information about the specified graphics object.
The following table shows the type of information the buffer receives for each type of graphics object you can specify with hgdiobj:
HBITMAP
BITMAP
HBITMAP returned from a call to CreateDIBSection
DIBSECTION, if cbBuffer is set to sizeof(DIBSECTION), or BITMAP, if cbBuffer is set to sizeof(BITMAP)
HPALETTE
a WORD count of the number of entries in the logical palette
HPEN returned from a call to ExtCreatePen
EXTLOGPEN
HPEN
LOGPEN
HBRUSH
LOGBRUSH
HFONT
LOGFONT

If the lpvObject parameter is NULL, the function return value is the number of bytes required to store the information it writes to the buffer for the specified graphics object.

Return Values:
If the function succeeds, and lpvObject is a valid pointer, the return value is the number of bytes stored into the buffer.

If the function succeeds, and lpvObject is NULL, the return value is the number of bytes required to hold the information the function would store into the buffer.

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

Sample:
Код: Выделить всё
'Create a new project, add a command button and a picture box to the project, load a picture into the picture box.
'Paste this code into Form1
Private Type BITMAP
    bmType As Long
    bmWidth As Long
    bmHeight As Long
    bmWidthBytes As Long
    bmPlanes As Integer
    bmBitsPixel As Integer
    bmBits As Long
End Type
Private Declare Function GetObject Lib "gdi32" Alias "GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, lpObject As Any) As Long
Private Declare Function GetBitmapBits Lib "gdi32" (ByVal hBitmap As Long, ByVal dwCount As Long, lpBits As Any) As Long
Private Declare Function SetBitmapBits Lib "gdi32" (ByVal hBitmap As Long, ByVal dwCount As Long, lpBits As Any) As Long
Dim PicBits() As Byte, PicInfo As BITMAP
Dim Cnt As Long, BytesPerLine as Long
Private Sub Command1_Click()
    'KPD-Team 1999
    'URL: http://www.allapi.net/
    'E-Mail: KPDTeam@Allapi.net
    'Get information (such as height and width) about the picturebox
    GetObject Picture1.Image, Len(PicInfo), PicInfo
    'reallocate storage space
    BytesPerLine = (PicInfo.bmWidth * 3 + 3) And &HFFFFFFFC
    ReDim PicBits(1 To BytesPerLine * PicInfo.bmHeight * 3) As Byte
    'Copy the bitmapbits to the array
    GetBitmapBits Picture1.Image, UBound(PicBits), PicBits(1)
    'Invert the bits
    For Cnt = 1 To UBound(PicBits)
        PicBits(Cnt) = 255 - PicBits(Cnt)
    Next Cnt
    'Set the bits back to the picture
    SetBitmapBits Picture1.Image, UBound(PicBits), PicBits(1)
    'refresh
    Picture1.Refresh
End Sub

Нет меня больше

Boris_BGB
Флудер-Энтузиаст
Флудер-Энтузиаст
 
Сообщения: 661
Зарегистрирован: 11.12.2002 (Ср) 11:41

Сообщение Boris_BGB » 01.10.2003 (Ср) 7:45

Спасибо!

alibek
Большой Человек
Большой Человек
 
Сообщения: 14205
Зарегистрирован: 19.04.2002 (Пт) 11:40
Откуда: Russia

Сообщение alibek » 01.10.2003 (Ср) 9:47

Вы чего???
API CreateObject и VB CreateObject это абсолютно разные функции!
Lasciate ogni speranza, voi ch'entrate.

Boris_BGB
Флудер-Энтузиаст
Флудер-Энтузиаст
 
Сообщения: 661
Зарегистрирован: 11.12.2002 (Ср) 11:41

Сообщение Boris_BGB » 01.10.2003 (Ср) 14:54

Таак... подробнее!

Vi
Постоялец
Постоялец
 
Сообщения: 739
Зарегистрирован: 25.01.2002 (Пт) 11:03
Откуда: Россия, Ижевск

Сообщение Vi » 02.10.2003 (Чт) 15:56

Они слишком много знали....

Я имел в виду функцию VB GetObject([pathname] [, class])
Код: Выделить всё
Set someobj = GetObject("c:\tmp.doc")
Vita
Выше головы не прыгнешь, ниже земли не упадешь, дальше границы не убежишь! (с) КВН


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

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

Сейчас этот форум просматривают: AhrefsBot, Majestic-12 [Bot] и гости: 2

    TopList