Click here to Skip to main content
15,921,179 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: problem with assignment Pin
Christian Graus4-May-09 23:11
protectorChristian Graus4-May-09 23:11 
AnswerRe: problem with assignment Pin
Dinesh Vitharana4-May-09 23:19
Dinesh Vitharana4-May-09 23:19 
GeneralRe: problem with assignment Pin
Christian Graus5-May-09 12:17
protectorChristian Graus5-May-09 12:17 
GeneralRe: problem with assignment Pin
_Damian S_5-May-09 15:05
professional_Damian S_5-May-09 15:05 
QuestionAn existing connection was forcibly closed by the remote host? [modified] Pin
AliAmjad4-May-09 18:43
AliAmjad4-May-09 18:43 
AnswerRe: An existing connection was forcibly closed by the remote host? Pin
Dinesh Vitharana4-May-09 23:06
Dinesh Vitharana4-May-09 23:06 
AnswerRe: An existing connection was forcibly closed by the remote host? Pin
daveice19-Oct-09 2:28
daveice19-Oct-09 2:28 
QuestionVisual Basic 2008 Express: Sendkeys Pin
helen004-May-09 16:46
helen004-May-09 16:46 
Hi,

I've written the below code (using Visual Basic 2008 Express) to maximize a notepad window, close the notepad window and then restart the notepad window. During the debugging (F5), everything works fine.

Then i build the project. However, when i run the .exe file (in Release folder), the notepad window stops at ALT+TAB and did not maximize and close and then a new notepad application window is started. It is not working exactly the same as what i saw during debugging.

Can anyone pls advice me what went wrong? Thanks very much.


================================================================================================
Imports System.Runtime.InteropServices
Imports System.Threading

Module Module1

<DllImport("user32.dll")> Public Function _
FindWindow(ByVal strClassName As String, ByVal strWindowName As String) As Integer
End Function

<DllImport("User32.DLL")> Public Function _
SetForegroundWindow(ByVal Hwnd As Long) As Boolean
End Function

Sub Main()

Dim hwnd As Long
Dim ProcID As Integer

hwnd = FindWindow(vbNullString, "Untitled - Notepad")
If hwnd <> 0 Then
'MsgBox("The window handle is " & hwnd)
SetForegroundWindow(hwnd)

'Restore minimized Notepad window
Thread.Sleep(3000)
My.Computer.Keyboard.SendKeys("%( )X", True) 'ALT+SPACEBAR to restore minimize window

'Close Notepad
Thread.Sleep(3000)
My.Computer.Keyboard.SendKeys("%{F}X", True) 'ALT+F in Notepad

'Start Notepad after 10 seconds delay
Thread.Sleep(10000) 'Delay 10000 milliseconds
ProcID = Shell("NOTEPAD.EXE", AppWinStyle.NormalFocus) 'Start Notepad.exe
AppActivate(ProcID)

Else

GoTo Finish
'MsgBox("Notepad is not running")

End If

Finish:

End Sub

End Module

======================================================================================================
AnswerRe: Visual Basic 2008 Express: Sendkeys Pin
Dave Kreskowiak4-May-09 17:21
mveDave Kreskowiak4-May-09 17:21 
GeneralRe: Visual Basic 2008 Express: Sendkeys Pin
helen004-May-09 18:08
helen004-May-09 18:08 
GeneralRe: Visual Basic 2008 Express: Sendkeys Pin
Christian Graus4-May-09 19:51
protectorChristian Graus4-May-09 19:51 
GeneralRe: Visual Basic 2008 Express: Sendkeys Pin
Dave Kreskowiak5-May-09 3:24
mveDave Kreskowiak5-May-09 3:24 
QuestionConstructor problems - Receiving T, need to indirect to a Constructor that accepts List(Of T) Pin
Alaric_4-May-09 10:30
professionalAlaric_4-May-09 10:30 
AnswerRe: Constructor problems - Receiving T, need to indirect to a Constructor that accepts List(Of T) Pin
MidwestLimey4-May-09 10:39
professionalMidwestLimey4-May-09 10:39 
GeneralRe: Constructor problems - Receiving T, need to indirect to a Constructor that accepts List(Of T) Pin
Alaric_4-May-09 11:30
professionalAlaric_4-May-09 11:30 
AnswerRe: Constructor problems - Receiving T, need to indirect to a Constructor that accepts List(Of T) [modified] Pin
Alaric_4-May-09 10:52
professionalAlaric_4-May-09 10:52 
GeneralRe: Constructor problems - Receiving T, need to indirect to a Constructor that accepts List(Of T) Pin
Alaric_4-May-09 10:57
professionalAlaric_4-May-09 10:57 
Questionif statement.... Pin
Jamal Abdul Nasir4-May-09 9:55
Jamal Abdul Nasir4-May-09 9:55 
AnswerRe: if statement.... Pin
MidwestLimey4-May-09 10:05
professionalMidwestLimey4-May-09 10:05 
AnswerRe: if statement.... Pin
Dalek Dave4-May-09 10:25
professionalDalek Dave4-May-09 10:25 
GeneralRe: if statement.... Pin
Andy Missico4-May-09 14:57
Andy Missico4-May-09 14:57 
AnswerRe: if statement.... Pin
Tiyani Miyambo4-May-09 22:42
Tiyani Miyambo4-May-09 22:42 
GeneralRe: if statement.... Pin
Christian Graus4-May-09 22:46
protectorChristian Graus4-May-09 22:46 
GeneralRe: if statement.... Pin
Dave Kreskowiak5-May-09 3:20
mveDave Kreskowiak5-May-09 3:20 
Questionsourcecode download Pin
Vb200914-May-09 5:05
Vb200914-May-09 5:05 

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.