|
IIRC, ToolTips are disabled along with the control. I don't know of a method to get around this.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Dear All,
I have a problem, I have a DLL that runs a Recieve Thread for USB communications. I am calling the DLL from VB 2005. It all works (openUSBComms function, and recieve data using a Callback). However When I call the closeUSBComms function from the FORM CLOSING event my program hangs.
In side the DLL, the Close Functions Sets a 'Death' Event and Waits for the Thread to terminate using WaitForSingleOject.
When I call the dll closeUSBComms funciton from a Button event say, all is well and the Thread Terminates, But when I call it from the Closing Event of the Form the WaitForSingleObject doesn't return and the Thead doesn't terminate.
Any Ideas why ?
I have access to both the VB and the DLL source code and can change either. But preferably not the DLL unless really have to.
Adrian
|
|
|
|
|
Hi Everybody,
i have created the project in VB.Net using visual Studio 2005.But when i try to run in setup file in client it asks to install .net framework 2.0.
So how to automatically intall the .net framework 2.0 at the time of run my project setup wihout user interaction
Thanks for Advance Help
|
|
|
|
|
|
HI there,
can any one suggest how to convert an image to a pdf document.I have tried the third party dll's but every one is an evolution version. please guide me on how to do it....
-regards
GRK
|
|
|
|
|
Check this[^]
/"My advice to you is to get married. If you find a good wife, you will be happy; if not, you will become a philosopher." Socrates
|
|
|
|
|
I want to have the code to explaint voices and imagines throght LAN and wireless, the Source Code is written by VB.Net. I wish to have the help, please send to email cayoaihuong84@yahoo.com
i am pham quang dan
|
|
|
|
|
I have no idea what you are asking for.
pham quang dan wrote: the code to explaint voices and imagines throght LAN and wireless
What Images and Voices?
|
|
|
|
|
Is there a way to get the radio button that is checked? i have many radio buttons and as we all know only 1 radio button can be selected all any one time. My question is how can i get the name of the radiobutton that the user select and save it into the database? wat should i type? Urgent... Thanks
|
|
|
|
|
I think the easiest way would be to create a module level string variable and assign a value to it on the radio buttons CheckChanged event, e.g.
Dim strValue As String
Private Sub radButton_CheckChanged(...) Handles radButton.CheckChanged
If radButton.Checked = True
strValue = radButton.Text 'or whatever value it is the you want
End If
End Sub
|
|
|
|
|
ok.. understood.. thanks a lot
|
|
|
|
|
u can use " foreach "
<big> foreach a as control in form1.controls<br />
if a.gettype="RadioButton" then<br />
return a.name<br />
end if<br />
next</big>
Mohamad A. Flefel
mflefel@hotmail.com
+962 79 5963865
C#.net & VB.net Developer
|
|
|
|
|
I have windows form (vb.net) in which i have webbrowser control. Now when i open up some web site at runtime in that form, i need to capture the onblur and onfocus events of my input boxes on an html form and perform custom external handling in my vb.net application. I have been able to successfully hook up a handler to the 'onclick' event, but the 'onblur' events are not working. Can anybody please tell me why is it happening?
i have picked up an input box and then attaching an evenhandler using
AddHandler CType(txt, mshtml.HTMLInputTextElementEvents2_Event).onblur, AddressOf Me.txt2_HTMLInputTextElementEvents_Event_onblur
and the correspoding handler is like this.
Private Sub txt2_HTMLInputTextElementEvents_Event_onblur(ByVal pEvtObj As mshtml.IHTMLEventObj)
.....................
........some code will go here .......
.....................
End Sub
|
|
|
|
|
I am working on a program that displays Physical, Virtual, and Combined memory amounts both in Totals and Available results, and I wish to have the options to display in "KB", "MB", or "GB". Ok, this is simple enough and I have the physical memory displaying just fine. However I am having trouble displaying the Virtual Memory properly, I know that my machine has 3072 MB set but I am getting some very wild return figures using this code:
mVirtualMemory = My.Computer.Info.TotalVirtualMemory
to display in KB I use the following method that I use for Physical Memory:
mVirtualMemory = My.Computer.Info.TotalVirtualMemory
mVirtualMemory = mVirtualMemory / 1024
Return mVirtualMemory
However I am getting this: mVirtualMemory = 8589934464
I do not understand what I am doing wrong, please help!
DB_Cooper1950
"Life is like a box of..."
|
|
|
|
|
What did you define mVirtualMemory as? What's the return type on this function you created? The value returned by TotalVirtualMemory is an Unsigned Long (ULong), or a 64-bit unsigned integer. If the types you're using are smaller, like using 32-bit Integers, you can get some unexpected results.
Public Function GetTotalVMSizeInKb() As ULong
Dim x As ULong = My.Computer.Info.TotalVirtualMemory
Return (x / 1024)
End Function
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Dave,
Thank you for your reply, below is the full Property that I used in the class.
Public ReadOnly Property VirtualMemory() As ULong
Get
mVirtualMemory = My.Computer.Info.TotalVirtualMemory
mVirtualMemory = mVirtualMemory / 1024
Return mVirtualMemory
End Get
End Property
DB_Cooper1950
"Life is like a box of..."
|
|
|
|
|
You didn't specify what mVirtualMemory was before you used it, so it defaulted to an Integer type. Change it to this and it should work:
Public ReadOnly Property VirtualMemory() As ULong
Get
Dim vVirtualMemory As ULong = My.Computer.Info.TotalVirtualMemory
Return (mVirtualMemory / 1024)
End Get
End Property
Or, you can just avoid the entire variable declaration thing altogether and do this:
Public ReadOnly Property VirtualMemory() As ULong
Get
Return (My.Computer.Info.TotalVirtualMemory / 1024)
End Get
End Property
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
<blockquote class="FQ"><div class="FQA">Dave Kreskowiak wrote:</div>You didn't specify what mVirtualMemory was before you used it, so it defaulted to an Integer type. Change it to this and it should work:</blockquote>
Dave,
Actually I did declare the variable mVirtualMemory as shown below. I just did not include this in the last entry.
...
Private mVirtualMemory As ULong
...
After that is when I used it here...
<code>
Public ReadOnly Property VirtualMemory() As ULong
Get
mVirtualMemory = My.Computer.Info.TotalVirtualMemory
mVirtualMemory = mVirtualMemory / 1024
Return mVirtualMemory
End Get
End Property
</code>
mVirtualMemory as you see is declared as a private ULong variable in the class that I wrote. So do you see anywhere else that I made a mistake?
Thank you.
DB_Cooper1950
"Life is like a box of..."
|
|
|
|
|
Nope. No other mistakes, save the only other one is your assuming you have a complete understanding of virtual memory under Windows. It's entirely possible to have this much "Virtual Memory", depending on your systems configuration. TotalVirtualMemory does NOT equal pagefile size!
Oh! And using a "global" variable like this (mVirtualMemory) is really bad practice! You're violating rules of Encapsulation and making it harder to debug your code. There is no reason, that I can see, for having that variable declared in Class scope. It should have been done inside the Property code.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Dave Kreskowiak wrote: Oh! And using a "global" variable like this (mVirtualMemory) is really bad practice! You're violating rules of Encapsulation and making it harder to debug your code. There is no reason, that I can see, for having that variable declared in Class scope. It should have been done inside the Property code.
Dave,
Please take a look at the following and then let me know that it is "Bad Practice", when the variable is used elsewhere in the class...
Public Class SystemMemory
#Region "Variables..."
Private mPhysicalMemory As Long
Private mVirtualMemory As ULong
Private mCombinedMemory As Long
Private mAvailablePhysicalMemory As Long
Private mAvailableVirtualMemory As ULong
Private mAvailableCombinedMemory As Long
Private mInstance As SystemMemory
Private mPctPhysicalMemory As Integer
Private mPctVirtualMemory As Integer
Private mPctCombinedMemory As Integer
#End Region
#Region "Constructors and Destructors..."
Public Sub New()
mInstance = Me
End Sub
Protected Overrides Sub Finalize()
mInstance = Nothing
End Sub
#End Region
#Region "Main Body in KB's..."
Public ReadOnly Property PhysicalMemory() As Long
Get
mPhysicalMemory = My.Computer.Info.TotalPhysicalMemory
mPhysicalMemory =(mPhysicalMemory / 1024)
Return mPhysicalMemory
End Get
End Property
Public ReadOnly Property VirtualMemory() As ULong
Get
mVirtualMemory = My.Computer.Info.TotalVirtualMemory
mVirtualMemory = mVirtualMemory / 1024
Return mVirtualMemory
End Get
End Property
Public ReadOnly Property CombinedMemory() As Long
Get
mCombinedMemory = (mPhysicalMemory + mVirtualMemory)
Return mCombinedMemory
End Get
End Property
....
I did not list where it is used elsewhere, but it is not just used inside the property call as the other private variables are also used elsewhere. Is is incorrect to call and use them in that manner?
DB_Cooper1950
"Life is like a box of..."
|
|
|
|
|
It is! Watch what happens when I get rid of all the class-scoped variables:
Public Class SystemMemory
' Say "Bye-Bye" to all the class-scoped variables! From what I can see in your code,
' you don't need a single one of them.
' I have no idea what you're doing with this stuff, but if the rest of this
' class is like your properties, you can get rid of this entire Region.
#Region "Constructors and Destructors..."
Public Sub New()
mInstance = Me
End Sub
Protected Overrides Sub Finalize()
mInstance = Nothing
End Sub
#End Region
#Region "Main Body in KB's..."
Public ReadOnly Property PhysicalMemory() As Long
Get
Return My.Computer.Info.TotalPhysicalMemory / 1024
End Get
End Property
Public ReadOnly Property VirtualMemory() As ULong
Get
Retrun My.Computer.Info.TotalVirtualMemory / 1024
End Get
End Property
Public ReadOnly Property CombinedMemory() As Long
' You can call your classes properties from inside
' the same class
Get
Return PhysicalMemory + VirtualMemory
End Get
End Property
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
You are absolutely correct, I could shave all of that "extra" stuff off, and have cleaner code with much less lines of code that could go wrong. But it hasn't changed the actual return value. And you are correct I am not fully versed in Virtual memory values, THAT is why I am asking for help.
Dave Baker
DB_Cooper1950
"Life is like a box of..."
|
|
|
|
|
OK. The memory functions under My.Computer.Info are actually calling a Win32 API function called GlobalMemoryStatusEx[^]. This function fills a structure called MEMORYSTATUSEX[^] that lists various measurements of the various types of memory managed by Windows, from the CURRENT PROCESSES point of view! This means that it measures memory based on your applications view of it, not the System Wide Windows view of memory! There is a HUGE difference...
When you call TotalPhysicalMemory and AvailablePhysicalMemory, you get the amount of physical memory reported by Windows, admittedly system-wide. But, this is NOT nocessarily all the physical memory in the machine. Some of it can be reserved by hardware for other functions, like shared video RAM.
Calls to TotalVirtualMemory and AvailableVirtualMemory return the status of YOUR processes virtual address space, which can be MORE than the amount of physical RAM available to Windows. You can typically have 2GB of memory available to each process, even though your machine only has say, 512MB of physical RAM.
How?? That's where the pagefile comes in. (Warning!! This explaination is very simplified!!) The pagefile is NOT virtual memory, but is a file that is used to store pages of memory that are allocated by all processes running in the system, combined. Say your machine has 512MB of RAM. The default pagefile size is 1.5x that size, or 768MB. So, if nothing is changed, Windows can have up to about 1.2GB of memory allocated acrossed all processes running in the system. But, it can only have 512MB of code and data in memory at any one time. Anything that is not being used, or the oldest memory pages that are still dirty, is swapped out to the pagefile to make room for pages that are needed.
WHen you launch your process, it gets a new virtual address space of 1.2GB. There are user-mode (for your application) and kernel-mode portions of that space. After all, you still need to be able to call into the Windows Kernel to do stuff, like open a file, and that Kernel code sits at the bottom of your VAS. Say the Kernel uses 200MB of memory. What's left, 1.0GB, is your user-mode space. This is what your application has left to allocate memory from.
Every process gets it's own virtual address space. Each process thinks that Windows and it are the only things running on the machine as far as memory goes! Each process thinks it gets about 1GB of RAM to play with, even though there is only 512MB in the system. Get it?
Now, if you called TotalVirtualMemory, it'll return something around 1GB. It only looks at the user-mode portion of your processes virtual address space, ignoring the kernel-mode portion. This is the value that your seeing in your code! I hope you can now see why there is no such thing as TotalVirtualMemory acrossed the entire system.
But, remember that pagefile size of 768MB? Well, there IS a limit to the amount of memory that can be allocated system-wide. If 2 processes tried to allocate 1GB of each, one of them would fail, even though it's address space says it can! Why?
Well, in our example, the pagefile can only hold 768MB worth of memory pages. Combined with physical memory, all the processes in the system can only allocate up to 1.2GB of memory, combined! Because of this, regardless of the virtual address space your process has, it's entirely possible that a process with a 1.2GB virtual address space can fail when it tries to allocate an object that takes 4KB of memory! Even though AvailableVirtualMemory said there was more...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Dave,
Thank you VERY much for that explaination, it makes a lot more sense to me now as to why I am not getting the exact amount of virtual memory that I thought that I was looking for. I realize that the explaination you gave was a simplified, but the point that you were trying to convey, was easier to understand that way, and for that I am grateful.
David Baker
DB_Cooper1950
"Life is like a box of..."
|
|
|
|
|
is there any control or functionality of any control that i can use to display data in hierarcal structure with multiple text boxes associated with each node? This is Very Urgent....
TC
-- modified at 9:19 Friday 27th October, 2006
|
|
|
|