View Poll Results: Is the MSGBOX function usefull??
- Voters
- 20. You may not vote on this poll
-
Jun 26th, 2002, 06:07 PM
#1
Thread Starter
Fanatic Member
Why is the MSGBOX so stupid??
Why is the msgbox so stupid.
I have created a messenger. Now sometimes a user has to be noticed about something (and maybe click on a button). I used the msgbox, but I found out that the whole code wait until a button is pressed, so If a user doesn't react soon enoug some data will be used later. I use a function to see if a user is still online to confirm to a question each time. I give it 10 seconds of time. When the users has a msgbox open for this 10 seconds the program can't react on time so the program thinks it is offline. How to fix this??
I have made my own msgbox form, but the problem is that some subs must wait until a button is pressed. I used an array of forms. But if a program (sub) has to wait until a button is pressed I can' t call the sub again. Anyone has got any idea how to fix this. I also tried to use activex etc, but nothing.
Every idea could be helpfull
-
Jun 26th, 2002, 06:36 PM
#2
-
Jun 26th, 2002, 06:40 PM
#3
PowerPoster
Well
I agree with MC Brain.. Why not use a label on the form, instead of popping up all the MsgBoxes...
Use MsgBox sparingly, most users won't even read the text that is displayed
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Jun 26th, 2002, 06:43 PM
#4
Thread Starter
Fanatic Member
I Think I wasn't clear.
It isn't that the messenger is opening the msgboxes. If you for example delete a contact you get a messagebox or when I want to play a game with a contact wich hasn't the plugin it gets a messagebox, or when an error happends or when I give you a new contact. SO the messageboxes can comes at random. But when The program asks are you offline I only want to check if the program on the other computer is still running. Cause when I have winscok opened and someone just pulls the cable out the messenger (even not MSN messenger) will recognize you go offline, so that;s why I want to check once in a while.
I hope this makes it a little more clear
-
Jun 26th, 2002, 06:46 PM
#5
-
Jun 26th, 2002, 06:53 PM
#6
Thread Starter
Fanatic Member
That's kinda what I'm doing. Each 10 secons I check one of my buddies in my list and gives the other computer 10 seconds to reply (in case of bad connection). But when the user has (one way or another) a msgbox opened I don;t get the response in time cause the program waits until the msgbox dissapears. How to change this, to make this work??
-
Jun 26th, 2002, 06:57 PM
#7
-
Jun 26th, 2002, 07:16 PM
#8
Thread Starter
Fanatic Member
That also doesn't works.
Cause when the user only has to click ok it works. But when I want for example a Yes,No or Cancel I have the same problems, so has anyone got a solution??
-
Jun 26th, 2002, 07:19 PM
#9
-
Jun 26th, 2002, 07:22 PM
#10
PowerPoster
There is a lot of source code available for custom messageboxes that emulate the VB msgbox. Just do a search on the source code sites. I'm serious. There are a lot of them. Most that I've seen aren't that great, but they'll get you started and you can improve them.
-
Jun 26th, 2002, 07:24 PM
#11
Curiouser still...why is 'sucks' censored in the poll?
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Jun 26th, 2002, 07:24 PM
#12
Thread Starter
Fanatic Member
The problem is:
I use a sub. Then I open my own msgbox. So far so good. But then the sub needs to wait for a button to be clicked. SO I show the form modal : frm.show 1. But now when a new request for that sub comes it does nothing anymore. I just waits till the old form is cleared. That's the problem. Even when I use Doevents
-
Jun 26th, 2002, 07:27 PM
#13
PowerPoster
VB Code:
Sub ShowMessage()
Static MsgVisible As Boolean
If MsgVisible Then Exit sub
MsgVisible = True
' show your msgbox
MsgVisible = False
End Sub
-
Jun 26th, 2002, 07:29 PM
#14
Thread Starter
Fanatic Member
Well caffeenman.
I could find a good sample of a messagebox (tried for example www.planet-source-code.com) so that's why I started this treath.
And sucks is censored cause I though it would make it a little nicer and still everyone knows what I mean.
-
Jun 26th, 2002, 07:36 PM
#15
Thread Starter
Fanatic Member
Sub ShowMessage()
Static MsgVisible As Boolean
If MsgVisible Then Exit sub
MsgVisible = True
' show your msgbox
MsgVisible = False
End Sub
Well I don't know what this might be but it isn''t what I want. I will give you some of my code : It might be kinda messy but it's in beta :
Public Function ownmsgbox(message As String, title As String, cmdcancel As Boolean, cmdyes As Boolean, cmdno As Boolean, cmdok As Boolean, Optional pic As Byte = 0) As integer
Dim frm As New frmmsgbox
frm.Caption = title
frm.label1.caption=message
frm.value=-1
frm.cmdok.Visible = cmdok
frm.cmdcancel.Visible = cmdcancel
frm.cmdja.Visible = cmdyes
frm.cmdnee.Visible = cmdno
frm.show 1
Set ownmsgbox = frm.value
End Function
-
Jun 27th, 2002, 04:58 AM
#16
Junior Member
_____________________________
strength respects strength
_______________A P J Abdul Kalam
-
Jun 27th, 2002, 05:50 AM
#17
Maybe you can use the Zorder of the form.
I am not working in VB anymore but play with it .
I think you can set it like
frm.show
frm.Zorder 0
this way it should stay on top and other events would still work.
check in its lost focus event to reset it to topform.
You'ld have to change some code though.
-
Jun 27th, 2002, 05:52 AM
#18
In reply to the poll.
I voted it isn't stupid.
Just use it for what it is made.
-
Jun 27th, 2002, 06:22 AM
#19
Frenzied Member
There is another msgbox via API, it works diifferently.
You can use timer on your own msgbox, than it's unload after 10 seconds.
oh1mie/Vic

-
Jun 30th, 2002, 10:50 AM
#20
Thread Starter
Fanatic Member
I couldn't get it working. Anyone a good example for my problem??
-
Jun 30th, 2002, 11:49 AM
#21
The picture isn't missing
it isn't only standard in VB, it's standard in c++ too. if you really don't want to build your own messagebox then learn to multithread.
Remember, if someone's post was not helpful, you can always rate their post negatively  .
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|