![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Hello,
im creating an COM Addin (OL 2000) with dynamic custom form in the appointment item. I need to draw some custom element on the UserForm using LineTo or DrawText. Does somebody know, if there are any possibilities to catch the handle (hdc) of the UserForm? Thanks for help! Frank |
Ads |
#2
|
|||
|
|||
![]()
The hDC isn't exposed for either Outlook forms or for VBA UserForms, if
that's what you mean by UserForm. You would have to find the window for the form using the Win32 API's and then from there get the hDC. It would be the same thing if you wanted to get the hWnd of the window. You can use FindWindow to get the hWnd of a window if you have the caption: Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName$, _ ByVal lpWindowName$) As Long FoundHwnd = FindWindow(vbNullString, strCaption) If you don't have the caption of the window and it's the foreground window you can get the caption this way: Public Declare Function GetForegroundWindow Lib "user32" () As Long Public Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" _ (ByVal hWnd As Long) As Long Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" ( _ ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long hWnd = GetForegroundWindow 'Get the windowtext length strText = Space$(GetWindowTextLength(hWnd) + 1) 'get the window text (caption) lngReturn = GetWindowText(hWnd, strText, Len(strText)) 'remove the last Chr$(0) Caption = StripNulls(strText) From the hWnd you can use this to get the hDC: Public Declare Function GetDC Lib "user32" (ByVal hWnd As Long) As Long hDC = GetDC(hWnd) -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "frank vandalay" wrote in message oups.com... Hello, im creating an COM Addin (OL 2000) with dynamic custom form in the appointment item. I need to draw some custom element on the UserForm using LineTo or DrawText. Does somebody know, if there are any possibilities to catch the handle (hdc) of the UserForm? Thanks for help! Frank |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Owner Draw Elements in Custom Forms | frank vandalay | Outlook - Using Forms | 0 | October 13th 06 09:48 AM |
Custom Forms | Bewildered | Outlook - Using Contacts | 2 | August 22nd 06 02:14 AM |
custom forms | steve | Outlook - Calandaring | 6 | August 8th 06 11:53 PM |
custom forms | Luigi | Outlook - Using Forms | 0 | May 30th 06 02:16 PM |
Custom forms | AT | Outlook - Using Forms | 1 | March 9th 06 07:03 PM |