Erro: o código desse projeto deve ser atualizado para o sistema 64 bits

arthur123

23-11-2018 11:53:11

Entro no meu pc em casa e roda perfeitamente porém vou abrir meu projeto e o seguinte código tem a mensagem de erro: "o código desse projeto deve ser atualizado para o sistema 64 bits"

Declare Function FindWindow32 Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As Any, ByVal lpWindowName As Any) As Integer
Declare Function GetWindowLong32 Lib "user32" Alias "GetWindowLongA" _
(ByVal hWnd As Integer, ByVal nIndex As Integer) As Long
Declare Function SetWindowLong32 Lib "user32" Alias "SetWindowLongA" _
(ByVal hWnd As Integer, ByVal nIndex As Integer, _
ByVal dwNewLong As Long) As Long

Queria ajeitar isso pra rodar em qualquer sistema, alguem me ajuda ?

Desde já, agradeço

Mikel Silveira Fraga

19-12-2018 04:08:11

Arthur, boa noite e seja bem vindo ao fórum.

Meu amigo, isso ai é fácil de alterar. Substitua essa parte do código que você enviou, por esse código abaixo:

Código: Selecionar todos

#If VBA7 Then         ' Avalia as versões do Office 2010+

Declare PtrSafe Function FindWindow32 Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As Any, ByVal lpWindowName As Any) As Integer
Declare PtrSafe Function GetWindowLong32 Lib "user32" Alias "GetWindowLongA" _
(ByVal hWnd As Integer, ByVal nIndex As Integer) As Long
Declare PtrSafe Function SetWindowLong32 Lib "user32" Alias "SetWindowLongA" _
(ByVal hWnd As Integer, ByVal nIndex As Integer, _
ByVal dwNewLong As Long) As Long

#ElseIf VBA6 Then     ' Avalia as versões do Office 2007-

Declare Function FindWindow32 Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As Any, ByVal lpWindowName As Any) As Integer
Declare Function GetWindowLong32 Lib "user32" Alias "GetWindowLongA" _
(ByVal hWnd As Integer, ByVal nIndex As Integer) As Long
Declare Function SetWindowLong32 Lib "user32" Alias "SetWindowLongA" _
(ByVal hWnd As Integer, ByVal nIndex As Integer, _
ByVal dwNewLong As Long) As Long

#End If
Quaisquer dúvidas ou dificuldades, estamos a disposição.

Forte abraço e boa noite.

rqps77

15-01-2019 12:59:18

Incluí o PtrSafe porém está dando tipo incompatível:

Public Function InputBoxDK(Prompt, Optional Title, Optional Default, Optional XPos, _
Optional YPos, Optional HelpFile, Optional Context) As String
Dim lngModHwnd As Long, lngThreadID As Long

Sabe o que é?

Mikel Silveira Fraga

17-01-2019 08:52:54

rqps77, bom dia.

Tem como colocar todo o código da declaração aqui, para que possamos dar uma olhada?

Fico no aguardo.

Abraços e excelente quinta.