PtrSafe no longer supported in Outlook 2007 - re-editing macro

I'm currently considering using a macro for Outlook 2007 and read somewhere that PtrSafe is no longer supported.

Any idea what I can replace it with?

Private Declare PtrSafe Function FindWindowA Lib "user32" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Private Declare PtrSafe 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_NOSIZE = &H1
Private Const SWP_NOMOVE = &H2
Private Const FLAGS As Long = SWP_NOMOVE Or SWP_NOSIZE
Private Const HWND_TOPMOST = -1

Private Sub Application_Reminder(ByVal Item As Object)
Dim ReminderWindowHWnd As Variant
On Error Resume Next
ReminderWindowHWnd = FindWindowA(vbNullString, "1 Reminder")
SetWindowPos ReminderWindowHWnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS

End Sub

Answers


I don't know where you read that PtrSafe is no longer supported, but that is incorrect. But you should look at http://msdn.microsoft.com/en-us/library/ee691831%28v=office.14%29.aspx


I followed that link, suggested by Charles Williams, and created this code which solves the compilation error:

#If Win64 Then
    Private Declare PtrSafe Function FindWindowA Lib "user32" _
    (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

    Private Declare PtrSafe 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
#Else
    Private Declare Function FindWindowA Lib "user32" _
    (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

    Private 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
#End If

Need Your Help

shell scripting: rearrange columns

shell text edit

I have a text file (tab separated) which consist of 17 column. I would like to change this structure in this way. Conserve column from 1 to 6, until the end of the file of course, and append column...

Increment ID Number (JS)

javascript jquery counter drop-down-menu

I'm using jQuery Selectbox plugin which has this function: