Click to See Complete Forum and Search --> : tough modal problem


ksup
March 20th, 2001, 04:45 PM
I am writing a program that captures another computers print output and using the data. Well here is the problem. When I have to prompt for action code stops so I lose data coming into the port(I am using a parrallel to serial converter). So I either have to write my own msgboxes(I already did the dialogs modaless) or disable my cts , but then the host computer will eventually timeout and have to reprint. I did test an activeX server just to handle and stack input but It was alot of extra code And I'm not that educated on it. I know there is a way to do it. Does anyone have any Ideas how I should fix my problem. I am just not sure what is the best road to take. This progam will be used allot and must be solid(like any good prog). Any insight would be greatly appreciated. thank you

ksup
March 20th, 2001, 09:32 PM
I know netscape is C. Does anyone know of vb program with source that handles communication and has a modal msgbox. MS has one but it is not modal and only halts transfer

Nanderson
March 21st, 2001, 10:26 AM
What don't you like about creating your own message box? That seems like the easiest answer, and it should be very solid.

The only other approach I could think to start trying is looking for API's that would do it, but API's can be less stable than native VB code.

Nathan

http://jsprod.odigo.com/share/servlets/OnLineR?userId=2986792&pId=odigo&design=3&tool=signature

Clearcode
March 21st, 2001, 10:43 AM
The thing about message boxes and modal forms is that they suspend the thread that their in from doing anything else whilst they are up.
The only way you can continue to read from a COMM port whilst a modal form or messagebox is up is to have your comm reading process running in its own thread.
There are good examples of launching processes in their own thread in VB on this site. Do a search for CreateThread

HTH,
Duncan

-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com

Iouri
March 21st, 2001, 12:04 PM
You can use either your custom msgbox, or make msgbox automatically disappear after certain time. Here is 2 ways of doing it

1
Private Declare Function FindWindow Lib "user32" _
Alias "FindWindowA" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare Function SendMessage Lib "user32" _
Alias "SendMessageA" (ByVal hWnd As Long, ByVal _
wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

Private Const WM_CLOSE = &H10

Private Const MsgTitle As String = "Test Message"

Private Sub Command1_Click()
With Timer1
.Interval = 2000
.Enabled = True
End With
MsgBox "I should disappear in two seconds.", , MsgTitle
End Sub

Private Sub Timer1_Timer()
Dim hWnd As Long
Timer1.Enabled = False

hWnd = FindWindow(vbNullString, MsgTitle)
Call SendMessage(hWnd, WM_CLOSE, 0, ByVal 0&)
End Sub
'================================
2.
'add reference to Windows Scripting host Object model

Dim wshShell As New IWshShell_Class
Dim lngReturn As Long
Dim intSeconds2Wait As Integer
intSeconds2Wait = 1
lngReturn = wshShell.Popup("Place Your Text Here", intSeconds2Wait)



Iouri Boutchkine
iouri@hotsheet.com

ksup
March 21st, 2001, 03:11 PM
What I did today was called the message box API. That fixed me up. Thanks for your help. Does anyone know how to unload a msgbox by way of code (API msgbox preferred)? I could just use a form otherwise.