473,322 Members | 1,408 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Window priority above other apps.

74
How do i get my access 2003 Windows to always appear above all other applications running?
Mar 15 '07 #1
12 2118
willakawill
1,646 1GB
How do i get my access 2003 Windows to always appear above all other applications running?
Hi. I have moved your thread to the access forum
Mar 15 '07 #2
Hutch
74
Do you have any idea on this subject?
Mar 15 '07 #3
ADezii
8,834 Expert 8TB
How do i get my access 2003 Windows to always appear above all other applications running?
I should have the answer for you shortly. It involves an API call and the Handle to the Main Access Window. Please be patient.
Mar 15 '07 #4
ADezii
8,834 Expert 8TB
How do i get my access 2003 Windows to always appear above all other applications running?
As previously promised, the following code will make the 'Main Access Window' always appear above all other running applications. First the API Declaration:
Expand|Select|Wrap|Line Numbers
  1. Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
NOTE: Use extreme caution whenever using API Calls and always backup your Database prior to experimenting. The slightest Syntax or other Error could cause a General Protection Fault. This code has been tested on Access 2003 and does, in fact, work:
Now the code:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Open(Cancel As Integer)
  2.   Dim wFlags As Long, lngX As Long
  3.  
  4.   wFlags = &H2 Or &H1 Or &H40 Or &H10
  5.   lngX = SetWindowPos(Application.hWndAccessApp, -1, 0, 0, 0, 0, wFlags)
  6. End Sub
Mar 15 '07 #5
Hutch
74
I get an error message after opening the form saying "Compile error: Expected variable or procedure, not module" it then opens VBA and highlites "SetWindowPos" in the private sub on the form. Any ideas?
Mar 16 '07 #6
Hutch
74
Take that back I got it to work, However the only draw back on this is when an error message appears behind the window you cant get to it.
Mar 16 '07 #7
ADezii
8,834 Expert 8TB
Take that back I got it to work, However the only draw back on this is when an error message appears behind the window you cant get to it.
That is a considerable Trade Off.
Mar 17 '07 #8
Hutch
74
That is a considerable Trade Off.
So check it out i am using this code in a command click button now. Sometimes i want it to remain above other apps other times i don't so far i have this

Private Sub Pri_Click_Click()
If Me.Pri_Click = True Then
Dim wFlags As Long, lngX As Long
wFlags = &H2 Or &H1 Or &H40 Or &H10
lngX = SetWindowPos(Application.hWndAccessApp, -1, 0, 0, 0, 0, wFlags)
If Me.Pri_Click = False Then GoTo Ext_Pri
End If
Ext_Pri:
End Sub

Do you happen to know the code to take the Window Priority away?
Any help would be amazing, thanks in advance.
Sep 12 '07 #9
ADezii
8,834 Expert 8TB
So check it out i am using this code in a command click button now. Sometimes i want it to remain above other apps other times i don't so far i have this

Private Sub Pri_Click_Click()
If Me.Pri_Click = True Then
Dim wFlags As Long, lngX As Long
wFlags = &H2 Or &H1 Or &H40 Or &H10
lngX = SetWindowPos(Application.hWndAccessApp, -1, 0, 0, 0, 0, wFlags)
If Me.Pri_Click = False Then GoTo Ext_Pri
End If
Ext_Pri:
End Sub

Do you happen to know the code to take the Window Priority away?
Any help would be amazing, thanks in advance.
Try the following code segment to turn OFF the TopMost Attribute:
Expand|Select|Wrap|Line Numbers
  1. Dim wFlags As Long, lngX As Long
  2. wFlags = &H10 Or &H40
  3. lngX = SetWindowPos(Application.hWndAccessApp, -2, 0, 0, 0, 0, wFlags)
Sep 12 '07 #10
Hutch
74
That code take the window minimizes it and move it into the tope left corner of my screen.
Sep 13 '07 #11
Hutch
74
Dim wFlags As Long, lngX As Long
wFlags = &H10 Or &H40
lngX = SetWindowPos(Application.hWndAccessApp, -2, 0, 0, 0, 0, wFlags)

I figured out that the H10 and H40 was the cause of the screen movement, I changed them to 2 and 1 like in the previouse code but kept the -2. this works great.
Sep 13 '07 #12
ADezii
8,834 Expert 8TB
Dim wFlags As Long, lngX As Long
wFlags = &H10 Or &H40
lngX = SetWindowPos(Application.hWndAccessApp, -2, 0, 0, 0, 0, wFlags)

I figured out that the H10 and H40 was the cause of the screen movement, I changed them to 2 and 1 like in the previouse code but kept the -2. this works great.
Glad you figured it out.
Sep 13 '07 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Wayne Wengert | last post by:
Using the Code Window in VS.NET if I put the mouse cursor over a method such as "Select" and right click I get a nice window defining that method. How do I close that window when I am done reading...
6
by: Der Andere | last post by:
Are priority queues implemented in the STL in Visual Studio 6? If no, which is the easiest way to simulate them? Multisets? BTW: The container contains pointers to instances of a class. The...
11
by: objectref | last post by:
Hi to all, is there a way to get the window handle of the main window of an application or process ? For example, if someone opens Microsoft Word, he gets a window so he/she can write text....
4
by: MrNobody | last post by:
I'd like windows spawned off my by main window to always stay above that main window, even when you give focus to it... how would I do this? The only property I find is one which makes that window...
4
by: elmo | last post by:
HI, This is realy a stupid problem but I cannot find a solution, please help. I have a asp.net page that displays after a user has logged on to the system. On this page is a couple of options and...
2
by: Dan | last post by:
Hello, I am just now converting from the world of DOS. Making simple VB.NET apps was easier than I expected. Now I need some control over the window that the app is running in. Can a VB.NET...
3
by: Dean Slindee | last post by:
I have a exception handling class that could be called from either a windows project app or a console project app. Is there any way for this class to determine which type of app called it without...
10
by: morangolds | last post by:
Hi, I've been having a problem with C++ Windows Forms apps not "ending" when you close the form window. I've searched about this problem all over the place and most searches have lead me to...
6
by: SAL | last post by:
Hi, VS2005 post I'm opening a window using the following syntax: Protected Sub lbEstValue_Click(ByVal sender As Object, ByVal e As System.EventArgs)...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.