473,409 Members | 2,004 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,409 software developers and data experts.

I want a msgbox to display BIG and LITTLE instead of YES and NO

MLH
Can I control what text appears on msgbox function buttons?
Sure do like NOT having to build a form to show a msg
and solicit a YES/NO response. MsgBox function is a great solution
for that.

Sure would like NOT to have to build a form to show a msg
and solicit a BIG/LITTLE or ON/OFF or RED/BLUE response.
Wish I could pop up a msgbox and assign the text i wanted onto
the button(s). Possible?
Nov 13 '05 #1
17 2600
MLH wrote:
Sure would like NOT to have to build a form to show a msg
and solicit a BIG/LITTLE or ON/OFF or RED/BLUE response.
Wish I could pop up a msgbox and assign the text i wanted onto
the button(s). Possible?


AFAIK, No.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Nov 13 '05 #2
MLH
Alrighty then. I'll stick with msgbox 's like this...
"Do you want the big one? Press Yes for the
big one and No for the small one."

That'll continue to do the job for me.

AFAIK, No.


Nov 13 '05 #3
Look at
http://vbnet.mvps.org/code/hooks/messageboxhook.htm

Terry Kreft
"MLH" <CR**@NorthState.net> wrote in message
news:kn********************************@4ax.com...
Can I control what text appears on msgbox function buttons?
Sure do like NOT having to build a form to show a msg
and solicit a YES/NO response. MsgBox function is a great solution
for that.

Sure would like NOT to have to build a form to show a msg
and solicit a BIG/LITTLE or ON/OFF or RED/BLUE response.
Wish I could pop up a msgbox and assign the text i wanted onto
the button(s). Possible?

Nov 13 '05 #4
MLH wrote:
Can I control what text appears on msgbox function buttons?
Sure do like NOT having to build a form to show a msg
and solicit a YES/NO response. MsgBox function is a great solution
for that.

Sure would like NOT to have to build a form to show a msg
and solicit a BIG/LITTLE or ON/OFF or RED/BLUE response.
Wish I could pop up a msgbox and assign the text i wanted onto
the button(s). Possible?


Visual Basic Graphics Programming:
Hands-on Applications and Advanced Color Development
Rod Stephens, 2nd Edition
Wiley Computer Publishing 1999
ISBN 0-471-35599-2

and

Win32 API Programming with Visual Basic
Steven Roman, First Edition
O'Reilly & Associates, Inc. 2000
ISBN: 1-56592-631-5

should contain enough information to allow a VBA programmer to change
the text of the command buttons on a MsgBox. I don't know if later
editions exist. I haven't tried this yet. It involves topics like
finding object handles, manipulating device contexts and subclassing.
Maybe I'll play around with it this weekend.

James A. Fortune

Nov 13 '05 #5
On Wed, 12 Oct 2005 22:50:15 +0100, "Terry Kreft"
<te*********@mps.co.uk> wrote:

Alternatively write your own MsgBox function, launching your own modal
form, passing in (OpenArgs) your button texts, etc.

-Tom.
Look at
http://vbnet.mvps.org/code/hooks/messageboxhook.htm

Terry Kreft
"MLH" <CR**@NorthState.net> wrote in message
news:kn********************************@4ax.com.. .
Can I control what text appears on msgbox function buttons?
Sure do like NOT having to build a form to show a msg
and solicit a YES/NO response. MsgBox function is a great solution
for that.

Sure would like NOT to have to build a form to show a msg
and solicit a BIG/LITTLE or ON/OFF or RED/BLUE response.
Wish I could pop up a msgbox and assign the text i wanted onto
the button(s). Possible?


Nov 13 '05 #6
Tom,
The OP said he didn't really want to do this.

Terry Kreft
"Tom van Stiphout" <no*************@cox.net> wrote in message
news:64********************************@4ax.com...
On Wed, 12 Oct 2005 22:50:15 +0100, "Terry Kreft"
<te*********@mps.co.uk> wrote:

Alternatively write your own MsgBox function, launching your own modal
form, passing in (OpenArgs) your button texts, etc.

-Tom.
Look at
http://vbnet.mvps.org/code/hooks/messageboxhook.htm

Terry Kreft
"MLH" <CR**@NorthState.net> wrote in message
news:kn********************************@4ax.com. ..
Can I control what text appears on msgbox function buttons?
Sure do like NOT having to build a form to show a msg
and solicit a YES/NO response. MsgBox function is a great solution
for that.

Sure would like NOT to have to build a form to show a msg
and solicit a BIG/LITTLE or ON/OFF or RED/BLUE response.
Wish I could pop up a msgbox and assign the text i wanted onto
the button(s). Possible?

Nov 13 '05 #7
Terry Kreft wrote:
Look at
http://vbnet.mvps.org/code/hooks/messageboxhook.htm


Hi Terry,

I seem to recall a few years ago on cdma a discussion on some issues
using windows hooks (if that's the correct term). Is Randy Birch's
method free of this issue, if there indeed was an issue I mentioned (I
could be imagining it, I'm not sure...)?
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Nov 13 '05 #8
MLH
Cool solution. However, I had a problem in the "With" Statement
of the following function. I'm sure its a typo - just dunno what to
substitute for AddressOfMsgBoxHookProc.

Public Function MessageBoxH(hwndThreadOwner As Long, hwndOwner As
Long) As Long

'Wrapper function for the MessageBox API

Dim hInstance As Long
Dim hThreadId As Long

'Set up the CBT (computer-based training) hook
hInstance = GetWindowLong(hwndThreadOwner, GWL_HINSTANCE)
hThreadId = GetCurrentThreadId()

'set up the MSGBOX_HOOK_PARAMS values
'By specifying a Windows hook as one
'of the params, we can intercept messages
'sent by Windows and thereby manipulate
'the dialog
With MSGHOOK
.hwndOwner = hwndOwner
.hHook = SetWindowsHookEx(WH_CBT, _
AddressOfMsgBoxHookProc, _
hInstance, hThreadId)
End With

'call the MessageBox API and return the
'value as the result of the function. The
'Space$(120) statements assures the messagebox
'is wide enough for the message that will
'be set in the hook.
'
'NOTE: I am setting the text in the hook only
'for demo purposes, to show how its done. You
'certainly can pass the title and prompt text
'right in the API call instead.
MessageBoxH = MessageBox(hwndOwner, _
Space$(120), _
Space$(120), _
MB_ABORTRETRYIGNORE Or MB_ICONINFORMATION)

End Function

Nov 13 '05 #9
You've got a space missing after AddressOf
AddressOfMsgBoxHookProc

should be
AddressOf MsgBoxHookProc
--
Terry Kreft

"MLH" <CR**@NorthState.net> wrote in message
news:jn********************************@4ax.com...
Cool solution. However, I had a problem in the "With" Statement
of the following function. I'm sure its a typo - just dunno what to
substitute for AddressOfMsgBoxHookProc.

Public Function MessageBoxH(hwndThreadOwner As Long, hwndOwner As
Long) As Long

'Wrapper function for the MessageBox API

Dim hInstance As Long
Dim hThreadId As Long

'Set up the CBT (computer-based training) hook
hInstance = GetWindowLong(hwndThreadOwner, GWL_HINSTANCE)
hThreadId = GetCurrentThreadId()

'set up the MSGBOX_HOOK_PARAMS values
'By specifying a Windows hook as one
'of the params, we can intercept messages
'sent by Windows and thereby manipulate
'the dialog
With MSGHOOK
.hwndOwner = hwndOwner
.hHook = SetWindowsHookEx(WH_CBT, _
AddressOfMsgBoxHookProc, _
hInstance, hThreadId)
End With

'call the MessageBox API and return the
'value as the result of the function. The
'Space$(120) statements assures the messagebox
'is wide enough for the message that will
'be set in the hook.
'
'NOTE: I am setting the text in the hook only
'for demo purposes, to show how its done. You
'certainly can pass the title and prompt text
'right in the API call instead.
MessageBoxH = MessageBox(hwndOwner, _
Space$(120), _
Space$(120), _
MB_ABORTRETRYIGNORE Or MB_ICONINFORMATION)

End Function

Nov 13 '05 #10
Yim,
I seem t remember the discussion but can't remember the details. I'm sure a
Google search would bring it up. IIRC it's to do with running hook
procedures with the VBA IDE open.

--
Terry Kreft

"Tim Marshall" <TI****@PurplePandaChasers.Moertherium> wrote in message
news:di**********@coranto.ucs.mun.ca...
Terry Kreft wrote:
Look at
http://vbnet.mvps.org/code/hooks/messageboxhook.htm


Hi Terry,

I seem to recall a few years ago on cdma a discussion on some issues using
windows hooks (if that's the correct term). Is Randy Birch's method free
of this issue, if there indeed was an issue I mentioned (I could be
imagining it, I'm not sure...)?
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me

Nov 13 '05 #11
It's a bug with three possible workarounds.

1) Place your subclassing code in an external DLL.

2) Distribute your code a MDE solution. This will guarantee the VB IDE is
never open during a session.

3) Distribute a MDB but guarantee 100% that the VB IDE window will never be
open during a session and no errors are unhandled.

Basically, if you can guarantee that the VB IDE will never be opened during
a session then bug will not appear.

I always prefer to distribute subclassing solutions within a standard
Windows DLL produced in C++. This method has worked 100% of the time.
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"Terry Kreft" <te*********@mps.co.uk> wrote in message
news:CF********************@karoo.co.uk...
Yim,
I seem t remember the discussion but can't remember the details. I'm sure
a Google search would bring it up. IIRC it's to do with running hook
procedures with the VBA IDE open.

--
Terry Kreft

"Tim Marshall" <TI****@PurplePandaChasers.Moertherium> wrote in message
news:di**********@coranto.ucs.mun.ca...
Terry Kreft wrote:
Look at
http://vbnet.mvps.org/code/hooks/messageboxhook.htm


Hi Terry,

I seem to recall a few years ago on cdma a discussion on some issues
using windows hooks (if that's the correct term). Is Randy Birch's
method free of this issue, if there indeed was an issue I mentioned (I
could be imagining it, I'm not sure...)?
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me


Nov 13 '05 #12
MLH
Darn it! Something else must be wrong then. My code text
turns RED when I put in the space. When I press F1 on
the AddressOf keyword, I get a msg telling me the HELP
file doesn't exist and I should contact my vendor for an
updated HELP file. Maybe I'm improperly configured to
utilize AddressOf - never have tried before.
xxxxxxxxxxxxxxxxxxxxxxxxxxxx

You've got a space missing after AddressOf
AddressOfMsgBoxHookProc

should be
AddressOf MsgBoxHookProc


Nov 13 '05 #13

You didn't miss anything. Access 97 doesn't have the AddressOf
function built in as the later versions do.

You can, however, simulate it with the AddrOf function:
<http://groups.google.com/group/es.comp.bd.ms-access/msg/795ffb7a56934ab4?hl=en&>

(Which won't work in Access 2000 or higher. Of course, there's little
need, since in those versions, AddressOf works!)
On Mon, 17 Oct 2005 14:14:22 -0400, MLH <CR**@NorthState.net> wrote:
Darn it! Something else must be wrong then. My code text
turns RED when I put in the space. When I press F1 on
the AddressOf keyword, I get a msg telling me the HELP
file doesn't exist and I should contact my vendor for an
updated HELP file. Maybe I'm improperly configured to
utilize AddressOf - never have tried before.
xxxxxxxxxxxxxxxxxxxxxxxxxxxx

You've got a space missing after AddressOf
AddressOfMsgBoxHookProc

should be
AddressOf MsgBoxHookProc

--
Drive C: Error. (A)bort (R)etry (S)mack The Darned Thing

Nov 13 '05 #14
MLH
Thanks, Chuck. Will grab that today and have a look at it.
xxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Mon, 17 Oct 2005 16:59:49 -0500, Chuck Grimsby
<c.*******@worldnet.att.net.invalid> wrote:

You didn't miss anything. Access 97 doesn't have the AddressOf
function built in as the later versions do.

You can, however, simulate it with the AddrOf function:
<http://groups.google.com/group/es.comp.bd.ms-access/msg/795ffb7a56934ab4?hl=en&>

(Which won't work in Access 2000 or higher. Of course, there's little
need, since in those versions, AddressOf works!)
On Mon, 17 Oct 2005 14:14:22 -0400, MLH <CR**@NorthState.net> wrote:
Darn it! Something else must be wrong then. My code text
turns RED when I put in the space. When I press F1 on
the AddressOf keyword, I get a msg telling me the HELP
file doesn't exist and I should contact my vendor for an
updated HELP file. Maybe I'm improperly configured to
utilize AddressOf - never have tried before.
xxxxxxxxxxxxxxxxxxxxxxxxxxxx

You've got a space missing after AddressOf
AddressOfMsgBoxHookProc

should be
AddressOf MsgBoxHookProc


Nov 13 '05 #15
MLH
Got it. Accepts a string, returns a long...
Public Function AddrOf(strFuncName As String) As Long

I still have a bit of a problem, though. Look at this snippet. I have
changed AddressOf to AddrOf, added AddrOf to my project and
tested this. Still failing at compile time. Could it be that AddrOf
expects a string and MsgBoxHookProc returns a Long? There problem
is there in the confines of the With statement at the end of the
snippet.

Public Function MessageBoxH(hwndThreadOwner As Long, hwndOwner As
Long) As Long

'Wrapper function for the MessageBox API

Dim hInstance As Long
Dim hThreadId As Long

'Set up the CBT (computer-based training) hook
hInstance = GetWindowLong(hwndThreadOwner, GWL_HINSTANCE)
hThreadId = GetCurrentThreadId()

'set up the MSGBOX_HOOK_PARAMS values
'By specifying a Windows hook as one
'of the params, we can intercept messages
'sent by Windows and thereby manipulate
'the dialog
With MSGHOOK
.hwndOwner = hwndOwner
.hHook = SetWindowsHookEx(WH_CBT, _
AddrOf MsgBoxHookProc, _
hInstance, hThreadId)
End With

You can, however, simulate it with the AddrOf function:
<http://groups.google.com/group/es.comp.bd.ms-access/msg/795ffb7a56934ab4?hl=en&>


Nov 13 '05 #16

Here's your problem:

.hHook = SetWindowsHookEx(WH_CBT, _
AddrOf MsgBoxHookProc, _
hInstance, hThreadId)
Should be:

.hHook = SetWindowsHookEx(WH_CBT, _
AddrOf("MsgBoxHookProc"), _
hInstance, hThreadId)

As you mentioned, it "Accepts a string". AddrOf needs to know the
_name_ of the function, so you need to pass it the name, and thus it
needs to be in quotes.

Oh, I suppose you could always do something like:

Const strWhatFunctionToAddressOf As String = "MsgBoxHookProc"
.hHook = SetWindowsHookEx(WH_CBT, _
AddrOf(strWhatFunctionToAddressOf), _
hInstance, hThreadId)

but that seems a bit silly! <Grin>
By the way, you might want to go to
<http://www.mentalis.org/index2.shtml> and download their API viewer.
It's a bit dated (Last update in 2002), but it's still a valuable
resource for doing API work.
On Tue, 18 Oct 2005 11:11:34 -0400, MLH <CR**@NorthState.net> wrote:
Got it. Accepts a string, returns a long...
Public Function AddrOf(strFuncName As String) As Long I still have a bit of a problem, though. Look at this snippet. I have
changed AddressOf to AddrOf, added AddrOf to my project and
tested this. Still failing at compile time. Could it be that AddrOf
expects a string and MsgBoxHookProc returns a Long?

--
Drive C: Error. (A)bort (R)etry (S)mack The Darned Thing

Nov 13 '05 #17
MLH
A gentleman and a scholar. Thx very much, Chuck.
Nov 13 '05 #18

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Frances Del Rio | last post by:
I have a bunch of Photoshop images on my server, I want when user clicks on a link to a Photoshop img for it to start downloading (like when you click on a Word file..) how can I do that? thank...
3
by: Simone | last post by:
Hello!!! Here is the thing. I have had this problem and I want to address it now where in the next and previous button DoCmd.GoToRecord , , acNext - DoCmd.GoToRecord , , acPrevious I wish the...
14
by: Ant | last post by:
Hello, I'm a newbie to C#. Does it have a Msgbox function like VB6 i.e. MsgBox "Hello World". What is the equivelant function? Does it have one? Thanks for your time on this simple question
3
by: Phoebe. | last post by:
Hi, Good Day! I need to display a msgbox asking user whether to delete a record or not using javascript. It works fine. Later on user request to add in more info in that msgbox, displaying...
6
by: rroman | last post by:
I've tried the good old fashioned msgBox but I get: It is invalid to show a modal dialog or form when the application is not running in UserInteractive mode. Specify the ServiceNotification or...
10
by: z | last post by:
I just installed Visual Studio .Net with Framework 1.1. I already had VB6 SP6 installed. I wanted to do a quick "hello world" example in VB.Net. The code is here: Private Sub...
4
by: | last post by:
I have about 20 MsgBox occurance in by program, which I use to inform the user of the progress of the program, or ask confirmation of an action, or simply to act separators to various parts of the...
9
by: Ivan Jericevich | last post by:
In my code below at the line 'response' a blip sound is heard and the program exits the sub -- No MsgBox is displayed. What am I doing wrong? If nonNumberEntered = True Then msg = "Enter...
2
by: JB | last post by:
Hi All, I've been using MsgBox function in VB for years and now that I've moved to .NET, I'd like to do something a little bit more fancy. I would like to create a message box that can be...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.