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

Visual Basic

 
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 
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 
Ok, I did not have the correct declaration but then I put your code in and i still only get back 0 every time for the hwnd...

here it is...

Public Declare Auto Function GetForegroundWindow Lib "user32" () As IntPtr<br />
<br />
<br />
Dim foreWndHandle As IntPtr = GetForegroundWindow()<br />
Debug.Print(foreWndHandle)<br />
<br />


I just debug.print it for ease of seeing if a viable hwnd pointer is returned. I get only about 10% of the time whether its a long, a int32 or intptr...

If i set it to int64, then i get a return everytime but i also get overflow which is understandable... now if there is a way to convert the 64-bit integer to a 32-Bit maybe it will work... I dont know...

I dont know why, but it pretty much only happens when the form is minimize or not visible. If the form is visible and the code is put into a timer to get the window, it gets it no problem.

<br />
    Private Sub Timer1_Tick_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick<br />
        ListBox1.Items.Add(GetForegroundWindow)<br />
    End Sub<br />


I swap other windows to the foreground and their hwnds are captured with no probem, but when I minimize or make non visible, the function cannot retrieve the foreground window handle.

Brent


-- modified at 15:25 Saturday 3rd March, 2007
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 
GeneralRe: Urgent..SOS...SOS... Pin
TwoFaced3-Mar-07 8:25
TwoFaced3-Mar-07 8:25 
GeneralRe: Urgent..SOS...SOS... Pin
Dave Kreskowiak3-Mar-07 10:32
mveDave Kreskowiak3-Mar-07 10:32 

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.