Click here to Skip to main content
15,899,313 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Link progress bar to a timer Pin
harveyhanson3-Mar-07 7:12
harveyhanson3-Mar-07 7:12 
QuestionCall Keypress Pin
Anybloodyid3-Mar-07 5:14
Anybloodyid3-Mar-07 5:14 
AnswerRe: Call Keypress Pin
JUNEYT3-Mar-07 5:32
JUNEYT3-Mar-07 5:32 
AnswerRe: Call Keypress Pin
Dave Kreskowiak3-Mar-07 6:37
mveDave Kreskowiak3-Mar-07 6:37 
GeneralRe: Call Keypress Pin
Anybloodyid3-Mar-07 10:55
Anybloodyid3-Mar-07 10:55 
GeneralRe: Call Keypress Pin
Dave Kreskowiak3-Mar-07 13:14
mveDave Kreskowiak3-Mar-07 13:14 
GeneralRe: Call Keypress Pin
Anybloodyid3-Mar-07 22:08
Anybloodyid3-Mar-07 22:08 
QuestionVB.net and GetForegroundWindow Issues/Bug??? Pin
brentleim13-Mar-07 4:58
brentleim13-Mar-07 4:58 
Hi,

I am attempting to make and application that retrieves information about the active window in the system. I have always used the GetForegroundWindow function with no problems in both C++ and VB6.

However, when I attempt the call the function in VS2005, vb.net, I only return the window handle about a third of the time. The other two thirds it simply returns 0. The window type doesnt seem to matter since it has happened with many different windows.

This is my code for attempting to retrieve the hwnd...


Dim lhwnd As Long

Call ShowWindow(Me.Handle), SW_HIDE)
lhwnd = GetForegroundWindow
Me.Text = lhwnd
Call ShowWindow(Me.Handle, SW_SHOW)


I have tried it using command buttons, link labels and other control click events and it still doesnt seem to want to work.

I tried calling it as such also.

Dim lhwnd As Long

Call ShowWindow(Me.Handle), SW_HIDE)
Dim lhwnd as long = GetForegroundWindow
Me.Text = lhwnd
Call ShowWindow(Me.Handle, SW_SHOW)


and


Dim lhwnd As Int32

Call ShowWindow(Me.Handle), SW_HIDE)
lhwnd = GetForegroundWindow
Me.Text = lhwnd
Call ShowWindow(Me.Handle, SW_SHOW)


Although it doesnt show, i also even placed the application.doevent call inbetween each line but that did not help either...


any help can be appreciated...

Thank You,

Brent
AnswerRe: VB.net and GetForegroundWindow Issues/Bug??? Pin
Dave Kreskowiak3-Mar-07 6:25
mveDave Kreskowiak3-Mar-07 6:25 
GeneralRe: VB.net and GetForegroundWindow Issues/Bug??? [modified] Pin
brentleim13-Mar-07 8:20
brentleim13-Mar-07 8:20 
GeneralRe: VB.net and GetForegroundWindow Issues/Bug??? Pin
Dave Kreskowiak3-Mar-07 10:29
mveDave Kreskowiak3-Mar-07 10:29 
GeneralRe: VB.net and GetForegroundWindow Issues/Bug??? Pin
brentleim13-Mar-07 10:56
brentleim13-Mar-07 10:56 
GeneralRe: VB.net and GetForegroundWindow Issues/Bug??? Pin
brentleim13-Mar-07 12:43
brentleim13-Mar-07 12:43 
GeneralRe: VB.net and GetForegroundWindow Issues/Bug??? Pin
Dave Kreskowiak3-Mar-07 13:29
mveDave Kreskowiak3-Mar-07 13:29 
GeneralRe: VB.net and GetForegroundWindow Issues/Bug??? Pin
Dave Kreskowiak3-Mar-07 13:26
mveDave Kreskowiak3-Mar-07 13:26 
Question[Message Deleted] Pin
harveyhanson3-Mar-07 2:46
harveyhanson3-Mar-07 2:46 
AnswerRe: Easy one (I hope) Pin
JUNEYT3-Mar-07 2:53
JUNEYT3-Mar-07 2:53 
AnswerRe: Easy one (I hope) Pin
kubben3-Mar-07 4:30
kubben3-Mar-07 4:30 
Questionreading data from a barcode reader Pin
moseti3-Mar-07 2:29
moseti3-Mar-07 2:29 
AnswerRe: reading data from a barcode reader Pin
mr_lasseter3-Mar-07 4:05
mr_lasseter3-Mar-07 4:05 
AnswerRe: reading data from a barcode reader Pin
steve_rm3-Mar-07 6:09
steve_rm3-Mar-07 6:09 
QuestionImporting data from Foxpro to MS-Access Pin
hisuman1003-Mar-07 0:59
hisuman1003-Mar-07 0:59 
QuestionUrgent..SOS...SOS... Pin
NANCO3-Mar-07 0:57
NANCO3-Mar-07 0:57 
AnswerRe: Urgent..SOS...SOS... Pin
JUNEYT3-Mar-07 2:14
JUNEYT3-Mar-07 2:14 
AnswerRe: Urgent..SOS...SOS... Pin
Dave Kreskowiak3-Mar-07 6:15
mveDave Kreskowiak3-Mar-07 6:15 

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.