|
www.vbaccelerator.com and check out the icons section
|
|
|
|
|
How can you detect Windows events like when Windows shuts down?
|
|
|
|
|
Here's one possible starting point:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconsubscribingtoandconsumingmanagementevents.asp
|
|
|
|
|
I've got a bunch of check boxes that all do the same piece of code except for one word. If the check box is checked they run:
command = "net send " checkbox.caption & txtBox.text
the checkbox.caption needs to equal the caption of the check box if it's checked.
I was thinking about using control arrays and doing something like this:
For Each value In Checkbox(x)
command = "net send " checkbox.caption & txtBox.text
Next
HELP
|
|
|
|
|
If you absolutely have to store your commands in the Caption property of your checkboxes, you could do something like this:
For i = 1 To Check1().UBound + 1
Debug.Print Check1(i - 1).Caption & ":" & CStr(Check1(i - 1).Value)
If Check1(i -1).Value = 1 Then
commandLine = "net send " & Check1(i - 1).Caption
End If
Next
|
|
|
|
|
I have a VB.net Application ,whenever i click on the EXE a new instance of the application runs .But i want one instance to run at a time .That means if the exe is already running by clicking on it it should show the message that it is already running.
Similar case for loading forms.suppose i have a button ,clicking on it a form is comes up ,if i click on the button several instance of the same form is running ,how to get rid of this that means there must be one instance of a form at a time.
Please help me its urgent
|
|
|
|
|
Use a Mutex - so you are going to have to look at the Win32 API.
Have a look at CreateMutex - to make a named Mutex. You can only create a Mutex once across processes, so the if a second instance launches and tries to create it, there will be an error, which can be caught. So you would put this routine in the start up code.
Shameless Plug - Distributed Database Transactions in .NET using COM+
|
|
|
|
|
See my reply to the original message. There is a System.Threading.Mutex class available in the Fx.
|
|
|
|
|
|
Interesting questions! For the single app instance, try using a Mutex:
Sub Main()
Dim M1 As System.Threading.Mutex
Dim createdNew As Boolean = False
M1 = New System.Threading.Mutex(True, "MyUniqueMutexName", createdNew)
If createdNew = False Then
MsgBox("Other process is running")
Return
End If
Application.Run(New Form1())
End Sub
For single form intance, this is a bit of a hack, but it works. The problem with maintaining a member-level ref to a form occurs after the form has been closed. At this point the form is disposed, but we have no way of determining the disposed state by examining the ref (that I know of). My hack catches an ObjectDisposedException as a way of determining the disposed state. You could also subclass Form, override Dispose(bool) and provide an IsDisposed property.
' Member-level reference
Private _Form2 As Form2
...
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If _Form2 Is Nothing Then _Form2 = New Form2()
Try
_Form2.Show()
_Form2.BringToFront()
Catch ex As ObjectDisposedException
_Form2 = New Form2()
_Form2.Show()
End Try
End Sub
|
|
|
|
|
thanx CBoland
Its great and working as per my expectation.
Thanx a lot
Pradipta
|
|
|
|
|
This will work for detecting an instance of the application already running.
If (UBound(Diagnostics.Process.GetProcessesByName(Diagnostics.Process.GetCurrentProcess.ProcessName)) > 0) Then<br />
'//End The App Or Whatever You Want To Do Here<br />
End If<br />
|
|
|
|
|
Hello all,
How can I retreive the long file name form a short file name in VB6 in WinNT 4.0. Using GetLongPathName won't do as this is Win2000 and above API.
Thanks in advance
Alberto Gattegno
Software Engineer
http://www.itgil.com
|
|
|
|
|
Good people,
How do I set the “Comment” attribute of a file or folder using VB script ?
For example, the following code lists “Comment” attributes for files under C:\ directory:
set shell = CreateObject("Shell.Application")
set folder = shell.namespace("C:\")
for each folderitem in folder.items
list = list & _
folder.GetDetailsOf(folderitem , 0) & ", " & _
folder.GetDetailsOf(0, 5) & ": " & _
folder.GetDetailsOf(folderitem, 5) & vbCr
next
MsgBox list
Thanks,
Serge
|
|
|
|
|
Hello!
I'm have an Access database (mdb) with table 'Table' with 2 columns (fields): 'fieldA' and 'fieldB' (for example).
The question is how to add new column (field) 'fieldC' progamatically (when my program is running).
I'm use OleDB to open this database.
If you know how to do this - please answer (please with example). May be I'm must use AboDB (not good for me) or AdoDX or something else.
Thank you!
Code
|
|
|
|
|
I have a .NET DLL that contains two forms. This DLL works great from windows applications. But when I make a windows service that references the DLL the forms do not show, the form code executes without any errors but no forms are displayed. Does anyone know how to get this to work?
|
|
|
|
|
I could be mistaken on this, but normally a service does not have any user interface, and the service framework may, in fact, prohibit any UI from displaying properly... though I would expect it throw an error in that case. If you want to run the code as a service, separate the UI and the logic into separate assemblies, then use the UI as an observer of the state of the service?
|
|
|
|
|
OK. In general:
Windows Services run in their own Windows sessions. What does this mean? Well, when you login to Windows, you start your own session. Services do the same thing. They get their own Window Station, Desktop, Environment, and such. This means that the user interface your app is putting is showing up, but it's on a desktop that you can't see.
There is no way to view the session of a service! Services cannot interact with the user session directly (or easily.) But, it IS possible to write a service that interacts with the users desktop. Your going to have to supply the service with the logged on users security context, station handle, and desktop handle, at a minimum. Hint: Your going to have to write a seperate app that runs on the user side and communicates with the service via RPC to do this.
Information on how this works (and why) can be found in the Platform SDK documentation. Just search for "Window Stations" (no S on the end of Window) on MSDN for a good starting point.
RageInTheMachine9532
|
|
|
|
|
Thanks for the info. I am going to check out Remoting via RPC and see how this works.
|
|
|
|
|
I want to know when I use the IE to open the url,some pop window run at once! I hope to close them. i want close it before showing!
please give some info about the IE process ,How can i get the command about "Open.window"!
|
|
|
|
|
please give me more information about it! thank you!
|
|
|
|
|
I would set my ActiveX class as SafeForScripting and SafeForInitializing.
Thank you very much!
|
|
|
|
|
how can i use a varible in a shell command; so the shell executes net send dell (my input)?
dim message as string
message = txtMsg.text
Shell ("net send dell" message)
HELP
|
|
|
|
|
Something like this maybe?
Dim sendString As String
Dim varData As String
varData = "Hello world!"
sendString = "net send dell" & varData
Shell(sendString)
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
|
|
|
|
|
Ray Cassick wrote:
sendString = "net send dell" & varData
You need to specify a space here
"dell "
Your friendly neighbourhood typo police!
Notorious SMC
The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning
Mark Twain
Get your facts first, and then you can distort them as much as you please
Mark Twain
|
|
|
|