Click here to Skip to main content
16,005,149 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: user login form needed Pin
Jaymahinda9-Oct-05 1:32
Jaymahinda9-Oct-05 1:32 
GeneralRe: user login form needed Pin
Mohammad Daba'an9-Oct-05 2:17
Mohammad Daba'an9-Oct-05 2:17 
AnswerRe: user login form needed Pin
Christian Graus9-Oct-05 2:36
protectorChristian Graus9-Oct-05 2:36 
GeneralRe: user login form needed Pin
BigMek9-Oct-05 5:12
BigMek9-Oct-05 5:12 
GeneralRe: user login form needed Pin
Christian Graus9-Oct-05 16:03
protectorChristian Graus9-Oct-05 16:03 
AnswerRe: user login form needed Pin
Steve Pullan9-Oct-05 14:22
Steve Pullan9-Oct-05 14:22 
QuestionDynamic combo box Pin
hazelpz7-Oct-05 21:28
hazelpz7-Oct-05 21:28 
QuestionCode doessn't work Pin
dick roose7-Oct-05 19:08
dick roose7-Oct-05 19:08 
I copied the following code from this board and it doesn't work!
<
Module Module2
Delegate Function EnumWindows_Callback(ByVal hWnd As Integer, ByVal lParam As Integer) As Integer
Public Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As EnumWindows_Callback, ByVal lParam As Integer) As Integer
Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hWnd As Integer, ByVal lpString As String, ByVal cch As Integer) As Integer

'The callback routine.
Function EnumWindows_CBK(ByVal hWnd As Integer, ByVal lParam As Integer) As Integer
Dim buf As String
Dim i, length As Long

' Get the window's title.
length = GetWindowText(hWnd, buf, 255)
Title = Microsoft.VisualBasic.Left(buf, length)

' See if the title contains the target.
i = InStr(1, Title, "Table")
If i > 1 Then
' Save the hwnd and end the enumeration.
g_TableHwnd = hWnd
Return 0
Else
' Continue the enumeration.
Return 1
End If
End Function
End Module

Private Sub doScreen_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ptr As Integer
ptr = 0
' Examine the window names.
g_TableHwnd = 0
EnumWindows(AddressOf EnumWindows_CBK, ptr)
If g_TableHwnd = 0 Then
MsgBox("Error finding table.")
Exit Sub
End If
'Activate table.
ActivateTable()
GetTablePosition()
ThisValue = 0
potnum = 0
cardnum = 0
stacknum = 0
' Take back the focus.
Me.Activate()
End Sub


>
I only need the handle of the application with the word "table" in its caption so I removed a few things from the original code but not anything which should have effect the the ability of the code to loop through the active applications and return thier handles as emumWindows does in my vb6 code. This code is identical to my vb6 code except for the delegate and call back functions.

What happens id that "hWnd", which is passed to the <enumwindows_cbk> function is not "0" when it gets there from the form load sub. Instead it is some 6 digit number and on each iteration it becomes some other 5 or 6 digit number. It should start at 0 and work up one at a time.

I really need this function to work. My whole project is hung up on it.
Can anybody help?

Thanks
Dick Roose
AnswerRe: Code doessn't work Pin
Christian Graus9-Oct-05 2:56
protectorChristian Graus9-Oct-05 2:56 
QuestionCalculator Needed Pin
lcannon7-Oct-05 15:47
lcannon7-Oct-05 15:47 
AnswerRe: Calculator Needed Pin
Steve Pullan9-Oct-05 14:26
Steve Pullan9-Oct-05 14:26 
AnswerRe: Calculator Needed Pin
toxcct10-Oct-05 2:37
toxcct10-Oct-05 2:37 
Questioncounting occurences of a string in a datagrid/dataset Pin
jszpila7-Oct-05 11:24
jszpila7-Oct-05 11:24 
AnswerRe: counting occurences of a string in a datagrid/dataset Pin
Anonymous7-Oct-05 11:29
Anonymous7-Oct-05 11:29 
GeneralRe: counting occurences of a string in a datagrid/dataset Pin
jszpila7-Oct-05 11:41
jszpila7-Oct-05 11:41 
AnswerRe: counting occurences of a string in a datagrid/dataset Pin
Robert Rohde9-Oct-05 9:15
Robert Rohde9-Oct-05 9:15 
GeneralRe: counting occurences of a string in a datagrid/dataset Pin
jszpila10-Oct-05 6:06
jszpila10-Oct-05 6:06 
AnswerFixed Pin
jszpila10-Oct-05 6:25
jszpila10-Oct-05 6:25 
GeneralRe: Fixed Pin
Robert Rohde10-Oct-05 7:09
Robert Rohde10-Oct-05 7:09 
QuestionPopup Menu, Quick question Pin
No-e7-Oct-05 10:35
No-e7-Oct-05 10:35 
AnswerRe: Popup Menu, Quick question Pin
Richard_Wolf7-Oct-05 10:39
Richard_Wolf7-Oct-05 10:39 
GeneralRe: Popup Menu, Quick question Pin
No-e7-Oct-05 10:50
No-e7-Oct-05 10:50 
GeneralRe: Popup Menu, Quick question Pin
Richard_Wolf7-Oct-05 10:58
Richard_Wolf7-Oct-05 10:58 
AnswerRe: Popup Menu, Quick question Pin
Steve Pullan9-Oct-05 14:31
Steve Pullan9-Oct-05 14:31 
QuestionQuickie... Pin
No-e7-Oct-05 10:33
No-e7-Oct-05 10:33 

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.