By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,289 Members | 1,337 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,289 IT Pros & Developers. It's quick & easy.

FindWIndow and trademark symbol

P: n/a
I have an Access application with the name: MyAppName®
It has the "®" symbol (ChrW$(&H00AE)) at the end of it.
If I remane the application without the "®" symbol, I can use
FindWindow to close the application, but with the "®" symbol it
doesn't. Unfortunaetley this app is already distributed as MyAppName®
and I cannot change it.
I have tried:
hwnd = FindWindow(vbNullString, "myAppName" & ChrW$(&H00AE))
But it won't work.
Yikes.
This has become an emergency.
Can anyone help?
lq

Nov 13 '05 #1
Share this Question
Share on Google+
17 Replies


P: n/a
lauren quantrell wrote:
I have an Access application with the name: MyAppName®
It has the "®" symbol (ChrW$(&H00AE)) at the end of it.
If I remane the application without the "®" symbol, I can use
FindWindow to close the application, but with the "®" symbol it
doesn't. Unfortunaetley this app is already distributed as MyAppName®
and I cannot change it.
I have tried:
hwnd = FindWindow(vbNullString, "myAppName" & ChrW$(&H00AE))
But it won't work.
Yikes.
This has become an emergency.
Can anyone help?
lq


Can you not use the classname of the window? i.e. the first parameter,
this is after all unique.

--
This sig left intentionally blank
Nov 13 '05 #2

P: n/a
Trevor,
The application I want to close in an Access application and the user
may have many different Access applications open. As I understand it,
that precludes the use of the classname of the window...
lq

Trevor Best wrote:
lauren quantrell wrote:
I have an Access application with the name: MyAppName®
It has the "®" symbol (ChrW$(&H00AE)) at the end of it.
If I remane the application without the "®" symbol, I can use
FindWindow to close the application, but with the "®" symbol it
doesn't. Unfortunaetley this app is already distributed as MyAppName® and I cannot change it.
I have tried:
hwnd = FindWindow(vbNullString, "myAppName" & ChrW$(&H00AE))
But it won't work.
Yikes.
This has become an emergency.
Can anyone help?
lq

Can you not use the classname of the window? i.e. the first

parameter, this is after all unique.

--
This sig left intentionally blank


Nov 13 '05 #3

P: n/a
lauren quantrell wrote:
I have an Access application with the name: MyAppName®
It has the "®" symbol (ChrW$(&H00AE)) at the end of it.
If I remane the application without the "®" symbol, I can use
FindWindow to close the application, but with the "®" symbol it
doesn't. Unfortunaetley this app is already distributed as MyAppName®
and I cannot change it.
I have tried:
hwnd = FindWindow(vbNullString, "myAppName" & ChrW$(&H00AE))
But it won't work.
Yikes.
This has become an emergency.
Can anyone help?
lq

I think "®" is ChrW$(&HAE)).

in any case

"myAppName" & ChrW$(&HAE)) finds a window for me.
(haven't tried to close it).

so does

"myAppName®"
--
--
Lyle
--
From ADO28.chm

Deprecated Components
Each of the following components is considered obsolete. While these
components are still supported in this release of the Microsoft® Data
Access Components (MDAC), they may be removed in the future. When
writing new applications, you should avoid using these deprecated
components. When modifying existing applications, you are strongly
encouraged to remove any dependency on these components.

ODBC Provider (MSDASQL)
You are strongly encouraged to use one of the native OLE DB Providers
instead of the Microsoft Open Database Connectivity (ODBC) Provider.
Native OLE DB Providers provide better application stability and
performance. Furthermore, native OLE DB Providers will be supported in
the future, whereas MSDASQL will not have any new features added to it,
will not be available on 64-bit, and will not be accessible from the OLE
DB NET Data Provider.

Remote Data Services (RDS)
Remote Data Services (RDS) is a proprietary Microsoft mechanism for
accessing remote data across the Internet or intranet. Microsoft is now
shipping the Microsoft Simple Object Access Protocol (SOAP) Toolkit 2.0
that enables you to access remote data using an open, XML-based
standard. Given the availability of the SOAP Toolkit 2.0, you should
migrate from RDS to SOAP. The SOAP 2.0 Toolkit 2.0 also includes sample
code for remotely accessing Microsoft ActiveX® Data Objects (ADO)
Recordsets.

Jet and Replication Objects (JRO)
The Microsoft Jet OLE DB Provider and other related components were
removed from MDAC 2.6. Microsoft has deprecated the Microsoft Jet
Engine, and plans no new releases or service packs for this component.
As a result, the Jet and Replication Objects (JRO) is being deprecated
in this release and will not be available in any future MDAC releases.

.....
Nov 13 '05 #4

P: n/a
lauren quantrell wrote:
Trevor,
The application I want to close in an Access application and the user
may have many different Access applications open. As I understand it,
that precludes the use of the classname of the window...
lq


When you say
Unfortunaetley this app is already distributed as


MyAppName®
and I cannot change it.


Do you mean the whole app or just the caption?

--
This sig left intentionally blank
Nov 13 '05 #5

P: n/a
Lyle,
(&H00AE) converts to (&HAE) when compiled.
I can find the window, and it gives me a hwnd number, but for some
reason it doesn't close it, but it will only close it if the
application has no "®". Very puzzling.
lq

Lyle Fairfield wrote:
lauren quantrell wrote:
I have an Access application with the name: MyAppName®
It has the "®" symbol (ChrW$(&H00AE)) at the end of it.
If I remane the application without the "®" symbol, I can use
FindWindow to close the application, but with the "®" symbol it
doesn't. Unfortunaetley this app is already distributed as MyAppName® and I cannot change it.
I have tried:
hwnd = FindWindow(vbNullString, "myAppName" & ChrW$(&H00AE))
But it won't work.
Yikes.
This has become an emergency.
Can anyone help?
lq
I think "®" is ChrW$(&HAE)).

in any case

"myAppName" & ChrW$(&HAE)) finds a window for me.
(haven't tried to close it).

so does

"myAppName®"
--
--
Lyle
--
From ADO28.chm

Deprecated Components
Each of the following components is considered obsolete. While these
components are still supported in this release of the Microsoft®

Data Access Components (MDAC), they may be removed in the future. When
writing new applications, you should avoid using these deprecated
components. When modifying existing applications, you are strongly
encouraged to remove any dependency on these components.

ODBC Provider (MSDASQL)
You are strongly encouraged to use one of the native OLE DB Providers instead of the Microsoft Open Database Connectivity (ODBC) Provider.
Native OLE DB Providers provide better application stability and
performance. Furthermore, native OLE DB Providers will be supported in the future, whereas MSDASQL will not have any new features added to it, will not be available on 64-bit, and will not be accessible from the OLE DB NET Data Provider.

Remote Data Services (RDS)
Remote Data Services (RDS) is a proprietary Microsoft mechanism for
accessing remote data across the Internet or intranet. Microsoft is now shipping the Microsoft Simple Object Access Protocol (SOAP) Toolkit 2.0 that enables you to access remote data using an open, XML-based
standard. Given the availability of the SOAP Toolkit 2.0, you should
migrate from RDS to SOAP. The SOAP 2.0 Toolkit 2.0 also includes sample code for remotely accessing Microsoft ActiveX® Data Objects (ADO)
Recordsets.

Jet and Replication Objects (JRO)
The Microsoft Jet OLE DB Provider and other related components were
removed from MDAC 2.6. Microsoft has deprecated the Microsoft Jet
Engine, and plans no new releases or service packs for this component. As a result, the Jet and Replication Objects (JRO) is being deprecated in this release and will not be available in any future MDAC releases.
....


Nov 13 '05 #6

P: n/a
Trevor,
The application is in the hands of a few hundred users globally and I
already have the caption with the "®" symbol.
lq

Nov 13 '05 #7

P: n/a
lauren quantrell wrote:
Trevor,
The application is in the hands of a few hundred users globally and I
already have the caption with the "®" symbol.


I was going to suggest some sort of workaround where you could open the
other Access mdb, pop in a value to a table that a timer event in the
other app would react to. If you can't change that app at all then
that's not an option :-(

--
This sig left intentionally blank
Nov 13 '05 #8

P: n/a
"lauren quantrell" <la*************@hotmail.com> wrote in
news:11**********************@z14g2000cwz.googlegr oups.com:
Lyle,
(&H00AE) converts to (&HAE) when compiled.
I can find the window, and it gives me a hwnd number, but for some
reason it doesn't close it, but it will only close it if the
application has no "®". Very puzzling.
lq


How do you try to close it?

I use:

Dim h As Long
h = FindWindow(vbNullString, "MyApplicationTitle" & ChrW$(&HAE))
PostMessage h, WM_CLOSE, 0, 0

with the requisite API declarations. Of course, one can use the IsWindow
and WaitForSingleObject functions to be sure or branch somewhere else if
unsuccessful.

--
Lyle
--
Nov 13 '05 #9

P: n/a
Lyle,
I use:
Dim hwnd as long
hwnd = FindWindow(vbnullstring,"AppName" & ChrW$(&HAE))
SetForegroundWindow hwnd
PostMessage hwnd, WM_CLOSE, 0&, 0&

lq

Lyle Fairfield wrote:
"lauren quantrell" <la*************@hotmail.com> wrote in
news:11**********************@z14g2000cwz.googlegr oups.com:
Lyle,
(&H00AE) converts to (&HAE) when compiled.
I can find the window, and it gives me a hwnd number, but for some
reason it doesn't close it, but it will only close it if the
application has no "®". Very puzzling.
lq
How do you try to close it?

I use:

Dim h As Long
h = FindWindow(vbNullString, "MyApplicationTitle" & ChrW$(&HAE))
PostMessage h, WM_CLOSE, 0, 0

with the requisite API declarations. Of course, one can use the

IsWindow and WaitForSingleObject functions to be sure or branch somewhere else if unsuccessful.

--
Lyle
--


Nov 13 '05 #10

P: n/a
"lauren quantrell" <la*************@hotmail.com> wrote in
news:11**********************@g14g2000cwa.googlegr oups.com:
Lyle,
I use:
Dim hwnd as long
hwnd = FindWindow(vbnullstring,"AppName" & ChrW$(&HAE))
SetForegroundWindow hwnd
PostMessage hwnd, WM_CLOSE, 0&, 0&

lq


Your code works for me.

--
Lyle
--
Nov 13 '05 #11

P: n/a
Lauren just to eliminate the obvious why don't you post your
declarations for the FindWindow and PostMessage API's.

Do you have Spy++ on your system so you can verify that the hWnd
returned via FindWindow is the correct window and that the Window name
ending character is correct?
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"lauren quantrell" <la*************@hotmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Lyle,
I use:
Dim hwnd as long
hwnd = FindWindow(vbnullstring,"AppName" & ChrW$(&HAE))
SetForegroundWindow hwnd
PostMessage hwnd, WM_CLOSE, 0&, 0&

lq

Lyle Fairfield wrote:
"lauren quantrell" <la*************@hotmail.com> wrote in
news:11**********************@z14g2000cwz.googlegr oups.com:
Lyle,
(&H00AE) converts to (&HAE) when compiled.
I can find the window, and it gives me a hwnd number, but for some
reason it doesn't close it, but it will only close it if the
application has no "®". Very puzzling.
lq
How do you try to close it?

I use:

Dim h As Long
h = FindWindow(vbNullString, "MyApplicationTitle" & ChrW$(&HAE))
PostMessage h, WM_CLOSE, 0, 0

with the requisite API declarations. Of course, one can use the

IsWindow and WaitForSingleObject functions to be sure or branch somewhere else if unsuccessful.

--
Lyle
--


Nov 13 '05 #12

P: n/a
Stephan,
Here's the full code.
Thanks,
lq

Const WM_CLOSE = &H10
Const SW_HIDE = 0

Private Declare Function FindWindow _
Lib "user32" _
Alias "FindWindowA" _
( _
ByVal lpClassName As String, _
ByVal lpWindowName As String _
) _
As Long

Private Declare Function SetForegroundWindow _
Lib "user32" _
( _
ByVal hwnd As Long _
) _
As Long

Private Declare Function PostMessage _
Lib "user32" _
Alias "PostMessageA" _
( _
ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long _
) _
As Long

Function CloseMyFrigginApp()
Dim hwnd As Long, AppCaption As String

AppCaption = "AppName" '& ChrW$(&HAE)
hwnd = FindWindow(vbNullString, AppCaption)
If hwnd <> 0 Then
SetForegroundWindow hwnd
PostMessage hwnd, WM_CLOSE, 0&, 0&
End If
End Function

Nov 13 '05 #13

P: n/a
"lauren quantrell" <la*************@hotmail.com> wrote in
news:11*********************@f14g2000cwb.googlegro ups.com:
AppCaption = "AppName" '& ChrW$(&HAE)


The single quote (comment indicator) is a typo ... or the problem?

--
Lyle
--
From ADO28.chm
Nov 13 '05 #14

P: n/a
Lauren your code works here.
I created an MDB with an Appname containing a trailing Trademark
symbol.
I created another MDB containing your code.

You do not need the call to the SetForegroundWindow API but it works
either way.

What versions of Access and windows are you running under?
Are you doing as I tested, closing one Access App from another?
Do you perchance have a an opened Form with the same name as the Access
Application?
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"lauren quantrell" <la*************@hotmail.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
Stephan,
Here's the full code.
Thanks,
lq

Const WM_CLOSE = &H10
Const SW_HIDE = 0

Private Declare Function FindWindow _
Lib "user32" _
Alias "FindWindowA" _
( _
ByVal lpClassName As String, _
ByVal lpWindowName As String _
) _
As Long

Private Declare Function SetForegroundWindow _
Lib "user32" _
( _
ByVal hwnd As Long _
) _
As Long

Private Declare Function PostMessage _
Lib "user32" _
Alias "PostMessageA" _
( _
ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long _
) _
As Long

Function CloseMyFrigginApp()
Dim hwnd As Long, AppCaption As String

AppCaption = "AppName" '& ChrW$(&HAE)
hwnd = FindWindow(vbNullString, AppCaption)
If hwnd <> 0 Then
SetForegroundWindow hwnd
PostMessage hwnd, WM_CLOSE, 0&, 0&
End If
End Function


Nov 13 '05 #15

P: n/a
Lyle,
Thanks for the reply. The single quote is just a typo.
lq
Lyle Fairfield wrote:
"lauren quantrell" <la*************@hotmail.com> wrote in
news:11*********************@f14g2000cwb.googlegro ups.com:
AppCaption = "AppName" '& ChrW$(&HAE)


The single quote (comment indicator) is a typo ... or the problem?

--
Lyle
--
From ADO28.chm


Nov 13 '05 #16

P: n/a
Stephen,
I am using a second MS Access app to close the first. Both apps running
Access 2K on Win XP Pro. I'll have to look at the form issue. It is
possible a popup form could have the same caption as the database with
the trailing ChrW$(&HAE) symbol...
again, the code works as long as there's no trailing ChrW$(&HAE) symbol
and most of the forms are popup forms.
lq

Nov 13 '05 #17

P: n/a
I've tested your scenario on WinXP Pro with A2K and A2003 and your code
works every time. THere's something else going on with your setup that I
am missing.
Can you send me your APP and the secondary MDB that closes the first
app? Just delete the contents of the tables if they contain data that is
sensitive.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"lauren quantrell" <la*************@hotmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Stephen,
I am using a second MS Access app to close the first. Both apps running Access 2K on Win XP Pro. I'll have to look at the form issue. It is
possible a popup form could have the same caption as the database with
the trailing ChrW$(&HAE) symbol...
again, the code works as long as there's no trailing ChrW$(&HAE) symbol and most of the forms are popup forms.
lq


Nov 13 '05 #18

This discussion thread is closed

Replies have been disabled for this discussion.