Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do I convert this?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00484713
Message ID:
00484881
Vues:
21
Roi,
Thanks for the info. I think I need to update my include files. < s >

As Len posted, you need to specify the actual function name. SetWindowLong comes in two flavors: ANSI (A) and UNICODE (W). When you declare it in VFP, it automatically attempts to find the ANSI version so it appends an A to the function name when looking. VB doesn't do that.

Here is the declaration taken from the API Text Viewer that comes with Visual Studio.
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
   (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
HTH.

>Yep, I just tested it. I'm not that clear on what value means though. The code was posted by Koziol and Mike Stewart awhile ago to set the forms transparency level. The code below should set a forms to 50% transparent.
>
>I change the long to &H80000 and all the params to longs (as suggested by someone else in the thread) and now I don't get the overflow error.
>
>But, now I get "File not found: Win32api" ????? That's how it's declare in the VFP code (see below). I looked in MSDN and it says SetWindowLong is in User32, so I changed it and get the error "Can't find dll entry point SetWindowLong in User32". ????
>
>VFP Code:
>
** Class Init
>DECLARE SetWindowLong IN Win32Api INTEGER, INTEGER, INTEGER
>DECLARE SetLayeredWindowAttributes IN Win32Api INTEGER, STRING, INTEGER, INTEGER
>DECLARE GetWindowLong IN Win32Api INTEGER, INTEGER
>THIS.HWND = _WhTohWnd(_WFindTitl(THISFORM.CAPTION))
>
>** In a buttons click event.
>SetWindowLong(THIS.HWND, -20, 0x00080000)
>SetLayeredWindowAttributes(THIS.HWND, 0, 125, 2)
>
>
>VB Code:
>
Option Explicit
>Private Declare Function SetWindowLong Lib "Win32Api" (hwnd As Long, _
>    nIndex As Long, dwNewLong As Long)
>
>Private Declare Function SetLayeredWindowAttributes Lib "Win32Api" (ByVal hwnd As Integer, _
>    ByVal crKey As Integer, ByVal bAlpha As Integer, ByVal dwFlags As Integer)
>
>
>Private Sub Command1_Click()
>     SetWindowLong hwnd, -20, &H80000
>    SetLayeredWindowAttributes hwnd, 0, 100, 2
>
>End Sub
>
>
>
>
>Here is VFP code.
>
>>Roi,
>>Not to be picky, but are you sure this runs correctly in VFP? The -20 signifies you are trying to set an extended window style but I can't find that H80000 is a valid extended style. It looks like you are trying to set the window so it has a Control menu box in the titlebar. If so, two things:
>>1. Make sure the window has a titlebar.
>>2. Change the -20 to -16 to correspond to GWL_STYLE.
>>
>>HTH.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform