 |
 |
Index ‹ Visual Studio ‹ Visual Basic
|
- Previous
- 1
- Visual Studio C++ >> nmake and extra include pathHi
I run nmake from visual studio (.NET 2003) command prompt.
This means that the enviroment is correct.
My question is: How do I add additional include and library paths to
the enviroment??
Peter
- 2
- MFC >> 2 "type" problems...Hi,
(Follow up to microsoft.publicisa.sdk-dev)
I'm under VC++ 5.0 and try to use functions from ISA SDK.
1)I wonder how could I fill the WCHAR psz[100] with a CString content ?
Here is the code:
--------------------
WCHAR psz[100];
wcscpy(psz,L"MyString"); //this works
---------------------
But, I need to have MyString come from a CString
2)This code always return values <=255.
long l = fpcDestinationSet->Count;
ie: If I have 350 elements, the long l is : 94 (350%256)
even if I try the C++ way :
long count;
fpcDestinationSet->get_Count(&count);
printf("Destination Set : %s count : %ld\n", (char*)
fpcDestinationSet->Name,count);
the "Count" (get_Count() method for DestinationSet is here :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/isa/isaobj2_9o6c.asp
- 3
- Visual Basic >> Dr Watson errorI have a VB6 program that receives data using socket and save the data to a
SQL Server 2000 database.
It has Windows 2000 SP4 with all hot patches in it. It has 2 gig of RAM.
The program had been running for years with no problem, but for the last 3
days it had died exactly at 3 AM. No error on the screen, but there is Dr.
Watson error (it is in drwtsn32.log).
The error in drwtsn32.log is:
Exception number: c0000005 (access violation) --> this is on this VB
program.
I do not know how to read Dr Watson log, but the "Raw Stack Dump" contains
c:\winnt\system32\comsvcs.dll.
I searched on the internet and found that there was an Access Violation
error with comsvcs.dll, and the fix is to install the latest Windows
patches, which we already did. We also increased the memory from 1 gig RAM
to 2 gig. The program still happens.
There is no scheduled task running at 3 AM.
Does anybody know how to read Dr Watson log ?
How can I fix this problem ?
Thank you very much.
- 4
- Visual Basic >> restricting the height of a formon a form i have a label control
in the forms Resize event i have the following code:
--------------------------------------------------
Label1.Height=Me.ScaleHeight * .5
--------------------------------------------------
i want it for the user to be impossible to make the form's height any
smaller when the labels height is smaller then say 2000 twips
any suggestions ?
tia
pc
- 5
- Visual Basic >> changeHello, I want to let the commandbutton1 to change for example the
letter "a" into letter "z" and letter "b" into "y" and so on from the
textbox1 to textbox1 again... how can this be done??
Thanks in advance...
- 6
- Visual Basic [VB] >> Flexibility vs ReliabilityMy co-worker and I are debating Flexibility vs. Reliability.
For example this method is highly flexible:
Public Shared Function GetList(ByVal whereClause As String) As String
strSQL = "SELECT field1,field2,field3,field4,field5 FROM table1 "
If whereClause <> String.Empty Then
strSQL &= "WHERE " & whereClause
End If
Return strSQL
End Function
My co-worker agress that it is flexible but would prefer to use more
reliable techniques like Overloading and Strong Typing of parameters.
Public Shared Function GetList(ByVal field1Value As String, ByVal
field2Value As Integer) As String
strSQL = "SELECT field1,field2,field3,field4,field5 FROM table1 "
strSQL &= "WHERE field1='" & field1Value & "' AND field2=" &
field2Value
Return strSQL
End Function
My argument is that you can't predict every possible combination of field
values and arguments so the number of where clauses and overloaded methods
would grow to ridiculous proportions.
Have other people faced this issue? If so what did you think about it?
Appreciate any insights and experiences.
Thanks!
--
Joe Fallon
- 7
- MFC >> mimic cin abilityI am connecting with a hardware device that sends data
via keyboard emulation. That is it sends the data as if
it were typed on the keyboard. So I wrote a shell that
used cin to get those input values. Now I am trying to
port my text based system to a dialog so it can be user
friendly.
So I want to have an edit box that has the cursor put
there. I know you can use GetDlgItemText to get text
from an edit box, but I don't know of anyway to make the
GetDlgItemText wait until a new line character like cin
does? I have also tried
CWnd* pntr=GetDlgItem(id); to see if there are any
particular methods available to you that way that would
help but I couldn't figure it out. Anybody know how to
do this one?
I also have not been able to find a method to allow me to
make the edit box the focus. the SetFocus returns a
pointer but doesn't take an id to say what is being
focused.
Thanks in advance for answering the newbie's questions.
Danny
- 8
- Visual Basic >> collection clone?is there an optimal way to clone a collection? i was going to do something
like:
...
Private m_Collection As Collection
...
Public Function Clone() As Collection
Set Clone = New Collection
Dim Item As Variant
For Each Item In m_Collection
Clone.Add Item
Next
End Sub
Problem is that I loose my Index. Is there a better way?
Thanks,
Craig Buchanan
- 9
- Visual Basic [VB] >> excell in the process windowhi i have a windows service that uses an excell workbook
when i create the excell app
i cant distroy it after i am finished i am using this code
whats wrong?
thanks
Dim processes1(), p1 As Process
Try
processes1 = Process.GetProcesses()
For Each p1 In processes1
If Not (p1.MainModule Is Nothing) Then
If
System.IO.Path.GetFileName(p1.MainModule.FileName).ToLower() = "excel.exe"
Then
Try
p1.Close()
'p1.CloseMainWindow()
Catch er1 As Exception
MsgBox(er1)
End Try
'Exit For
End If
End If
Next
Catch ex As SystemException
MsgBox(ex.message)
End Try
- 10
- Visual Basic >> Integration with Word, can this be done?Here is what I have to accomplish, and I want to know if this can be done,
and pointers on how can this be done.
1) I need to start a new Word document using a template provided by the
customer. The customer will provide different templates, and my code would
know wish template to invoke. The question is what methodology do I use to
start the new Word doc?
2) At the end when the user saves the document, I need to send a copy of
this new created document by email to a destination. The destination may
change, and the settings could be saved in a INI file (TBD). My question is
can I override the SAVE button in Word, or provide a special button on the
toolbar to be pressed when done. Don't know what to do ????
Any tips/pointers would be appreciated. Thanks in advance for your reply.
Helene (Challenge by this task. Does not know where to start?)
- 11
- Visual Basic [VB] >> After days and hours, could not achieve to do this ...Hello MVPs and other Gurus,
I (urgently) need to fill a TreeView in a Windows form with the
data of a text file structured as under :
- begin
Root\
Root\Node1\
Root\Node1\SubNode11\
Root\Node1\SubNode11\SubNode111\
Root\Node1\SubNode11\SubNode112\
Root\Node1\SubNode12\
Root\Node1\SubNode12\SubNode121\
Root\Node1\SubNode12\SubNode122\
Root\Node1\SubNode12\SubNode123\
Root\Node1\SubNode13\
Root\Node1\SubNode14\
Root\Node2\
Root\Node2\SubNode21\
Root\Node2\SubNode21\SubNode211\
Root\Node2\SubNode21\SubNode211\SubNode2111\
Root\Node2\SubNode21\SubNode211\SubNode2111\SubNode2112\
Root\Node2\SubNode21\SubNode211\SubNode2111\SubNode2112\SubNode21121
Root\Node2\SubNode21\SubNode212\
Root\Node2\SubNode21\SubNode213\
Root\Node3\
- end
Any name in this example is fake and can be replaced
with a whatever string matching the structure.
I easily extracted each Node.Text from the file, but after days
and hours roaming around the availabilities of VB.Net (Visual Studio 2003)
and various Internet Sites, I could not achieve to fill the TreeView properly.
;-(
Any tip, link, code, advice, and support will be highly appreciated.
TIA to all.
Patrick Penet
:-)
PS: sorry for crossposting in the VB.Net and Visual Studio related NGs
but it's a matter of time now.
--
Remove the dot to answer in my box
phpe.net@club-internet.fr
====================
- 12
- Visual Basic [VB] >> Reliable conversion from byte() to string WITHOUT use of System.Text.EncodingThe reason I want to do so, is that I am sending to DOS and I am pretty
certain that it will not work.
Everything I've tried so far hasnt.
In my test environment (Windows to Windows) this works perfectly, but not
when sending to DOS:
Private Function bytearray2string(ByVal input As Byte()) As String
Dim output As String
output = System.Text.Encoding.Default.GetString(input)
Return output
End Function
Private Function string2bytearray(ByVal input As String) As Byte()
Dim output() As Byte
output = System.Text.Encoding.Default.GetBytes(input)
Return output
End Function
I have also tried this, to no avail in Windows:
Private Function bytearray2string2(ByVal input As Byte()) As String
Dim output As String = ""
Dim i As Integer = 0
'Dim vchar As Char
While i < input.Length
output = output & CChar(Chr(input.GetValue(i)))
i = i + 1
End While
Return (output)
End Function
Private Function string2bytearray2(ByVal input As String) As Byte()
Dim output(input.Length - 1) As Byte
Dim i As Integer = 0
For i = 0 To UBound(output)
output(i) = CByte(Asc(input.Chars(i)))
Next
Return (output)
End Function
The desired functions need to use no encoding and be able to work with
simple bytes. The values I'll be receiving wont be higher anyway.
I'd appreciate any feedback whatsoever.
regards,
J
- 13
- 14
- Visual Basic [VB] >> LoopI need to loop through a index change event, however whenever i loop
through the first combo box always report back correctly its when i
move to the next combobox, that instead of changing the second combo
box it will change the background of the first combo box.
What im i doing wrong?
For intloop = 0 To cboArraylist.Count - 1
If (CType(cboArraylist(intloop), ComboBox).Text) = "Go"
Then
CType(cboArraylist(intloop), Object).BackColor =
Color.LawnGreen
ElseIf (CType(cboArraylist(intloop), ComboBox).Text) = "No
Go" Then
CType(cboArraylist(intloop), Object).BackColor =
Color.Tomato
End If
Next
- 15
- VB Scripts >> Regular Expression Replace : $1 shows up as literal.Hi There.
I have searched the news groups and cannot seem to find an answer to my
situation. Basically, I have the following function (that appears
standard across all posts):
Public Function Highlight(p_sFind, p_sSearch)
Dim RegEx
Set RegEx = New RegExp
RegEx.Pattern=p_sFind
RegEx.IgnoreCase=True
RegEx.Global=True
Highlight = RegEx.Replace(p_sSearch,"<b>$1</b>")
End Function
However, wheneven I execute it on some code, I get a literal "$1"
rather then the string I searched for.
For example, Highlight ("Harv", "Harvard Medical School") returns:
"<b>$1</b>ard Medical School" rather than "<b>Harv</b>ard Medical
School".
Does anyone have any idea what I am doing wrong. Is any server
requirements in using this tool?
Thanks
Jason
|
| Author |
Message |
Realitygdk

|
Posted: Sat Feb 04 10:56:00 CST 2006 |
Top |
Visual Basic >> Using timers
Hello,
1.
Is there any 'optimal' number of timers can be used on one form?
2.
Which design will be more efficient:
A. using one timer and combine different events using If... Then
statements.
Because each event requires different time interval change timer
intervals for each event will be included in the code
or
B.
For each event use different timer with preset time interval
Your thoughts please,
Jack
Visual Studio247
|
| |
|
| |
 |
Michael

|
Posted: Sat Feb 04 10:56:00 CST 2006 |
Top |
Visual Basic >> Using timers
I have always run multiple timers in this situation. Name the timers so
that the timer_Elapsed events are obvious. This will make you code more
readable.
Mike Ober.
"Jack" <replyTo@newsgroup> wrote in message
news:OJ$EMail@HideDomain.com...
> Hello,
> 1.
> Is there any 'optimal' number of timers can be used on one form?
> 2.
> Which design will be more efficient:
> A. using one timer and combine different events using If... Then
> statements.
> Because each event requires different time interval change timer
> intervals for each event will be included in the code
> or
> B.
> For each event use different timer with preset time interval
>
> Your thoughts please,
> Jack
>
>
>
|
| |
|
| |
 |
Veign

|
Posted: Sat Feb 04 10:54:18 CST 2006 |
Top |
Visual Basic >> Using timers
What are you trying to do?
Option:
One timer with a low interval (1 second maybe) and have the timer event
check for how much time has passed and react accordingly. Then your timer
event can trigger several events based on passed time.
Remember timer events are low priority events with the system and instead of
checking for a time being reached you should check for a time being
passed...
--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
Veign's Blog
http://www.veign.com/blog
--
"Jack" <replyTo@newsgroup> wrote in message
news:OJ$EMail@HideDomain.com...
> Hello,
> 1.
> Is there any 'optimal' number of timers can be used on one form?
> 2.
> Which design will be more efficient:
> A. using one timer and combine different events using If... Then
> statements.
> Because each event requires different time interval change timer
> intervals for each event will be included in the code
> or
> B.
> For each event use different timer with preset time interval
>
> Your thoughts please,
> Jack
>
>
|
| |
|
| |
 |
Jack

|
Posted: Sat Feb 04 15:20:50 CST 2006 |
Top |
Visual Basic >> Using timers
Thank you.
What I am worrying about is that my form has already 15 timers on it and I
am in need to add some more.
Not all the timers are active at the same time of course, but one or two.
I do not want to have big overhead, or the code became too 'heavy'.
Jack
"Jack" <replyTo@newsgroup> wrote in message
news:OJ$EMail@HideDomain.com...
> Hello,
> 1.
> Is there any 'optimal' number of timers can be used on one form?
> 2.
> Which design will be more efficient:
> A. using one timer and combine different events using If... Then
> statements.
> Because each event requires different time interval change timer
> intervals for each event will be included in the code
> or
> B.
> For each event use different timer with preset time interval
>
> Your thoughts please,
> Jack
>
>
|
| |
|
| |
 |
Veign

|
Posted: Sat Feb 04 15:23:07 CST 2006 |
Top |
Visual Basic >> Using timers
Again, I ask, what are you trying to do? By explaining what you ware doing
you may get alternate methods that will work better. When you ask a
specific question you get specific answers - as we don't how or why things
are being used...
Like, 15 timers on a form, to me, seems very excessive. I have probably
never used more than 3.....
--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
Veign's Blog
http://www.veign.com/blog
--
"Jack" <replyTo@newsgroup> wrote in message
news:EMail@HideDomain.com...
> Thank you.
> What I am worrying about is that my form has already 15 timers on it and I
> am in need to add some more.
> Not all the timers are active at the same time of course, but one or two.
> I do not want to have big overhead, or the code became too 'heavy'.
> Jack
> "Jack" <replyTo@newsgroup> wrote in message
> news:OJ$EMail@HideDomain.com...
>> Hello,
>> 1.
>> Is there any 'optimal' number of timers can be used on one form?
>> 2.
>> Which design will be more efficient:
>> A. using one timer and combine different events using If... Then
>> statements.
>> Because each event requires different time interval change timer
>> intervals for each event will be included in the code
>> or
>> B.
>> For each event use different timer with preset time interval
>>
>> Your thoughts please,
>> Jack
>>
>>
>
>
|
| |
|
| |
 |
Jack

|
Posted: Sat Feb 04 16:01:39 CST 2006 |
Top |
Visual Basic >> Using timers
It is a communication program.
timers are used for:
-main timer --> heart of the system
-retrieving TAPI callbacks
-detecting busy line
-scheduler
-recording
-playing
-running script
-finding specified window (FindWindow() )
-redirecting voice
-buffering
-monitoring
should I go on?
Jack
"Veign" <EMail@HideDomain.com> wrote in message
news:EMail@HideDomain.com...
> Again, I ask, what are you trying to do? By explaining what you ware
> doing you may get alternate methods that will work better. When you ask a
> specific question you get specific answers - as we don't how or why things
> are being used...
>
> Like, 15 timers on a form, to me, seems very excessive. I have probably
> never used more than 3.....
>
> --
> Chris Hanscom - Microsoft MVP (VB)
> Veign's Resource Center
> http://www.veign.com/vrc_main.asp
> Veign's Blog
> http://www.veign.com/blog
> --
>
>
> "Jack" <replyTo@newsgroup> wrote in message
> news:EMail@HideDomain.com...
>> Thank you.
>> What I am worrying about is that my form has already 15 timers on it and
>> I am in need to add some more.
>> Not all the timers are active at the same time of course, but one or two.
>> I do not want to have big overhead, or the code became too 'heavy'.
>> Jack
>> "Jack" <replyTo@newsgroup> wrote in message
>> news:OJ$EMail@HideDomain.com...
>>> Hello,
>>> 1.
>>> Is there any 'optimal' number of timers can be used on one form?
>>> 2.
>>> Which design will be more efficient:
>>> A. using one timer and combine different events using If... Then
>>> statements.
>>> Because each event requires different time interval change timer
>>> intervals for each event will be included in the code
>>> or
>>> B.
>>> For each event use different timer with preset time interval
>>>
>>> Your thoughts please,
>>> Jack
>>>
>>>
>>
>>
>
>
|
| |
|
| |
 |
Veign

|
Posted: Sat Feb 04 16:03:56 CST 2006 |
Top |
Visual Basic >> Using timers
Good luck. You seem very hesistant to give information and when you do you
come across with an attitude. I was trying to help.
To answer your question - No, you don't need to go on....
--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
Veign's Blog
http://www.veign.com/blog
--
"Jack" <replyTo@newsgroup> wrote in message
news:%EMail@HideDomain.com...
> It is a communication program.
> timers are used for:
> -main timer --> heart of the system
> -retrieving TAPI callbacks
> -detecting busy line
> -scheduler
> -recording
> -playing
> -running script
> -finding specified window (FindWindow() )
> -redirecting voice
> -buffering
> -monitoring
>
> should I go on?
> Jack
>
>
> "Veign" <EMail@HideDomain.com> wrote in message
> news:EMail@HideDomain.com...
>> Again, I ask, what are you trying to do? By explaining what you ware
>> doing you may get alternate methods that will work better. When you ask
>> a specific question you get specific answers - as we don't how or why
>> things are being used...
>>
>> Like, 15 timers on a form, to me, seems very excessive. I have probably
>> never used more than 3.....
>>
>> --
>> Chris Hanscom - Microsoft MVP (VB)
>> Veign's Resource Center
>> http://www.veign.com/vrc_main.asp
>> Veign's Blog
>> http://www.veign.com/blog
>> --
>>
>>
>> "Jack" <replyTo@newsgroup> wrote in message
>> news:EMail@HideDomain.com...
>>> Thank you.
>>> What I am worrying about is that my form has already 15 timers on it and
>>> I am in need to add some more.
>>> Not all the timers are active at the same time of course, but one or
>>> two.
>>> I do not want to have big overhead, or the code became too 'heavy'.
>>> Jack
>>> "Jack" <replyTo@newsgroup> wrote in message
>>> news:OJ$EMail@HideDomain.com...
>>>> Hello,
>>>> 1.
>>>> Is there any 'optimal' number of timers can be used on one form?
>>>> 2.
>>>> Which design will be more efficient:
>>>> A. using one timer and combine different events using If... Then
>>>> statements.
>>>> Because each event requires different time interval change timer
>>>> intervals for each event will be included in the code
>>>> or
>>>> B.
>>>> For each event use different timer with preset time interval
>>>>
>>>> Your thoughts please,
>>>> Jack
>>>>
>>>>
>>>
>>>
>>
>>
>
>
|
| |
|
| |
 |
Jack

|
Posted: Sat Feb 04 16:19:11 CST 2006 |
Top |
Visual Basic >> Using timers
No need to get offended. If you are, I apologize.
I have just tried to answer your question.
You asked me what I am trying to do and I explained.
Each timer has specific task as shown. At most only one or two timers are
active at the same time.
What I am trying to find is how that timers are weighting on my code?
Is there a better approach to reduce number of timers and cumulate more code
inside them?
It was my original question, btw,
Jack
"Veign" <EMail@HideDomain.com> wrote in message
news:enwL%EMail@HideDomain.com...
> Good luck. You seem very hesistant to give information and when you do
> you come across with an attitude. I was trying to help.
>
> To answer your question - No, you don't need to go on....
>
> --
> Chris Hanscom - Microsoft MVP (VB)
> Veign's Resource Center
> http://www.veign.com/vrc_main.asp
> Veign's Blog
> http://www.veign.com/blog
> --
>
>
> "Jack" <replyTo@newsgroup> wrote in message
> news:%EMail@HideDomain.com...
>> It is a communication program.
>> timers are used for:
>> -main timer --> heart of the system
>> -retrieving TAPI callbacks
>> -detecting busy line
>> -scheduler
>> -recording
>> -playing
>> -running script
>> -finding specified window (FindWindow() )
>> -redirecting voice
>> -buffering
>> -monitoring
>>
>> should I go on?
>> Jack
>>
>>
>> "Veign" <EMail@HideDomain.com> wrote in message
>> news:EMail@HideDomain.com...
>>> Again, I ask, what are you trying to do? By explaining what you ware
>>> doing you may get alternate methods that will work better. When you ask
>>> a specific question you get specific answers - as we don't how or why
>>> things are being used...
>>>
>>> Like, 15 timers on a form, to me, seems very excessive. I have probably
>>> never used more than 3.....
>>>
>>> --
>>> Chris Hanscom - Microsoft MVP (VB)
>>> Veign's Resource Center
>>> http://www.veign.com/vrc_main.asp
>>> Veign's Blog
>>> http://www.veign.com/blog
>>> --
>>>
>>>
>>> "Jack" <replyTo@newsgroup> wrote in message
>>> news:EMail@HideDomain.com...
>>>> Thank you.
>>>> What I am worrying about is that my form has already 15 timers on it
>>>> and I am in need to add some more.
>>>> Not all the timers are active at the same time of course, but one or
>>>> two.
>>>> I do not want to have big overhead, or the code became too 'heavy'.
>>>> Jack
>>>> "Jack" <replyTo@newsgroup> wrote in message
>>>> news:OJ$EMail@HideDomain.com...
>>>>> Hello,
>>>>> 1.
>>>>> Is there any 'optimal' number of timers can be used on one form?
>>>>> 2.
>>>>> Which design will be more efficient:
>>>>> A. using one timer and combine different events using If... Then
>>>>> statements.
>>>>> Because each event requires different time interval change timer
>>>>> intervals for each event will be included in the code
>>>>> or
>>>>> B.
>>>>> For each event use different timer with preset time interval
>>>>>
>>>>> Your thoughts please,
>>>>> Jack
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
|
| |
|
| |
 |
Larry

|
Posted: Sat Feb 04 19:29:28 CST 2006 |
Top |
Visual Basic >> Using timers
"Jack" <replyTo@newsgroup> wrote
> Hello,
> 1.
> Is there any 'optimal' number of timers can be used on one form?
Yes, the optimal number might be just one.
> 2.
> Which design will be more efficient:
> A. using one timer and combine different events using If... Then
> statements.
Using less timers would be better. No matter how many timers you
use, you can only execute in one routine at a time anyway....
LFS
|
| |
|
| |
 |
Veign

|
Posted: Sat Feb 04 22:12:33 CST 2006 |
Top |
Visual Basic >> Using timers
OK..
You really haven't provided enough information on coming up with an
alternate solution. By the sound of the complexity of your application I'm
not sure you could. What's hard to tell is the why. Like why does running
a script require a timer or why does finding a window need a timer.
I guess I stand by my original statement that a single timer that monitors
all the events is the way to go. Also, its hard to tell if you even need
everything on timers.
Maybe what you could do is start consolidating timers that perform a common
function like; Recording, playback, redirect. See how this works for you
and keep moving in the direction of removing timers and not adding new
ones...
Also, I guess it would be nice to try and understand 'why so many things
need times'
--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
Veign's Blog
http://www.veign.com/blog
--
"Jack" <replyTo@newsgroup> wrote in message
news:EMail@HideDomain.com...
> No need to get offended. If you are, I apologize.
> I have just tried to answer your question.
> You asked me what I am trying to do and I explained.
> Each timer has specific task as shown. At most only one or two timers are
> active at the same time.
> What I am trying to find is how that timers are weighting on my code?
> Is there a better approach to reduce number of timers and cumulate more
> code inside them?
> It was my original question, btw,
> Jack
>
> "Veign" <EMail@HideDomain.com> wrote in message
> news:enwL%EMail@HideDomain.com...
>> Good luck. You seem very hesistant to give information and when you do
>> you come across with an attitude. I was trying to help.
>>
>> To answer your question - No, you don't need to go on....
>>
>> --
>> Chris Hanscom - Microsoft MVP (VB)
>> Veign's Resource Center
>> http://www.veign.com/vrc_main.asp
>> Veign's Blog
>> http://www.veign.com/blog
>> --
>>
>>
>> "Jack" <replyTo@newsgroup> wrote in message
>> news:%EMail@HideDomain.com...
>>> It is a communication program.
>>> timers are used for:
>>> -main timer --> heart of the system
>>> -retrieving TAPI callbacks
>>> -detecting busy line
>>> -scheduler
>>> -recording
>>> -playing
>>> -running script
>>> -finding specified window (FindWindow() )
>>> -redirecting voice
>>> -buffering
>>> -monitoring
>>>
>>> should I go on?
>>> Jack
>>>
>>>
>>> "Veign" <EMail@HideDomain.com> wrote in message
>>> news:EMail@HideDomain.com...
>>>> Again, I ask, what are you trying to do? By explaining what you ware
>>>> doing you may get alternate methods that will work better. When you
>>>> ask a specific question you get specific answers - as we don't how or
>>>> why things are being used...
>>>>
>>>> Like, 15 timers on a form, to me, seems very excessive. I have
>>>> probably never used more than 3.....
>>>>
>>>> --
>>>> Chris Hanscom - Microsoft MVP (VB)
>>>> Veign's Resource Center
>>>> http://www.veign.com/vrc_main.asp
>>>> Veign's Blog
>>>> http://www.veign.com/blog
>>>> --
>>>>
>>>>
>>>> "Jack" <replyTo@newsgroup> wrote in message
>>>> news:EMail@HideDomain.com...
>>>>> Thank you.
>>>>> What I am worrying about is that my form has already 15 timers on it
>>>>> and I am in need to add some more.
>>>>> Not all the timers are active at the same time of course, but one or
>>>>> two.
>>>>> I do not want to have big overhead, or the code became too 'heavy'.
>>>>> Jack
>>>>> "Jack" <replyTo@newsgroup> wrote in message
>>>>> news:OJ$EMail@HideDomain.com...
>>>>>> Hello,
>>>>>> 1.
>>>>>> Is there any 'optimal' number of timers can be used on one form?
>>>>>> 2.
>>>>>> Which design will be more efficient:
>>>>>> A. using one timer and combine different events using If... Then
>>>>>> statements.
>>>>>> Because each event requires different time interval change timer
>>>>>> intervals for each event will be included in the code
>>>>>> or
>>>>>> B.
>>>>>> For each event use different timer with preset time interval
>>>>>>
>>>>>> Your thoughts please,
>>>>>> Jack
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
|
| |
|
| |
 |
TedF

|
Posted: Sat Feb 04 23:23:58 CST 2006 |
Top |
Visual Basic >> Using timers
Even though with one timer, still none will work
with the intervals you expect. Because VB can do one thing
at a time, and by the time you expect it to run your function
at the interval you set, it will be busy doing the first function.
You have to run things in sequence rather than by timer intervals.
And don't expect it to run things for you in intervals of 250 or 500,
because it would take that long to run your first function.
Yes timers do run in the background, but will not function
if you have it busy doing something else.
Use one timer.
Set a long variable to count time, then call functions
when the variable reaches time desired.
'Example:
Dim T500 As Long, T750 As Long, T1000 As Long, T1250 As Long
Private Sub Form_Load()
Timer1.Interval = 250
End Sub
Private Sub Timer1_Timer()
T500 = T500 + 1
If T500 = 2 Then
T500 = 0
Call theFunction500
End If
T750 = T750 + 1
If T750 = 3 Then
T750 = 0
Call theFunction750
End If
T1000 = T1000 + 1
If T1000 = 4 Then
T1000 = 0
Call theFunction1000
End If
End Sub
Public Sub theFunction500()
MsgBox "500"
End Sub
Public Sub theFunction750()
MsgBox "750"
End Sub
Public Sub theFunction1000()
MsgBox "1000"
End Sub
"Jack" <replyTo@newsgroup> wrote in message
news:EMail@HideDomain.com...
> No need to get offended. If you are, I apologize.
> I have just tried to answer your question.
> You asked me what I am trying to do and I explained.
> Each timer has specific task as shown. At most only one or two timers are
> active at the same time.
> What I am trying to find is how that timers are weighting on my code?
> Is there a better approach to reduce number of timers and cumulate more
> code inside them?
> It was my original question, btw,
> Jack
>
> "Veign" <EMail@HideDomain.com> wrote in message
> news:enwL%EMail@HideDomain.com...
>> Good luck. You seem very hesistant to give information and when you do
>> you come across with an attitude. I was trying to help.
>>
>> To answer your question - No, you don't need to go on....
>>
>> --
>> Chris Hanscom - Microsoft MVP (VB)
>> Veign's Resource Center
>> http://www.veign.com/vrc_main.asp
>> Veign's Blog
>> http://www.veign.com/blog
>> --
>>
>>
>> "Jack" <replyTo@newsgroup> wrote in message
>> news:%EMail@HideDomain.com...
>>> It is a communication program.
>>> timers are used for:
>>> -main timer --> heart of the system
>>> -retrieving TAPI callbacks
>>> -detecting busy line
>>> -scheduler
>>> -recording
>>> -playing
>>> -running script
>>> -finding specified window (FindWindow() )
>>> -redirecting voice
>>> -buffering
>>> -monitoring
>>>
>>> should I go on?
>>> Jack
>>>
>>>
>>> "Veign" <EMail@HideDomain.com> wrote in message
>>> news:EMail@HideDomain.com...
>>>> Again, I ask, what are you trying to do? By explaining what you ware
>>>> doing you may get alternate methods that will work better. When you
>>>> ask a specific question you get specific answers - as we don't how or
>>>> why things are being used...
>>>>
>>>> Like, 15 timers on a form, to me, seems very excessive. I have
>>>> probably never used more than 3.....
>>>>
>>>> --
>>>> Chris Hanscom - Microsoft MVP (VB)
>>>> Veign's Resource Center
>>>> http://www.veign.com/vrc_main.asp
>>>> Veign's Blog
>>>> http://www.veign.com/blog
>>>> --
>>>>
>>>>
>>>> "Jack" <replyTo@newsgroup> wrote in message
>>>> news:EMail@HideDomain.com...
>>>>> Thank you.
>>>>> What I am worrying about is that my form has already 15 timers on it
>>>>> and I am in need to add some more.
>>>>> Not all the timers are active at the same time of course, but one or
>>>>> two.
>>>>> I do not want to have big overhead, or the code became too 'heavy'.
>>>>> Jack
>>>>> "Jack" <replyTo@newsgroup> wrote in message
>>>>> news:OJ$EMail@HideDomain.com...
>>>>>> Hello,
>>>>>> 1.
>>>>>> Is there any 'optimal' number of timers can be used on one form?
>>>>>> 2.
>>>>>> Which design will be more efficient:
>>>>>> A. using one timer and combine different events using If... Then
>>>>>> statements.
>>>>>> Because each event requires different time interval change timer
>>>>>> intervals for each event will be included in the code
>>>>>> or
>>>>>> B.
>>>>>> For each event use different timer with preset time interval
>>>>>>
>>>>>> Your thoughts please,
>>>>>> Jack
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
|
| |
|
| |
 |
| |
 |
Index ‹ Visual Studio ‹ Visual Basic |
- Next
- 1
- Mcse >> OT <RANT>Well. After several days of escaping the Borg-like agency which is
incorporating our IT dept, they finally managed to assimilate my pc. It
was hastily reimaged, and with the knowledge I work in the IT dept, they
decided I was knowledgable enough to install my own programs. So they
therefor proceeded to wipe my pc, install XP, and throw it at me,
expecting me to be able to carry on with my IT duties as normal, without
so much as my email account set up.
Finally, after spending all day reconfiguring my pc to my liking, it's
up and running, and I'm back at full force. I'm still not impressed with
the set up, but at least I still have admin rights (courtesy of myself),
while other users are completely locked down.
And I have to admit, it was extremely funny to hear that they ran a
script automatically shutting pc's off when the user logged in without
"their" virus scanner. Resistance is futile.
</rant>
--
Kat MCNGP #29
/* Who you lookin at? */
- 2
- Visual Studio C++ >> Namespaces Managed C++Hello,
can I avoid to dump everything in a namespace somehow? I'm trying to make
my class serializable as such:
// Units.h
#pragma once
#using <System.xml.dll>
#using <mscorlib.dll>
using namespace System::Xml::Serialization;
public __gc class Metric {
public:
Metric();
System::String* areaUnit;
};
Do I really have to dump everything in System::Xml::Serialization into
globabl namespace like this? I think it is bad practice to do so in header
files, at least it is with C++.
--
Daniel
- 3
- 4
- Visual Basic >> Problem refreshing recordsetHello -
I am trying to refresh records after someone adds a new record. For some
reason, it isn't returning the last record (the one added). The stored
procedure, when I run it in Sql Server returns exactly what it's supposed to
return. I am therefore assuming the problem is with my VB code.
Can anyone see what may be causing this?
Private Sub FormRefresh()
Dim cmdRefresh As Command
Dim rsRefresh As ADODB.Recordset
Dim prmRefresh As ADODB.Parameter
Call cnnConnect
Set rsRefresh = New ADODB.Recordset
Set cmdRefresh = New ADODB.Command
With cmdRefresh
.ActiveConnection = cnn
.CommandType = adCmdStoredProc
.CommandText = "spCallsAllAdminRefresh"
End With
'Set parameters
Set prmRefresh = New ADODB.Parameter
Set prmRefresh = cmdRefresh.CreateParameter("@Agent", adVarChar,
adParamInput, 20, frmAdminFilterCalls.txtAgtName.Text)
cmdRefresh.Parameters.Append prmRefresh
Set prmRefresh = cmdRefresh.CreateParameter("@From", adDate,
adParamInput, , frmAdminFilterCalls.dtpFrom.Value)
cmdRefresh.Parameters.Append prmRefresh
ClearFields
Set rsRefresh = New ADODB.Recordset
'Open recordset
rsRefresh.Open cmdRefresh, , adOpenDynamic, adLockOptimistic
Call cmdPrevious_Click
End Sub
Private Sub cmdPrevious_Click()
On Error GoTo EH_Previous
If rsFieldsAll.State = adStateOpen Then
rsFieldsAll.MovePrevious
If Not rsFieldsAll.BOF Then
ClearFields
FillFields
Else
rsFieldsAll.MoveFirst
If Not rsFieldsAll.EOF Then
ClearFields
FillFields
End If
End If
End If
End Sub
Private Sub Form_Load()
'Fill comboboxes
Call FillCombos
Dim cmdFieldsAll As Command
Dim prmFieldsAll As ADODB.Parameter
Dim prmReturn As ADODB.Parameter
'Connect to database
Call cnnConnect
Set rsFieldsAll = New ADODB.Recordset
Set cmdFieldsAll = New ADODB.Command
With cmdFieldsAll
.ActiveConnection = cnn
.CommandType = adCmdStoredProc
.CommandText = "spCallsAllAdminOutput"
End With
'Set parameters
Set prmFieldsAll = New ADODB.Parameter
Set prmFieldsAll = cmdFieldsAll.CreateParameter("@Agent", adVarChar,
adParamInput, 20, frmAdminFilterCalls.txtAgtName.Text)
cmdFieldsAll.Parameters.Append prmFieldsAll
Set prmFieldsAll = cmdFieldsAll.CreateParameter("@From", adDate,
adParamInput, , frmAdminFilterCalls.dtpFrom.Value)
cmdFieldsAll.Parameters.Append prmFieldsAll
Set prmFieldsAll = cmdFieldsAll.CreateParameter("@To", adDate,
adParamInput, , frmAdminFilterCalls.dtpTo.Value)
cmdFieldsAll.Parameters.Append prmFieldsAll
Set prmReturn = cmdFieldsAll.CreateParameter("Output", adInteger,
adParamOutput)
cmdFieldsAll.Parameters.Append prmReturn
'Clear the fields
ClearFields
'Open recordset
rsFieldsAll.Open cmdFieldsAll, , adOpenDynamic, adLockOptimistic
'Grab output value from stored procedure to test for number of rows
returned
RowsReturned = prmReturn.Value
'If no records returned leave frmAdminFilterCalls screen up which contains
'message to user to alter criteria
If prmReturn = 0 Then
frmAdminFilterCalls.Show vbModeless, frmBackground2
Me.Hide
Exit Sub
'If over 100 records returned leave frmAdminFilterCalls screen up which
'contains message to user to alter criteria
ElseIf prmReturn.Value > 100 Then
frmAdminFilterCalls.Show vbModeless, frmBackground2
Me.Hide
Exit Sub
'Otherwise, go ahead and return the records
Else
Call cmdPrevious_Click
End If
End Sub
Any help will be greatly appreciated!
--
Sandy
- 5
- Visual Basic [VB] >> Microsoft IE Treeview Control Right Click popup menuHas anybody got any sample code that I can use with the Microsoft IE
Treeview Control so that when you right click on any node you get a popup
menu (oblessly i need the treeview.selectedindex copied across to)
Any ideas? If the Microsoft IE Treeview control cant do this and a
commercial one can im open to suggestions like this too.
Kind Regards,
Chris Bond
- 6
- Visual Basic >> Printing in IE with no promptVB6/ SP5/ IE 6
I build an HTML file, display inside Web browser; however, I need it
to print directly to the default printer. No dice, prompt (print dialog box)
always appears.
I have Googled and found various answers using same technique but
all have same result: Dialog box appears.
Common technique is to use ExecWB 6, -1.
Is there any way to bypass the print dialog box?
Thanks
Saga
- 7
- Visual Basic >> HTML HelpHow can i get a topic from a HTML .chm file and display it in my VB app.
Like a richtext box or a webbrowser control ?
I dont want to popup another window.....
Peter
- 8
- Mcse >> 20% Discount on MCP certification exams! Use voucher: MSUU4C2E5280INSTRUCTIONS:
a.. Register for your discounted exam online at
www.pearsonvue.com/ms, in person at your nearest Pearson VUE® Test Center
(visit www.pearsonvue.com/ms for a list of test centers in your
area), or call them at 1-800-TEST-REG (800-837-8734).
b.. Use this valuable voucher number: MSUU4C2E5280. You must
present/enter the above voucher number at the time of registration.
c.. Voucher may be used on ANY Microsoft Certified Professional
(MCP) exam(s), and may be used multiple times!!
d.. For more info go to: www.zwitterion.net
--------------------------------------------------------------------------
a.. Exams must be registered and delivered by December 31, 2005
b.. Redeem your voucher via phone (1-800-TEST-REG), online
(www.pearsonvue.com/ms), or in person at your local Pearson VUE Authorized
Center.
c.. Voucher may not be combined with other offers, has no cash
value, and may not be transferred or sold.
d.. Sorry, valid only in the United States.
- 9
- 10
- Visual Basic [VB] >> With block variable not set, errorHi,
I'm converting a bit of POP3 VB6 code to VB2005, and have run into this
error with the following code.
Can someone help me find out what I'm missing/doing wrong?
'holds the attachments
Class attachmentBlockParameter
Public cTypeAttach As String
Public cEncoding As String
Public cFileName As String
Public cAttachment As String
End Class
Public AttachBlock() = New attachmentBlockParameter() {}
Sub Main()
AttachBlock(1).cTypeAttach = "Base64"
' The previous line generates an "Object variable or With block
variable not set." Error
Console.WriteLine(" Attach Block Type=" &
AttachBlock(1).cTypeAttach)
Console.Read()
End Sub
Thanks, Al G
- 11
- Visual Basic >> buy more cheaper runescape gold on www.cheap-runescape-gold.comWell for most it is a method of playing the game and working out how
to make money by developing skills that can earn good amounts of
Runescape money in comparison to the time invested. For others they
have developed a keen sense of the Runescape markets and managed to
provide a service of buying and selling major raw and processed
materials that are in high demand and supply. This means of making
Runescape gold is referred to as merchanting and loads of information
about how to go about earning gold in this way can be found in free
Runescape gold guides that are on many Runescape fan sites and forums.
Even with the availability of free Runescape gold guides there are
also many Runescape gold guides for sale on the internet, though from
my experience none are really worth the money if you have been playing
for a couple of months and have reviewed a few of the free guides to
making Runescape gold on Runescape fan sites and forums.
http://www.cheap-runescape-gold.com
http://www.cheap-runescape-gold.com/index.html
http://www.cheap-runescape-gold.com/buyusd.html
http://www.buy-runescape-money.com
http://www.buy-runescape-money.com/runescape%20gold.html
http://www.buy-runescape-money.com/runescape%20money.html
- 12
- Visual Basic [VB] >> StumpedHello:
I have an MDI application. When the user selects File/Exit, the following
code executes:
Do While Me.MdiChildren.Length > 0
Me.MdiChildren(0).Close()
Loop
End
This code executes fine. Until I click on Help/About that opens a dialog
box. When I close the About dialox box and then click on File/Exit, I get the
exception:
An unhandled exception of type 'System.NullReferenceException' occurred in
Unknown Module.
Additional information: Object reference not set to an instance of an object.
When I break, it says "There is no source code available for the current
location.
There's no MDI child window open.
Can somebody enlighten me on this?
Venkat
- 13
- 14
- Visual Basic [VB] >> how to save the textbox contents to sql server databasehi everyone
i have a problem
how to save the textbox contents to sql server database.
i am getting this contents after conversion from web browser into
textbox(multiline)
I want to store all the contents of textbox in sql server database.
i ahve generated a table.
if u have any idea then let me know the coding for this in C#.net
- 15
- MFC >> Saturating message queue?I was interested in timing how long it took for a parent and child thread to
exchange a series of window messages. I thought I would start with the Frame
and View in the main thread of a doc/view sdi app for simplicity.
I set up a menu item to initiate a loop. Then the Frame and View exchange a
token until the token is incremented to a certain value. However, it hangs
if I use a token value of more than 20. Am I doing something wrong? Is
"SendMessageToDescendants" an inappropriate choice? Is the message queue
"saturating"? ... which would seem odd since the app is using "SendMessage"
rather than "PostMessage"?
// MainFrame handles menu command to initiate
void CBbMainFrame::OnTimeMessaging()
{
SendMessageToDescendants(UWM_BB_FRAME_TO_VIEW, 1, 0);
}
// View handles message and checks token value
// 20 or less is ok, hangs with 21
LRESULT CBbView::OnBbFrameToView(WPARAM token, LPARAM)
{
TRACE1("View:FrameToView %d\n", token);
if (token == 1) {
HiResTimerStart(); // Uses QueryPerformanceCounter
}
if (token < 20) {
m_pFrame->SendMessage(UWM_BB_VIEW_TO_FRAME, token, 0);
}
else {
double elapsed = HiResTimerElapsedMillis();
CString csMsg;
csMsg.Format("20 loops Token: %d elapsed: %.3f\n", token, elapsed);
AfxMessageBox(csMsg);
}
return 0;
}
// Frame handles message, increments token, and sends another message
LRESULT CBbMainFrame::OnBbViewToFrame(WPARAM token, LPARAM)
{
TRACE1("Frame:ViewToFrame Token: %d\n", token);
SendMessageToDescendants(UWM_BB_FRAME_TO_VIEW, (token+1), 0);
return 0;
}
|
|
|