1

Konu: kontroller transperant olabiliyor mu?

aşağıdaki kod ile formun saydamlığını (transparancy) kontrol edebiliyoruz.

Sorum: saydam olmayan bir form üzerindeki bir kontrolü (örneğin Editbox) tek başına saydam yapabilirmiyiz?
Bir programda editbox altındaki bazı değerlerin görünmesini sağlamak istiyorum....

Visual Fox Pro
oForm = CREATEOBJECT("Tform")

oForm.Visible = .T.
READ EVENTS
 
DEFINE CLASS tform As Form
#DEFINE LWA_COLORKEY 1
#DEFINE LWA_ALPHA 2
#DEFINE GWL_EXSTYLE -20
#DEFINE WS_EX_LAYERED 0x80000
    Autocenter=.T.
    Caption="Transparent Form"
    ShowWindow=2
    TransparentModeSet=.F.
 
    ADD OBJECT cmdSet As CommandButton WITH;
    Left=10, Top=10, Height=27, Width=80, Caption="Set"
 
    ADD OBJECT cmdClear As CommandButton WITH;
    Left=100, Top=10, Height=27, Width=80, Caption="Clear"
 
    ADD OBJECT chRgb As CheckBox WITH;
    Left=10, Top=50, Autosize=.T., BackStyle=0,;
    Caption="ColorRef", Value=.F.
 
    ADD OBJECT lblRgb As Label WITH;
    Left=100, Top=50, Autosize=.T., Caption="Rgb:"
 
    ADD OBJECT txtRgb As TextBox WITH;
    Left=140, Top=48, Width=80, Height=24, Value=RGB(192,192,192)
 
    ADD OBJECT cmdRgb As CommandButton WITH;
    Left=220, Top=48, Width=24, Height=24, Caption="..."
 
    ADD OBJECT chAlpha As CheckBox WITH;
    Left=10, Top=80, Autosize=.T., BackStyle=0,;
    Caption="Alpha", Value=.T.
 
    ADD OBJECT lblAlpha As Label WITH;
    Left=100, Top=80, Autosize=.T., Caption="Value:"
 
    ADD OBJECT txtAlpha As Spinner WITH;
    Left=140, Top=78, Width=80, Height=24, Value=128,;
    SpinnerLowValue=0, SpinnerHighValue=255,;
    KeyboardLowValue=0, KeyboardHighValue=255
 
PROCEDURE Init
    DECLARE INTEGER GetWindowLong IN user32;
        INTEGER hWnd, INTEGER nIndex
 
    DECLARE INTEGER SetWindowLong IN user32;
        INTEGER hWnd, INTEGER nIndex, INTEGER dwNewLong
 
    DECLARE INTEGER SetLayeredWindowAttributes IN user32;
        INTEGER hwnd, INTEGER crKey,;
        SHORT bAlpha, INTEGER dwFlags
 
    THIS.txtRgb.Value = THIS.BackColor
 
PROCEDURE Destroy
    CLEAR EVENTS
 
PROCEDURE SetTransparentMode
    LOCAL nExStyle, nRgb, nAlpha, nFlags
    nExStyle = GetWindowLong(THIS.HWnd, GWL_EXSTYLE)
    nExStyle = BITOR(nExStyle, WS_EX_LAYERED)
    = SetWindowLong(THIS.HWnd, GWL_EXSTYLE, nExStyle)
 
    IF NOT THIS.chRgb.Value AND NOT THIS.chAlpha.Value
        THIS.chAlpha.Value=.T.
    ENDIF
 
    nRgb = IIF(THIS.chRgb.Value, THIS.txtRgb.Value, 0)
    nAlpha = IIF(THIS.chAlpha.Value, THIS.txtAlpha.Value, 0)
    nFlags = IIF(THIS.chRgb.Value, LWA_COLORKEY, 0) +;
        IIF(THIS.chAlpha.Value, LWA_ALPHA, 0)
 
    = SetLayeredWindowAttributes(THIS.HWnd, m.nRgb,;
        m.nAlpha, m.nFlags)
 
PROCEDURE ClearTransparentMode
    LOCAL nExStyle
    nExStyle = GetWindowLong(THIS.HWnd, GWL_EXSTYLE)
    nExStyle = BITXOR(nExStyle, WS_EX_LAYERED)
    = SetWindowLong(THIS.HWnd, GWL_EXSTYLE, nExStyle)
 
PROCEDURE cmdSet.Click
    ThisForm.SetTransparentMode
    ThisForm.TransparentModeSet=.T.
 
PROCEDURE cmdClear.Click
    ThisForm.ClearTransparentMode
    ThisForm.TransparentModeSet=.F.
 
PROCEDURE chRgb.Click
    IF ThisForm.TransparentModeSet
        ThisForm.SetTransparentMode
    ENDIF
 
PROCEDURE txtRgb.When
RETURN .F.
 
PROCEDURE cmdRgb.Click
    LOCAL nRgb
    nRgb = GETCOLOR()
    IF nRgb <> -1
        ThisForm.txtRgb.Value = nRgb
        IF ThisForm.TransparentModeSet AND ThisForm.chRgb.Value
            ThisForm.SetTransparentMode
        ENDIF
    ENDIF
 
PROCEDURE chAlpha.Click
    IF ThisForm.TransparentModeSet
        ThisForm.SetTransparentMode
    ENDIF
 
PROCEDURE txtAlpha.InteractiveChange
    IF ThisForm.TransparentModeSet AND ThisForm.chAlpha.Value
        ThisForm.SetTransparentMode
    ENDIF
 
ENDDEFINE
VFP9 SP2

2

Re: kontroller transperant olabiliyor mu?

Konuka,

İnternette vfp için gdiplusx örneklerine bak. Orada belki işine yarayan bir şeyler bulabilirsin.

3

Re: kontroller transperant olabiliyor mu?

twain driver ile bu işi yapabilirsin.
Ya da  wdm driver ı olan ürünlerle yapılabilir.

Resim için windows da  2 standart var.
1. twain
2. wdm

Bunları destekleyen her kamera ile bu iş olur.
Çok eskiden "video for windows"  diye bir standart vardı. (XP, windows 98 zamanlarında  )

Tabii bu standartları destekleyen yazılım yapman gerekir.
Piyasada fox  ile çalışan activex ' ler mevcut.

4

Re: kontroller transperant olabiliyor mu?

Google 'da
"wdm twain activex foxpro "
"wdm twain activex tool"

Diye arat çok ürün çıkıyor.

Ben leadtools  kullanıyorum. Ama bu pahalı.

5

Re: kontroller transperant olabiliyor mu?

Makinede twain li bir ürünün yüklü olup olmadığını
"C:\Windows\twain_32" veya "C:\Windows\twain" dizini altına bakarak da anlarsın.

Tabii kolayı yazılımla anlamak. Ama bu da sana fikir verir.

Galiba facebook, msn  twain desteği ile çalışıyor.

6

Re: kontroller transperant olabiliyor mu?

aydinufuk yazdı:

Konuka,

İnternette vfp için gdiplusx örneklerine bak. Orada belki işine yarayan bir şeyler bulabilirsin.

Onu araştırmıştım, gdiplusx kontrollerin arka planına fon koymak için oluyor.

Benim aradığım: Üstteki kontrol saydam olacak ki, alttaki bir şeyleri görebileyim.

Saydam yapmak istediğim kontrolü bir forma koyarsam oluyor da, tek başına kontrolü (editbox)  yapamadım ...

VFP9 SP2

7

Re: kontroller transperant olabiliyor mu?

cihan1963 yazdı:

Merhaba

vfp de Resim çekmek ve kaydetmek için tavsiye edebileceğiniz
fotoğraf makinası varmı

şimdiden teşekkürler

Logitech webcam ler ile isini rahatca gorebilirsin. Bende hazir ornek var. Pazartesi post edebilirim ancak.

Uğur
-------------------------------------------------------------------------------------------------------------
Hayat bir bisiklete binmek gibidir. Pedalı çevirmeye devam ettiğiniz sürece düşmezsiniz. Claude Peppeer
Kusuru söylenmeyen adam, ayıbını hüner sanır.  Türk Atasözü

8 Son düzenleyen, KONURALP (24.07.2015 20:54:59)

Re: kontroller transperant olabiliyor mu?

Benim de başımda vardı.

Outlook kullanmadan yapman gerekiyor..

Sitede çok örnek var mail göndermekle ilgili..

9 Son düzenleyen, KONURALP (24.07.2015 21:10:26)

Re: kontroller transperant olabiliyor mu?

Bende bir yerlerden buldum. Kendim yazmadım.
Sadece source 'ları anlayıp kendime göre düzenledim.
Bende eklenecek dosya yok.
Biraz araştırdım.. Galiba http://www.foxite.com/archives/email-au … 393382.htm adresinden araklamışım.
Sorunsuzdur. 


Alttaki gibi çağırırsan çalışır.


a_mail=    Mail( gonsunucu, gonportno, 2,gonauthentitruefalse, gonsslaktif, gonmailadres, gonsifre, gonmailadres, gonderilecekkisi, gonderilecekkonu, mailmesaj,"","")


mail.prg nin içeriği
Lparameters server_smtp, server_smtpport, server_sendusing, server_authenticate, server_sslaktif , server_username, server_password , m_from, m_to, m_subject, m_textbody,m_AddAttachment1,m_AddAttachment2

* Hotmail   ayarları
* Kullanıcı adı: Sizin adresiniz. Örneğin: yourname@hotmail.com
* Parola:Hotmail hesabınız için kullandığınız parola
* SMTP sunucusu: smtp.live.com (Port 25 or 587)
* Doğrulama (Authentication required): Evet
* TLS/SSL:  Evet

* gmail ayarı
* smtpserver="smtp.gmail.com",     smtpserverport=465,sendusing=2 ,smtpauthenticate=.t. ,smtpusessl=.t. ,sendusername ="a@gmail.com",sendpassword="11"

Try
    Local lcSchema, loConfig, loMsg, loError, lcErr
    lcErr = ""
    lcSchema = "http://schemas.microsoft.com/cdo/configuration/"
    loConfig = Createobject("CDO.Configuration")
    With loConfig.Fields
        .Item(lcSchema + "smtpserver")       = server_smtp && "smtp.gmail.com gibi "
        .Item(lcSchema + "smtpserverport")   = server_smtpport &&  465 olabilir
        .Item(lcSchema + "sendusing")        = server_sendusing
        .Item(lcSchema + "smtpauthenticate") = server_authenticate && .T.   && authenticate
        If server_sslaktif =1
            .Item(lcSchema + "smtpusessl") = .T.      && ssl
        Else
            .Item(lcSchema + "smtpusessl") = .F.      && ssl
        Endif
        .Item(lcSchema + "sendusername") = server_username &&
        .Item(lcSchema + "sendpassword") = server_password &&
        .Update
    Endwith
    loMsg = Createobject ("CDO.Message")
    With loMsg
        .Configuration = loConfig
        .From     = m_from
        .To       = m_to
        .Subject  = m_subject
        .TextBody = m_textbody
        If Len(Alltrim(m_AddAttachment1))<>0
            .AddAttachment(m_AddAttachment1)
        Endif
        If Len(Alltrim(m_AddAttachment2))<>0
            .AddAttachment(m_AddAttachment2)
        Endif
        .Send()
    Endwith
Catch To loError
    lcErr = [Error: ] + Str(loError.ErrorNo) + Chr(13) + ;
        [Line: ] + Str(loError.Lineno) + Chr(13) + ;
        [Message: ] + loError.Message
Finally
    Release loConfig, loMsg
    Store .Null. To loConfig, loMsg

Endtry

If Empty(lcErr)
    Return "gonderildi"
Else
    Return "gönderilemedi"
Endif

10 Son düzenleyen, KONURALP (24.07.2015 21:38:16)

Re: kontroller transperant olabiliyor mu?

http://www.contextmagic.com/express-clickyes/

Buna bir baksana. Bu yazılım otomatik yes (allow ) tuşuna basıyor.

11

Re: kontroller transperant olabiliyor mu?

smile
Ne  diyeyim sana bilmiyorum..

12

Re: kontroller transperant olabiliyor mu?

http://answers.microsoft.com/en-us/offi … e21?auth=1


Bilen birisi yazmış. Pek çözümü yok gibi duruyor.
En az 10 seneden beri bu özellik varmış.

13 Son düzenleyen, ugurlu2001 (27.07.2015 08:53:22)

Re: kontroller transperant olabiliyor mu?

Webcam den resim kaydı almak için örnek.

Visual Fox Pro
* http://www.ml-consult.co.uk/foxst-29.htm

* http://www.foxite.com/archives/avicap32-camera-0000241185.htm
 
*** Eztwain.PRG - Start
* XDefs translation of \EZTwain\VC\eztwain.h
*-----------------------------------------------------------------
* EZTWAIN.H - interface to Easy TWAIN library
* (DLL=eztw32.dll)
*
* 1.15     2006.05.09 Fix: If user closed the scan dialog during an Acquire,
*                     the last DIB handle, if any, was returned!
*                     Added VB\Eztwain.bas to package.
* 1.14     2004.08.06 Set XFERMECH=NATIVE as soon as DS is opened.
*                     trying to deal with scanners that default to memory xfer.
* 1.13     1999.09.08 Documented correct return codes of AcquireToFilename.
*                     - No code changes -
* 1.12     1998.09.14 Added Fix32ToFloat, allow MSG_OPENDS triplet.
*                     Added SetXferMech, XferMech.
* 1.11     1998.08.17 Added ToFix32, SetContrast, SetBrightness.
*                     Modified TWAIN_ToFix32 to round away-from-zero.
* 1.09beta 1998.07.27 Reverted from 1.08 to 1.06 and worked forward again.
* 1.06     1997.08.21 correction to message hook, fixed 32-bit exports
* 1.05     1996.11.06 32-bit conversion
* 1.04     1995.05.03 added: WriteNativeToFile, WriteNativeToFilename,
*                         FreeNative, SetHideUI, GetHideUI, SetCurrentUnits,
*                         GetCurrentUnits, SetCurrentResolution, SetBitDepth,
*                         SetCurrentPixelType, SetCapOneValue.
* 1.0a      1994.06.23 first alpha version
* 0.0      1994.05.11 created
*
* EZTWAIN 1.x is not a product, and is not the work of any company involved
* in promoting or using the TWAIN standard.  This code is sample code,
* provided without charge, and you use it entirely at your own risk.
* No rights or ownership is claimed by the author, or by any company
* or organization.  There are no restrictions on use or (re)distribution.
*
* Download from:    www.dosadi.com
*
* Support contact:  support@dosadi.com
*
 
 
 
 
 
*--------- Basic calls
 
DECLARE LONG TWAIN_AcquireNative IN eztw32.dll ;
   LONG hwndApp, ;
   LONG wPixTypes
* The minimal use of EZTWAIN.DLL is to just call this routine, with 0 for
* both params.  EZTWAIN creates a window if hwndApp is 0.
*
* Acquires a single image, from the currently selected Data Source, using
* Native-mode transfer. It waits until the source closes (if it's modal) or
* forces the source closed if not.  The return value is a handle to the
* acquired image.  Only one image can be acquired per call.
*
* Under Windows, the return value is a global memory handle - applying
* GlobalLock to it will return a (huge) pointer to the DIB, which
* starts with a BITMAPINFOHEADER.
* NOTE: You are responsible for disposing of the returned DIB - these things
* can eat up your Windows memory fast!  See TWAIN_FreeNative below.
*
* The image type can be restricted using the following masks.  A mask of 0
* means 'any pixel type is welcome'.
* Caution: You should not assume that the source will honor a pixel type
* restriction!  If you care, check the parameters of the DIB.
 
#DEFINE TWAIN_BW 1
#DEFINE TWAIN_GRAY 2
#DEFINE TWAIN_RGB 4
#DEFINE TWAIN_PALETTE 8
#DEFINE TWAIN_ANYTYPE 0
 
DECLARE TWAIN_FreeNative IN eztw32.dll ;
   LONG hdib
* Release the memory allocated to a native format image, as returned by
* TWAIN_AcquireNative. (If you are coding in C or C++, this is just a call
* to GlobalFree.)
* If you use TWAIN_AcquireNative and don't free the returned image handle,
* it stays around taking up Windows (virtual) memory until your application
* terminates.  Memory required per square inch:
*             1 bit B&W       8-bit grayscale     24-bit color
* 100 dpi      1.25KB              10KB               30KB
* 200 dpi        5KB               40KB              120KB
* 300 dpi      11.25KB             90KB              270KB
* 400 dpi       20KB              160KB              480KB
*
 
DECLARE LONG TWAIN_AcquireToClipboard IN eztw32.dll ;
   LONG hwndApp, ;
   LONG wPixTypes
* Like AcquireNative, but puts the resulting image, if any, into the system
* clipboard.  Under Windows, this will put a CF_DIB item in the clipboard
* if successful.  If this call fails, the clipboard is either empty or
* contains the old contents.
* A return value of 1 indicates success, 0 indicates failure.
*
* Useful for environments like Visual Basic where it is hard to make direct
* use of a DIB handle.  In fact, TWAIN_AcquireToClipboard uses
* TWAIN_AcquireNative for all the hard work.
 
DECLARE LONG TWAIN_AcquireToFilename IN eztw32.dll ;
   LONG hwndApp, ;
   STRING sFile
* Acquire an image and write it to a .BMP (Windows Bitmap) file.
* The file name and path in pszFile are used.  If pszFile is NULL or
* points to an empty string, the user is prompted with a Save File dialog.
* Return values:
* 0 success
* -1 Acquire failed OR user cancelled File Save dialog
* -2 file open error (invalid path or name, or access denied)
* -3 (weird) unable to lock DIB - probably an invalid handle.
* -4 writing BMP data failed, possibly output device is full
 
DECLARE LONG TWAIN_SelectImageSource IN eztw32.dll ;
   LONG hwnd
* This is the routine to call when the user chooses the "Select Source..."
* menu command from your application's File menu.  Your app has one of
* these, right?  The TWAIN spec calls for this feature to be available in
* your user interface, preferably as described.
* Note: If only one TWAIN device is installed on a system, it is selected
* automatically, so there is no need for the user to do Select Source.
* You should not require your users to do Select Source before Acquire.
*
* This function posts the Source Manager's Select Source dialog box.
* It returns after the user either OK's or CANCEL's that dialog.
* A return of 1 indicates OK, 0 indicates one of the following:
*   a) The user cancelled the dialog
*   b) The Source Manager found no data sources installed
*   c) There was a failure before the Select Source dialog could be posted
* -- details --
* Only sources that can return images (that are in the DG_IMAGE group) are
* displayed.  The current default source will be highlighted initially.
* In the standard implementation of "Select Source...", your application
* doesn't need to do anything except make this one call.
*
* If you want to be meticulous, disable your "Acquire" and "Select Source"
* menu items or buttons if TWAIN_IsAvailable() returns 0 - see below.
 
 
*--------- Basic TWAIN Inquiries
 
DECLARE LONG TWAIN_IsAvailable IN eztw32.dll
* Call this function any time to find out if TWAIN is installed on the
* system.  It takes a little time on the first call, after that it's fast,
* just testing a flag.  It returns 1 if the TWAIN Source Manager is
* installed & can be loaded, 0 otherwise.
 
 
DECLARE LONG TWAIN_EasyVersion IN eztw32.dll
* Returns the version number of EZTWAIN.DLL, multiplied by 100.
* So e.g. version 2.01 will return 201 from this call.
 
DECLARE LONG TWAIN_State IN eztw32.dll
* Returns the TWAIN Protocol State per the spec.
#DEFINE TWAIN_PRESESSION 1
#DEFINE TWAIN_SM_LOADED 2
#DEFINE TWAIN_SM_OPEN 3
#DEFINE TWAIN_SOURCE_OPEN 4
#DEFINE TWAIN_SOURCE_ENABLED 5
#DEFINE TWAIN_TRANSFER_READY 6
#DEFINE TWAIN_TRANSFERRING 7
 
*--------- DIB handling utilities ---------
 
DECLARE LONG TWAIN_DibDepth IN eztw32.dll ;
   LONG hdib
* Depth of DIB, in bits i.e. bits per pixel.
DECLARE LONG TWAIN_DibWidth IN eztw32.dll ;
   LONG hdib
* Width of DIB, in pixels (columns)
DECLARE LONG TWAIN_DibHeight IN eztw32.dll ;
   LONG hdib
* Height of DIB, in lines (rows)
DECLARE LONG TWAIN_DibNumColors IN eztw32.dll ;
   LONG hdib
* Number of colors in color table of DIB
 
DECLARE LONG TWAIN_RowSize IN eztw32.dll ;
   LONG hdib
 
DECLARE TWAIN_ReadRow IN eztw32.dll ;
   LONG hdib, ;
   LONG nRow, ;
   STRING @prow
* Read row n of the given DIB into buffer at prow.
* Caller is responsible for ensuring buffer is large enough.
* Row 0 is the *top* row of the image, as it would be displayed.
 
DECLARE LONG TWAIN_CreateDibPalette IN eztw32.dll ;
   LONG hdib
* Create and return a logical palette to be used for drawing the DIB.
* For 1, 4, and 8-bit DIBs the palette contains the DIB color table.
* For 24-bit DIBs, a default halftone palette is returned.
 
DECLARE TWAIN_DrawDibToDC IN eztw32.dll ;
   LONG hDC, ;
   LONG dx, ;
   LONG dy, ;
   LONG w, ;
   LONG h, ;
   LONG hdib, ;
   LONG sx, ;
   LONG sy
* Draws a DIB on a device context.
* You should call CreateDibPalette, select that palette
* into the DC, and do a RealizePalette(hDC) first.
 
*--------- BMP file utilities
 
DECLARE LONG TWAIN_WriteNativeToFilename IN eztw32.dll ;
   LONG hdib, ;
   STRING sFile
* Writes a DIB handle to a .BMP file
*
* hdib      = DIB handle, as returned by TWAIN_AcquireNative
* pszFile   = far pointer to NUL-terminated filename
* If pszFile is NULL or points to a null string, prompts the user
* for the filename with a standard file-save dialog.
*
* Return values:
*    0  success
*   -1  user cancelled File Save dialog
*   -2  file open error (invalid path or name, or access denied)
*   -3  (weird) unable to lock DIB - probably an invalid handle.
*   -4  writing BMP data failed, possibly output device is full
 
DECLARE LONG TWAIN_WriteNativeToFile IN eztw32.dll ;
   LONG hdib, ;
   LONG fh
* Writes a DIB to a file in .BMP format.
*
* hdib      = DIB handle, as returned by TWAIN_AcquireNative
* fh        = file handle, as returned by _open, _lopen or OpenFile
*
* Return value as for TWAIN_WriteNativeToFilename
 
DECLARE LONG TWAIN_LoadNativeFromFilename IN eztw32.dll ;
   STRING sFile
* Load a .BMP file and return a DIB handle (as from AcquireNative.)
* Accepts a filename (including path & extension).
* If pszFile is NULL or points to a null string, the user is prompted.
* Returns a DIB handle if successful, otherwise NULL.
 
DECLARE LONG TWAIN_LoadNativeFromFile IN eztw32.dll ;
   LONG fh
* Like LoadNativeFromFilename, but takes an already open file handle.
 
 
DECLARE TWAIN_SetHideUI IN eztw32.dll ;
   LONG fHide
DECLARE LONG TWAIN_GetHideUI IN eztw32.dll
* These functions control the 'hide source user interface' flag.
* This flag is cleared initially, but if you set it non-zero, then when
* a source is enabled it will be asked to hide its user interface.
* Note that this is only a request - some sources will ignore it!
* This affects AcquireNative, AcquireToClipboard, and EnableSource.
* If the user interface is hidden, you will probably want to set at least
* some of the basic acquisition parameters yourself - see
* SetCurrentUnits, SetBitDepth, SetCurrentPixelType and
* SetCurrentResolution below.
 
*--------- Application Registration
 
DECLARE TWAIN_RegisterApp IN eztw32.dll ;
   LONG nMajorNum, ;
   LONG nMinorNum, ;
   LONG nLanguage, ;
   LONG nCountry, ;
   STRING @lpszVersion, ;
   STRING @lpszMfg, ;
   STRING @lpszFamily, ;
   STRING @lpszProduct
*
* TWAIN_RegisterApp can be called *AS THE FIRST CALL*, to register the
* application. If this function is not called, the application is given a
* 'generic' registration by EZTWAIN.
* Registration only provides this information to the Source Manager and any
* sources you may open - it is used for debugging, and (frankly) by some
* sources to give special treatment to certain applications.
 
*--------- Error Analysis and Reporting ------------------------------------
 
DECLARE LONG TWAIN_GetResultCode IN eztw32.dll
* Return the result code (TWRC_xxx) from the last triplet sent to TWAIN
 
DECLARE LONG TWAIN_GetConditionCode IN eztw32.dll
* Return the condition code from the last triplet sent to TWAIN.
* (To be precise, from the last call to TWAIN_DS below)
* If a source is NOT open, return the condition code of the source manager.
 
DECLARE TWAIN_ErrorBox IN eztw32.dll ;
   STRING sMsg
* Post an error message dialog with an exclamation mark, OK button,
* and the title 'TWAIN Error'.
* pszMsg points to a null-terminated message string.
 
DECLARE TWAIN_ReportLastError IN eztw32.dll ;
   STRING sMsg
* Like TWAIN_ErrorBox, but if some details are available from
* TWAIN about the last failure, they are included in the message box.
 
 
*--------- TWAIN State Control ------------------------------------
 
DECLARE LONG TWAIN_LoadSourceManager IN eztw32.dll
* Finds and loads the Data Source Manager, TWAIN.DLL.
* If Source Manager is already loaded, does nothing and returns TRUE.
* This can fail if TWAIN.DLL is not installed (in the right place), or
* if the library cannot load for some reason (insufficient memory?) or
* if TWAIN.DLL has been corrupted.
 
DECLARE LONG TWAIN_OpenSourceManager IN eztw32.dll ;
   LONG hwnd
* Opens the Data Source Manager, if not already open.
* If the Source Manager is already open, does nothing and returns TRUE.
* This call will fail if the Source Manager is not loaded.
 
DECLARE LONG TWAIN_OpenDefaultSource IN eztw32.dll
* This opens the source selected in the Select Source dialog.
* If a source is already open, does nothing and returns TRUE.
* Fails if the source manager is not loaded and open.
 
DECLARE LONG TWAIN_EnableSource IN eztw32.dll ;
   LONG hwnd
* Enables the open Data Source. This posts the source's user interface
* and allows image acquisition to begin.  If the source is already enabled,
* this call does nothing and returns TRUE.
 
DECLARE LONG TWAIN_DisableSource IN eztw32.dll
* Disables the open Data Source, if any.
* This closes the source's user interface.
* If there is not an enabled source, does nothing and returns TRUE.
 
DECLARE LONG TWAIN_CloseSource IN eztw32.dll
* Closes the open Data Source, if any.
* If the source is enabled, disables it first.
* If there is not an open source, does nothing and returns TRUE.
 
DECLARE LONG TWAIN_CloseSourceManager IN eztw32.dll ;
   LONG hwnd
* Closes the Data Source Manager, if it is open.
* If a source is open, disables and closes it as needed.
* If the Source Manager is not open, does nothing and returns TRUE.
 
DECLARE LONG TWAIN_UnloadSourceManager IN eztw32.dll
* Unloads the Data Source Manager i.e. TWAIN.DLL - releasing
* any associated memory or resources.
* This call will fail if the Source Manager is open, otherwise
* it always succeeds and returns TRUE.
 
 
 
DECLARE LONG TWAIN_WaitForNativeXfer IN eztw32.dll ;
   LONG hwnd
 
DECLARE TWAIN_ModalEventLoop IN eztw32.dll
* Process messages until termination, source disable, or image transfer.
 
 
DECLARE LONG TWAIN_EndXfer IN eztw32.dll
 
DECLARE LONG TWAIN_AbortAllPendingXfers IN eztw32.dll
 
 
*--------- High-level Capability Negotiation Functions --------
 
DECLARE LONG TWAIN_NegotiateXferCount IN eztw32.dll ;
   LONG nXfers
* Negotiate with open Source the number of images application will accept.
* This is only allowed in State 4 (TWAIN_SOURCE_OPEN)
* nXfers = -1 means any number
 
DECLARE LONG TWAIN_NegotiatePixelTypes IN eztw32.dll ;
   LONG wPixTypes
* Negotiate with the source to restrict pixel types that can be acquired.
* This tries to restrict the source to a *set* of pixel types,
* See TWAIN_AcquireNative above for some mask constants.
* --> This is only allowed in State 4 (TWAIN_SOURCE_OPEN)
* A parameter of 0 (TWAIN_ANYTYPE) causes no negotiation & no restriction.
* You should not assume that the source will honor your restrictions, even
* if this call succeeds!
 
DECLARE LONG TWAIN_GetCurrentUnits IN eztw32.dll
* Ask the source what its current unit of measure is.
* If anything goes wrong, this function just returns TWUN_INCHES (0).
 
DECLARE LONG TWAIN_SetCurrentUnits IN eztw32.dll ;
   LONG nUnits
* Set the current unit of measure for the source.
* Unit of measure codes are in TWAIN.H, but TWUN_INCHES is 0.
 
DECLARE LONG TWAIN_GetBitDepth IN eztw32.dll
* Get the current bitdepth, which can depend on the current PixelType.
* Bit depth is per color channel e.g. 24-bit RGB has bit depth 8.
* If anything goes wrong, this function returns 0.
 
DECLARE LONG TWAIN_SetBitDepth IN eztw32.dll ;
   LONG nBits
* (Try to) set the current bitdepth (for the current pixel type).
 
DECLARE LONG TWAIN_GetPixelType IN eztw32.dll
* Ask the source for the current pixel type.
* If anything goes wrong (it shouldn't), this function returns 0 (TWPT_BW).
 
DECLARE LONG TWAIN_SetCurrentPixelType IN eztw32.dll ;
   LONG nPixType
* (Try to) set the current pixel type for acquisition.
* This is only allowed in State 4 (TWAIN_SOURCE_OPEN)
* The source may select this pixel type, but don't assume it will.
 
DECLARE DOUBLE TWAIN_GetCurrentResolution IN eztw32.dll
* Ask the source for the current (horizontal) resolution.
* Resolution is in dots per current unit! (See TWAIN_GetCurrentUnits above)
* If anything goes wrong (it shouldn't) this function returns 0.0
 
DECLARE DOUBLE TWAIN_GetYResolution IN eztw32.dll
* Returns the current vertical resolution, in dots per *current unit*.
* In the event of failure, returns 0.0.
 
DECLARE LONG TWAIN_SetCurrentResolution IN eztw32.dll ;
   DOUBLE dRes
* (Try to) set the current resolution for acquisition.
* Resolution is in dots per current unit! (See TWAIN_GetCurrentUnits above)
* This is only allowed in State 4 (TWAIN_SOURCE_OPEN)
* Note: The source may select this resolution, but don't assume it will.
 
DECLARE LONG TWAIN_SetContrast IN eztw32.dll ;
   DOUBLE dCon
* (Try to) set the current contrast for acquisition.
* The TWAIN standard says that the range for this cap is -1000 ... +1000
 
DECLARE LONG TWAIN_SetBrightness IN eztw32.dll ;
   DOUBLE dBri
* (Try to) set the current brightness for acquisition.
* The TWAIN standard says that the range for this cap is -1000 ... +1000
 
DECLARE LONG TWAIN_SetXferMech IN eztw32.dll ;
   LONG mech
DECLARE LONG TWAIN_XferMech IN eztw32.dll
* (Try to) set or get the transfer mode - one of the following:
#DEFINE XFERMECH_NATIVE 0
#DEFINE XFERMECH_FILE 1
#DEFINE XFERMECH_MEMORY 2
 
*--------- Low-level Capability Negotiation Functions --------
 
* Setting a capability is valid only in State 4 (TWAIN_SOURCE_OPEN)
* Getting a capability is valid in State 4 or any higher state.
 
DECLARE LONG TWAIN_SetCapOneValue IN eztw32.dll ;
   LONG Cap, ;
   LONG ItemType, ;
   LONG ItemVal
* Do a DAT_CAPABILITY/MSG_SET, on capability 'Cap' (e.g. ICAP_PIXELTYPE,
* CAP_AUTOFEED, etc.) using a TW_ONEVALUE container with the given item type
* and value.  The item value must fit into 32 bits.
* Returns TRUE (1) if successful, FALSE (0) otherwise.
 
DECLARE LONG TWAIN_GetCapCurrent IN eztw32.dll ;
   LONG Cap, ;
   LONG ItemType, ;
   STRING @pVal
* Do a DAT_CAPABILITY/MSG_GETCURRENT on capability 'Cap'.
* Copy the current value out of the returned container into *pVal.
* If the operation fails (the source refuses the request), or if the
* container is not a ONEVALUE or ENUMERATION, or if the item type of the
* returned container is incompatible with the expected TWTY_ type in nType,
* returns FALSE.  If this function returns FALSE, *pVal is not touched.
 
DECLARE LONG TWAIN_ToFix32 IN eztw32.dll ;
   DOUBLE d
* Convert a floating-point value to a 32-bit TW_FIX32 value that can be passed
* to e.g. TWAIN_SetCapOneValue
 
DECLARE DOUBLE TWAIN_Fix32ToFloat IN eztw32.dll ;
   LONG nfix
* Convert a TW_FIX32 value (as returned from some capability inquiries)
* to a double (floating point) value.
 
*--------- Lowest-level functions for TWAIN protocol --------
 
 
DECLARE LONG TWAIN_DS IN eztw32.dll ;
   LONG DG, ;
   LONG DAT, ;
   LONG MSG, ;
   STRING @pData
* Passes the triplet (DG, DAT, MSG, pData) to the open data source if any.
* Returns 1 (TRUE) if the result code is TWRC_SUCCESS, 0 (FALSE) otherwise.
* The last result code can be retrieved with TWAIN_GetResultCode(), and the corresponding
* condition code can be retrieved with TWAIN_GetConditionCode().
* If no source is open this call will fail, result code TWRC_FAILURE, condition code TWCC_NODS.
 
DECLARE LONG TWAIN_Mgr IN eztw32.dll ;
   LONG DG, ;
   LONG DAT, ;
   LONG MSG, ;
   STRING @pData
* Passes a triplet to the Data Source Manager (DSM).
* Returns 1 (TRUE) if the result code is TWRC_SUCCESS, 0 (FALSE) otherwise.
* The last result code can be retrieved with TWAIN_GetResultCode(), and the corresponding
* condition code can be retrieved with TWAIN_GetConditionCode().
* If the Source Manager is not open, this call will fail, and set the result code to TWRC_FAILURE,
* with a condition code of TWCC_SEQERROR (triplet out of sequence).
 
*** Eztwain.PRG - End
 
 
 
*** Sample.Prg - Start
Local oForm
oForm = Createobject("Tform")
oForm.Show(1)
* end of main
 
Define Class Tform As Form
    #Define WM_CAP_START  0x0400
    #Define WM_CAP_DRIVER_CONNECT    (WM_CAP_START+10)
    #Define WM_CAP_DRIVER_DISCONNECT (WM_CAP_START+11)
    #Define WM_CAP_DRIVER_GET_CAPS   (WM_CAP_START+14)
    #Define WM_CAP_SET_PREVIEW       (WM_CAP_START+50)
    #Define WM_CAP_SET_OVERLAY       (WM_CAP_START+51)
    #Define WM_CAP_SET_PREVIEWRATE   (WM_CAP_START+52)
    #Define WM_CAP_GET_STATUS        (WM_CAP_START+54)
    #Define WM_CAP_GRAB_FRAME        (WM_CAP_START+60)
 
    Width=1054   
    Height=798
    AutoCenter=.T.
    Caption="Using Video Capture"
    MinButton=.F.
    MaxButton=.F.
    hWindow=0
    hCapture=0
    capWidth=0
    capHeight=0
    capOverlay=0
 
    Add Object cmdGetFrame As CommandButton With Default=.T.,;
        Left=15, Top=5, Height=27, Width=90, Caption="Get Frame",;
        Enabled=.F.
 
    Add Object cmdPreview As CommandButton With Default=.T.,;
        Left=106, Top=5, Height=27, Width=100, Caption="Preview Video",;
        Enabled=.F.
 
    Add Object cmdClose As CommandButton With Cancel=.T.,;
        Left=207, Top=5, Height=27, Width=70, Caption="Close"
 
    Procedure Activate
        If This.hWindow = 0
            Declare Integer GetFocus In user32
            This.hWindow = GetFocus()
            This.CreateCaptureWindow
            This.DriverConnect
            This.cmdPreview.Click
        Endif
 
    Procedure Destroy
        This.ReleaseCaptureWindow
 
    Procedure cmdClose.Click
        Thisform.Release
 
 
 
    Procedure cmdGetFrame.Click
        Thisform.GetFrame
 
    Procedure cmdPreview.Click
        Thisform.StartPreview
 
    Procedure GetFrame
        This.msg(WM_CAP_GRAB_FRAME, 0,0)
        #Define WM_CAP_FILE_SAVEDIB (WM_CAP_START + 25)
 
        Local lcFile
        lcFile = "" && File name to create
        lcFile = "D:\Yedek\SampleX.BMP"
 
        This.msg(WM_CAP_GRAB_FRAME, 0,0)
        This.msg(WM_CAP_FILE_SAVEDIB, 0, lcFile,1)
 
    Procedure CreateCaptureWindow
        #Define WS_CHILD   0x40000000
        #Define WS_VISIBLE 0x10000000
 
 
        Declare Integer capCreateCaptureWindow In avicap32;
            STRING lpszWindowName, Long dwStyle,;
            INTEGER x, Integer Y,;
            INTEGER nWidth, Integer nHeight,;
            INTEGER hParent, Integer nID
 
        This.hCapture = capCreateCaptureWindow("",;
            WS_CHILD+WS_VISIBLE,;
            10,40,1024,768, This.hWindow, 1)
 
    Procedure DriverConnect
        This.msg(WM_CAP_DRIVER_CONNECT, 0,0)
        If This.IsCaptureConnected()
            This.GetCaptureDimensions
            Store .T. To This.cmdGetFrame.Enabled,;
                THIS.cmdPreview.Enabled
            This.Caption = This.Caption + ": connected, " +;
                LTRIM(Str(This.capWidth)) + "x" +;
                LTRIM(Str(This.capHeight))
        Else
            This.Caption = This.Caption + ": failed to connect"
        Endif
 
    Procedure DriverDisconnect
        This.msg(WM_CAP_DRIVER_DISCONNECT, 0,0)
 
    Procedure ReleaseCaptureWindow
        If This.hCapture <> 0
            This.DriverDisconnect
            Declare Integer DestroyWindow In user32 Integer HWnd
            = DestroyWindow(This.hCapture)
            This.hCapture = 0
        Endif
 
    Procedure msg(msg, wParam, Lparam, nMode)
        If This.hCapture = 0
            Return
        Endif
 
        If Vartype(nMode) <> "N" Or nMode=0
            Declare Integer SendMessage In user32;
                INTEGER HWnd, Integer Msg,;
                INTEGER wParam, Integer Lparam
            = SendMessage(This.hCapture, msg, wParam, Lparam)
        Else
            Declare Integer SendMessage In user32;
                INTEGER HWnd, Integer Msg,;
                INTEGER wParam, String @Lparam
            = SendMessage(This.hCapture, msg, wParam, @Lparam)
        Endif
 
    Function IsCaptureConnected
        * analyzing fCaptureInitialized member of the CAPDRIVERCAPS structure
        #Define CAPDRIVERCAPS_SIZE 44
        Local cBuffer, nResult
        cBuffer = Repli(Chr(0),CAPDRIVERCAPS_SIZE)
        This.msg(WM_CAP_DRIVER_GET_CAPS, Len(cBuffer), @cBuffer, 1)
        This.capOverlay = buf2dword(Substr(cBuffer,5,4))
        nResult = Asc(Substr(cBuffer, 21,1))
        Return (nResult<>0)
 
    Procedure GetCaptureDimensions
        * reading uiImageWidth and uiImageHeight members
        * of the CAPSTATUS structure
        * #Define CAPSTATUS_SIZE 76
        #Define CAPSTATUS_SIZE 76
        Local cBuffer
        cBuffer = Repli(Chr(0), CAPSTATUS_SIZE)
        This.msg(WM_CAP_GET_STATUS, Len(cBuffer), @cBuffer, 1)
        This.capWidth = buf2dword(Substr(cBuffer,1,4))  && 1,4
        This.capHeight = buf2dword(Substr(cBuffer,5,4))  && 5,4
 
    Procedure StartPreview
        This.msg(WM_CAP_SET_PREVIEWRATE, 30,0)
        This.msg(WM_CAP_SET_PREVIEW, 1,0)
        If This.capOverlay <> 0
            This.msg(WM_CAP_SET_OVERLAY, 1,0)
        Endif
 
    Procedure StopPreview
        This.msg(WM_CAP_SET_PREVIEW, 0,0)
Enddefine
 
Function buf2dword(lcBuffer)
    Return Asc(Substr(lcBuffer, 1,1)) + ;
        BitLShift(Asc(Substr(lcBuffer, 2,1)),  8) +;
        BitLShift(Asc(Substr(lcBuffer, 3,1)), 16) +;
        BitLShift(Asc(Substr(lcBuffer, 4,1)), 24)
 
*** Sample.Prg - End
İleti eklentileri

webcam_capture_image.zip 51.45 kb, 3 kez indirildi, 2015-07-27 tarihinden itibaren 

Bu iletideki eklenti/leri indirmeye yetkiniz yok.
Uğur
-------------------------------------------------------------------------------------------------------------
Hayat bir bisiklete binmek gibidir. Pedalı çevirmeye devam ettiğiniz sürece düşmezsiniz. Claude Peppeer
Kusuru söylenmeyen adam, ayıbını hüner sanır.  Türk Atasözü

14

Re: kontroller transperant olabiliyor mu?

Rica ederim, işini görür umarım. Kodu çalıştırabildin mi?

Uğur
-------------------------------------------------------------------------------------------------------------
Hayat bir bisiklete binmek gibidir. Pedalı çevirmeye devam ettiğiniz sürece düşmezsiniz. Claude Peppeer
Kusuru söylenmeyen adam, ayıbını hüner sanır.  Türk Atasözü

15

Re: kontroller transperant olabiliyor mu?

Koda baktığımda twain uyumlu donanım için yapılmış gibi duruyor
Twain driver ı olan kameralar kullanman lazım.

16 Son düzenleyen, smentes (28.07.2015 17:01:05)

Re: kontroller transperant olabiliyor mu?

Ben Şunu Kullanıyorum. Eğer kontrollerin hWnd özelliği varsa olur.  Spinner1 in InteractiveChange'sine Yazdım

Visual Fox Pro
Declare Integer ShellExecute In SHELL32.Dll Integer nWinHandle,String cOperation, ;

        String cFileName,String cParameters,String cDirectory,Integer nShowWindow
Declare SetWindowLong In Win32Api As _Sol_SetWindowLong Integer, Integer, Integer
Declare SetLayeredWindowAttributes In Win32Api As _Sol_SetLayeredWindowAttributes Integer, String, Integer, Integer

Visual Fox Pro
this.Value=this.Value

 
*Transparan
_Sol_SetWindowLong(Thisform.hWnd, -20, 0x00080000)
_transp = Int(sabitler.seffaf_orn) && 100-255 Aralığında
_Sol_SetLayeredWindowAttributes(Thisform.hWnd, 0, _transp, 2)
 
thisform.Refresh

17

Re: kontroller transperant olabiliyor mu?

Ne zaman yazdığımı hatırlamıyorum ama bende de aşağıdaki kodlar var.

Visual Fox Pro
PARAMETERS FOTOKUTUK

*LcOldPhoto=Thisform.pf.pgkart.txtfoto.Value
 
*TRY
Declare Integer TWAIN_SelectImageSource In Eztw32.Dll Integer HWnd
Declare Integer TWAIN_AcquireNative In Eztw32.Dll Integer nAppWind, Integer nPixelTypes
Declare Integer TWAIN_WriteNativeToFilename In Eztw32.Dll Integer nDIB, String cFilename
Declare Integer TWAIN_FreeNative In Eztw32.Dll Integer nDIB
 
Local lnImageHandle, lnReply,lcSource
 
* Kamera Veya Tarayıcıyı Seçmek
*Surucu=TWAIN_SelectImageSource (Thisform.HWnd)
 
* Get the image
lnImageHandle = TWAIN_AcquireNative(0,0)
 
* Write the image to a disk file
lnReply = TWAIN_WriteNativeToFilename(lnImageHandle,FOTOKUTUK)
 
* Release the image handle
TWAIN_FreeNative(lnImageHandle)
 
* Check for errors
If lnReply = 0
* Resim Kaydedildi
    Messagebox("Foto Kaydedildi..." + FOTOKUTUK,64,'Fotoğraf Çekimi')
Else
* Resim Kaydedilmedi
    Messagebox("Foto Kaydedilmedi...",16,'Fotoğraf Çekimi')
ENDIF
*CATCH
*    WAIT "Fotoğraf Kayıt işleminde sorun oluştu" WINDOW NOWAIT
*ENDTRY
RETURN (.F.)

18

Re: kontroller transperant olabiliyor mu?

comez,

Eztw32.Dll pahalı bayağı

Çok da özelliği yok gibi duruyor.

19

Re: kontroller transperant olabiliyor mu?

Özelliğini bilmem ama yüklediğim kamera programından çıkmıştı, öylece kullandım diye hatırlıyorum.

KONURALP yazdı:

comez,

Eztw32.Dll pahalı bayağı

Çok da özelliği yok gibi duruyor.

20

Re: kontroller transperant olabiliyor mu?

cihan1963 yazdı:

Kamera konusunda son noktayı çetin hoça koyar diye bekliyorum

smile


Başlığı ben açtım, sorum (sorunum) form üstündeki kontrollerin bazılarının transperant olup olamadığı idi. (Formu transperant yapabiliyorum)

Cihan'ın konuların bütünlüğünü hep karıştırma özelliği sayesinde başlıkla ilgisiz bir soru ile konu kameraya döndü.
Politik biatçı bağnazlık monolog kaldırır ancak programcılıkla ilgili değişik sorular için değişik başlıklar açıp konu (sorun) bütünlüğünü korumak gerekir diye düşünüyorum.

VFP9 SP2