A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Owner Draw Elements in Custom Forms



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old October 13th 06, 09:09 AM posted to microsoft.public.outlook.program_addins
frank vandalay
external usenet poster
 
Posts: 2
Default Owner Draw Elements in Custom Forms

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  
Old October 13th 06, 03:52 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Owner Draw Elements in Custom Forms

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
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


All times are GMT +1. The time now is 01:07 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.