|
RK,
The link tells you about a function "ExitWindowsEx" Lib "User32" , If you set parameter to FORCE, I think it can not be stopped using shutdown -a. ( I have tried it once and failed as system gets shutdown quickly )
Also I have tried by creating a batch file as following:
shutdown -f
shutdown -a
Still my system logged off.
So i think ExitWindwsEx with FORCED parameter is function for you.
Mithun Shitole
"Free Your Mind"
http://www.technoyaari.com
|
|
|
|
|
I am using the InitiateSystemShutdown function and am forcing the shut down still a person with admin rights on the m/c is able to abort the shut down using shutdown -a command.
so any help here.
|
|
|
|
|
Try setting the timeout parameter to 0.
Mithun Shitole
"Free Your Mind"
http://www.technoyaari.com
|
|
|
|
|
No , we have to dispaly the message to user some 5 mins before so that he can save the changes, so we can not put the timeout parameter as 0.
|
|
|
|
|
In that case, you have a few options, none of them in code.
Remove the admin rights from the user
Remove the shutdown.exe from the machine
Add shutdown.exe to the list of forbidden executables using group policy
|
|
|
|
|
Hi Dave, Thanks for your reply but we can not implement the above suggestions as the some user need the admin rights on their m/c and also the exe file has to run on each individuals m/c so that it can shut their PC at a particular time. Any other suggestion then pls do let me know.
|
|
|
|
|
Stupid suggestion but how about when you run your shutdown function rename shutdown.exe to shutdown.exe.bak or something so they can't run shutdown.exe with any parameters..
|
|
|
|
|
Than you just ruled out every option you have to preventing the users from aborting the shutdown.
You're only other option how is to threaten people with termination for violating company policy.
|
|
|
|
|
Then I think you have to write your own daemon so that you can connect to it, n call a routine which will show a shutdown timer , and on time up call a forced shutdown with 0 time inerval.
Mithun Shitole
"Free Your Mind"
http://www.technoyaari.com
|
|
|
|
|
True. A little extreme for the problem at hand, but then again, they did themselves in with the poorly designed environment and policies.
BTW: You may want to reply to the OP and not me. He's has no idea you posted this message because he didn't get the email that you posted to mine.
|
|
|
|
|
Thanks Dave,
I am new to cp and was unaware of this cool feature.
Mithun Shitole
"Free Your Mind"
http://www.technoyaari.com
|
|
|
|
|
Hi,
I am developing an application using vs 2008 and vb.net.
There are 4 projects in my solution which uses a same DLL created in vb6.
Now when I compile the solution each time my reference to dll gets lost in each project. ( I have added separate reference to each project). How can I overcome this problem? Is there any better way of adding reference in my case?
Mithun Shitole
"Free Your Mind"
http://www.technoyaari.com
modified on Tuesday, June 16, 2009 1:57 AM
|
|
|
|
|
I assume it's a COM dll, if not, you actually can't add references to it. I am not sure if you can p/invoke it ( as a better way )
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
I have resolved the issue using regsvr32. I register that dll and added references from COM reference.
Thanks for your help.
Mithun Shitole
"Free Your Mind"
http://www.technoyaari.com
|
|
|
|
|
If you are just building the VB6 project without selecting binary compatability, you are opening up a whole continent of hurt for later.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Thanks Nagy,
I was completely unaware of "binary compatible" thing.
Mithun Shitole
"Free Your Mind"
http://www.technoyaari.com
|
|
|
|
|
I am working in Vb Express 2008 with MsAccess as database.
Please advise code for transfer of data records from ListView to a table in MsAccess. ListView shows like this:
FirstName LastName City
Peter Anderson NewYork
John Pierce Lansdale
|
|
|
|
|
The same as doing it with a collection of strings or any other source. You supply the code to write one record at a time to the database, then just call it repeatedly for each string or other data you have.
There a TONS of examples all over the web on how to work with databases in VB.NET. Google results for "vb.net write data to database[^]"
|
|
|
|
|
thanks for your reply.
i tried the sites you suggested but there is code for vb only. i could not find code for vb express.
please adivse.
|
|
|
|
|
There is no difference between the two. The language is the same.
|
|
|
|
|
I'm trying to detect if my ATL control is installed on the users system in IE8. There seems to be a functional difference between the two implementations below. The first always returns "true" (even if control is uninstalled), while the second seems to detect the case where my control is not installed, however it raises IE8 security prompts ("Are you sure you want to run this control?"). Ideally, I just want to know if the control is installed or not so i can prompt a download if needed. Can anyone help?
function DetectActiveX (controlName)
on error resume next
dim res
res = 0
if IsObject(CreateObject(controlName)) then
res = 1
end if
DetectActiveX = res
end function
function DetectActiveX (controlName)
on error resume next
dim tControl
dim res
res = 0
set tControl = CreateObject(controlName)
if IsObject(tControl) then
res = 1
end if
DetectActiveX = res
end function
I know about the codebase attribute, but I don't want to use it as testing has proven its very slow to refresh after install.
Thanks,
Chris
|
|
|
|
|
How about checking for an error, not an object, after you try and create it?
On Error Resume Next
Set tControl = CreateObject(controlName)
If Err.Number <> 0 Then
' Your control probably isn't installed...
End If
|
|
|
|
|
Hi,
Thanks for your reply. I tried your err.Number suggestion. However, I get error #429 "activeX component can't create object" both when the control is not installed and when the control is installed but IE8 hasn't "approved" it to run yet.
My concern is that the end user will see two infobar prompts, one to download the installer and one to Run the control, when in-fact they may have already downloaded and installed the control via another browser/process.
I'm looking for a way to detect the difference between these two cases so i don't prompt for a download every time.
Thanks,
Chris
|
|
|
|
|
In that case, you'd probably want the Web Development forum.
|
|
|
|
|
Any help in general would be appreciated, I need to build a control array at run time, so as an example I can do something like this
Private Sub createlblSlotArray()
Dim i As Short
ReDim lblSlot(3)
For i = 1 To 3
lblSlot(i) = New System.Windows.Forms.Label
With lblSlot(i)
.Tag = i
AddHandler .Click, AddressOf Me.lblSlot_click
End With
Next
Me.Controls.AddRange(lblSlot)
lblSlot(1).Location = New System.Drawing.Point(50, 50)
lblSlot(2).Location = New System.Drawing.Point(100, 70)
lblSlot(3).Location = New System.Drawing.Point(100, 90)
End Sub
I need to add a popup menu to each of these labels, when the user right clicks on a label, I need to know which one the right click was on, set a variable so it can be used later, then show the context menu.
would I use the form1_click?
Private Sub Form1_Click(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label1.MouseDown
' what to do here to get the label? this seems to be tied to only the first label?
End Sub
can you show me an example of how to handle events from a control array of this nature, also, if I do not know how many context menu items I will have until run time, so I am not sure how to do that, the popup menu click event appear to be tied to the exact item that was selected.
Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem1.Click
' this is OK for menu item 1, how do I deal with new items I may add at run time?
End Sub
thanks in advance
No-e
|
|
|
|