Click here to Skip to main content
15,927,803 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralGood tool for developer! Pin
tianzj8-Sep-04 17:30
tianzj8-Sep-04 17:30 
GeneralAdvertisment... Pin
Dave Kreskowiak9-Sep-04 10:53
mveDave Kreskowiak9-Sep-04 10:53 
QuestionHow to find CRLF in RichTextBox Pin
bitpusher8-Sep-04 15:24
bitpusher8-Sep-04 15:24 
AnswerRe: How to find CRLF in RichTextBox Pin
Anonymous8-Sep-04 18:14
Anonymous8-Sep-04 18:14 
AnswerRe: How to find CRLF in RichTextBox Pin
pbpb10-Sep-04 3:23
pbpb10-Sep-04 3:23 
QuestionHow can I get the number of rows in the data grid Pin
Waleed Eissa8-Sep-04 11:58
Waleed Eissa8-Sep-04 11:58 
AnswerRe: How can I get the number of rows in the data grid Pin
Nick Seng8-Sep-04 15:28
Nick Seng8-Sep-04 15:28 
GeneralReference Outlook open email window in VB.NET Pin
Vyyk8-Sep-04 11:54
sussVyyk8-Sep-04 11:54 
Hi,

I am writing an application in VB.NET and want to set an object reference to reference an already open email. Basically I want a user to activate an open email messsage (Outlook being the email client) and then have my application set the object reference (an Outlook MailItem object) to that window which represents that email.

However, I have no idea how to do that. The fact that some of the Window management API functions do not seem to work in VB.NET does not help much. For instance, I tried the simple code below in Excel VBA and it worked fine, but when used in VB.NET it gives an overflow error.

Public Declare Function GetWindowTextLength Lib "user32.dll" Alias "GetWindowTextLengthA" (ByVal hWnd As Long) As Long
Public Declare Function GetForegroundWindow Lib "user32.dll" () As Long
Public Declare Function GetWindowText Lib "user32.dll" Alias "GetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String, ByVal nMaxCount As Long) As Long

Sub Test()

' Display the title bar text of the foreground window.
Dim hforewnd As Long ' receives handle of foreground window
Dim slength As Long ' length of foreground window's title bar text
Dim wintext As String ' buffer for foreground window's title bar text
Dim retval As Long ' return value

hforewnd = GetForegroundWindow() ' determine the foreground window
slength = GetWindowTextLength(hforewnd) + 1 ' length of its title bar text
wintext = Space(slength) ' make room in the buffer to receive the text
retval = GetWindowText(hforewnd, wintext, slength) ' get title bar text
wintext = Left(wintext, slength - 1) ' remove null character from end of string

End Sub

As I said, the above code works fine in VBA and VB 6 but not in .NET.

Any pointers on how to do this will be greatly appreciated.

Thanks
Vyyk
GeneralConfused about Libraries Pin
Aggie_Programmer8-Sep-04 11:30
Aggie_Programmer8-Sep-04 11:30 
GeneralRe: Confused about Libraries Pin
Dave Kreskowiak8-Sep-04 17:09
mveDave Kreskowiak8-Sep-04 17:09 
GeneralRe: Confused about Libraries Pin
Aggie_Programmer9-Sep-04 3:45
Aggie_Programmer9-Sep-04 3:45 
GeneralUser Control and Collection - Help! Pin
RoyRose788-Sep-04 8:37
RoyRose788-Sep-04 8:37 
GeneralRe: User Control and Collection - Help! Pin
Anonymous8-Sep-04 8:53
Anonymous8-Sep-04 8:53 
GeneralBootStrap Files Pin
marclenoir20058-Sep-04 7:18
marclenoir20058-Sep-04 7:18 
GeneralRe: BootStrap Files Pin
Anonymous8-Sep-04 7:32
Anonymous8-Sep-04 7:32 
GeneralTHANKS Pin
Anonymous10-Sep-04 4:44
Anonymous10-Sep-04 4:44 
GeneralWant to create a custom line control that handles events Pin
gamerPotatoe8-Sep-04 5:43
gamerPotatoe8-Sep-04 5:43 
GeneralUnable to debug Pin
njppp8-Sep-04 1:26
njppp8-Sep-04 1:26 
GeneralRe: Unable to debug Pin
Pradeep Shamarao8-Sep-04 2:00
Pradeep Shamarao8-Sep-04 2:00 
GeneralIndexers in Vb.Net Pin
Daminda8-Sep-04 0:22
Daminda8-Sep-04 0:22 
GeneralRe: Indexers in Vb.Net Pin
Dave Kreskowiak8-Sep-04 7:01
mveDave Kreskowiak8-Sep-04 7:01 
GeneralRe: Indexers in Vb.Net Pin
Nick Seng8-Sep-04 15:14
Nick Seng8-Sep-04 15:14 
QuestionHow to use indexes Pin
aynka20008-Sep-04 0:19
aynka20008-Sep-04 0:19 
AnswerRe: How to use indexes Pin
Dave Kreskowiak8-Sep-04 6:48
mveDave Kreskowiak8-Sep-04 6:48 
GeneralCommon Dialog Pin
qur7-Sep-04 23:27
qur7-Sep-04 23:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.