Visualizzazione dei risultati da 1 a 5 su 5
  1. #1

    [VB6]-Strano errore tra 2 funzioni. AIUTO!

    allora.. nel mio programma ho questa funzione
    codice:
    SetWindowPos hWnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED Or SWP_NOMOVE Or SWP_NOSIZE Or SWP_NOZORDER
    ke mi viene gestita da questo modulo
    codice:
    Option Explicit
    
    Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crey As Byte, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
    Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
    Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    Private Const GWL_STYLE = (-16)
    Private Const GWL_EXSTYLE = (-20)
    Private Const WS_CAPTION = &HC00000     'WS_BORDER Or WS_DLGFRAME
    Private Const WS_EX_APPWINDOW = &H40000
    Private Const WS_EX_TOOLWINDOW = &H80
    Private Const WS_EX_TRANSPARENT = &H20
    Private Const WS_SYSMENU = &H80000
    Private Const WS_MINIMIZEBOX = &H20000
    Private Const WS_MAXIMIZEBOX = &H10000
    Private Const WS_THICKFRAME = &H40000
    
    Private Const WS_EX_LAYERED = &H80000
    Private Const LWA_ALPHA = &H2&
    
    Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal CX As Long, ByVal CY As Long, ByVal wFlags As Long) As Long
    Private Const SWP_FRAMECHANGED = &H20
    Private Const SWP_NOMOVE = &H2
    Private Const SWP_NOSIZE = &H1
    Private Const SWP_NOZORDER = &H4
    
    Global Const WOT_SWP_NOMOVE = 2
    Global Const WOT_SWP_NOSIZE = 1
    Global Const WOT_FLAGS = WOT_SWP_NOMOVE Or WOT_SWP_NOSIZE
    Global Const WOT_HWND_TOPMOST = -1
    Global Const WOT_HWND_TOP = 0
    Global Const WOT_HWND_NOTOPMOST = -2
    
    'Per regolare la forma XXXX a TOPMOST, usi il seguente codice:
    'successo = SetWindowPos(XXXX.hWnd, wot_HWND_TOPMOST, 0, 0, 0, 0,
    ' _successo < > 0 di rem delle BANDIERINE)
    
    'per ripristinare la forma XXXX a NON-TOPMOST, usi il seguente codice:
    'successo = SetWindowPos(XXXX.hWnd, wot_HWND_NOTOPMOST, 0, 0, 0, 0,
    ' _successo < > 0 di rem delle BANDIERINE)
    
    'Mostro la finestra di windows
    Private Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
        'Selettori di ShowWindow
        Const SW_HIDE = 0
        Const SW_SHOW = 5
    
    Sub extwinONTOP(ewinFORM As Form, locONTOP As Integer)
    
        Dim succESS As Long, flags As Long
        Dim frmL As Long, frmT As Long, frmW As Long, frmH As Long
        
        frmL = ewinFORM.Left
        frmT = ewinFORM.Top
        frmW = ewinFORM.Width
        frmH = ewinFORM.Height
        
        If locONTOP <> 0 Then
            succESS = SetWindowPos(ewinFORM.hWnd, WOT_HWND_TOPMOST, frmL, frmT, 0, 0, WOT_FLAGS)
        Else
            succESS = SetWindowPos(ewinFORM.hWnd, WOT_HWND_NOTOPMOST, frmL, frmT, 0, 0, WOT_FLAGS)
        End If
    
        ewinFORM.Show
    
    End Sub
    
    
    Private Sub SetWindowStyle(ByVal hWnd As Long, ByVal extended_style As Boolean, ByVal style_value As Long, ByVal new_value As Boolean, ByVal brefresh As Boolean)
       
       Dim style_type As Long
       Dim style As Long
       
       If extended_style Then
          style_type = GWL_EXSTYLE
       Else
          style_type = GWL_STYLE
       End If
       
       'Stile corrente
       style = GetWindowLong(hWnd, style_type)
       
       'Aggiorno o rimnuovo i valori
       If new_value Then
          style = style Or style_value
       Else
          style = style And Not style_value
       End If
       
       'Nascondo la finestra se apro task-maneger
       If brefresh Then
          ShowWindow hWnd, SW_HIDE
       End If
       
       'Imposto lo stile
       SetWindowLong hWnd, style_type, style
       
       'Mostro la finestra se apro task-maneger
       If brefresh Then
          ShowWindow hWnd, SW_SHOW
       End If
       
       'Ridisegno la finestra
       SetWindowPos hWnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED Or _
                                         SWP_NOMOVE Or _
                                         SWP_NOSIZE Or _
                                         SWP_NOZORDER
    End Sub
    Quando ho inserito questo

    codice:
    Private Declare Function DrawText Lib "User32.dll" Alias "DrawTextA" (ByVal hdc As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long
    Private Declare Function GetTickCount Lib "Kernel32.dll" () As Long
    
    Public Type RECT
        Left As Long
        Top As Long
        Right As Long
        Bottom As Long
    End Type
    mi ha causato un errore, e mi segna errore su Form_Load dove ho la funzione SetWindows.... e mi segna in particolare questo pezzo di funzione: SWP_FRAMECHANGED

    Qualcuno sa spiegarmi dove e xke sbaglio?
    Grazie e scusate Moderatori per la lunghezza ma non sapevo come mettere il tutto
    #include <cervello.h>

  2. #2
    usando getlastdllerror che errore ti ritorna?
    Vascello fantasma dei mentecatti nonchè baronetto della scara corona alcolica, piccolo spuccello di pezza dislessico e ubriaco- Colui che ha modificato l'orribile scritta - Gran Evacuatore Mentecatto - Tristo Mietitore Mentecatto chi usa uTonter danneggia anche te

  3. #3
    cioè??? scusa ma nn sono molto esperto di vb, sto cercando di imparare...
    Cmq se io aggiugno quello che poi mi provoca l'errore, lui mi dice:

    ERRORE DI COMPILAZIONE
    Variabile non definita

    segnandomi SWP_FRAMECHANGED nella funzione SetWindowPos hWnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED Or _
    SWP_NOMOVE Or _
    SWP_NOSIZE Or _
    SWP_NOZORDER

    ma io dico, [a parte ke quello l'ho dichiarato nel modulo], ma xke mi crea conflitto
    codice:
    Private Declare Function DrawText Lib "User32.dll" Alias "DrawTextA" (ByVal hdc As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long
    Private Declare Function GetTickCount Lib "Kernel32.dll" () As Long
    Private Const DT_CALCRECT As Long = &H400
    Private Const DT_CENTER As Long = &H1
    Private Const DT_SINGLELINE As Long = &H20
    Private Const DT_WORDBREAK As Long = &H10
    
    Private Type RECT
        Left As Long
        Top As Long
        Right As Long
        Bottom As Long
    End Type
    con la funzione SetWindowsPos? Basta solo ke io aggiunga queste poche righe e lui "PAM!" subito errore.
    #include <cervello.h>

  4. #4
    Utente di HTML.it L'avatar di vonkranz
    Registrato dal
    Sep 2001
    Messaggi
    1,387
    Probabilmente e' un problema di visibilita' della costante SWP_FRAMECHANGED (e penso a questo punto anche di altre)

    Modifica tutti i Private Const in Pubblic Const e vedi che succede. (per quanto non e' la cosa piu' corretta da fare)
    ...and I miss you...like the deserts miss the rain...

  5. #5
    allora ho cambiato tutti i private ke avevo nel modulo in public const. Ora non mi da piu errore li, xo mi ha dato altri svariati errori in giro x il progetto, ke pero sono riuscito a sistemare. Cos com'è il programma lanciato sembra funzionare... Ora speriamo bene xke quella parte di codice ke mi procurava tutto quel casino mi serve x continuare il programma. Speriamo solo ke non dia altri errori tipo questo ke ankora non capisco il motivo x il quale me l'abbia dato. Cmq GRAZIE MILLE A TUTTI!!! Siete fenomenali!
    #include <cervello.h>

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.