|
Thank you for your reply
I have used this structure for years , but I just want to know how to declare it like C++
Now I'm using this approach
Public Class SePrivilege
Public Const SeCount As Integer = 35
Public Const SeCreateTokenPrivilege As String = "SeCreateTokenPrivilege"
Public Const SeAssignPrimaryTokenPrivilege As String = "SeAssignPrimaryTokenPrivilege"
Public Const SeLockMemoryPrivilege As String = "SeLockMemoryPrivilege"
Public Const SeIncreaseQuotaPrivilege As String = "SeIncreaseQuotaPrivilege"
Public Const SeUnsolicitedInputPrivilege As String = "SeUnsolicitedInputPrivilege"
Public Const SeMachineAccountPrivilege As String = "SeMachineAccountPrivilege"
Public Const SeTcbPrivilege As String = "SeTcbPrivilege"
Public Const SeSecurityPrivilege As String = "SeSecurityPrivilege"
Public Const SeTakeOwnershipPrivilege As String = "SeTakeOwnershipPrivilege"
Public Const SeLoadDriverPrivilege As String = "SeLoadDriverPrivilege"
Public Const SeSystemProfilePrivilege As String = "SeSystemProfilePrivilege"
Public Const SeSystemtimePrivilege As String = "SeSystemtimePrivilege"
Public Const SeProfileSingleProcessPrivilege As String = "SeProfileSingleProcessPrivilege"
Public Const SeIncreaseBasePriorityPrivilege As String = "SeIncreaseBasePriorityPrivilege"
Public Const SeCreatePagefilePrivilege As String = "SeCreatePagefilePrivilege"
Public Const SeCreatePermanentPrivilege As String = "SeCreatePermanentPrivilege"
Public Const SeBackupPrivilege As String = "SeBackupPrivilege"
Public Const SeRestorePrivilege As String = "SeRestorePrivilege"
Public Const SeShutdownPrivilege As String = "SeShutdownPrivilege"
Public Const SeDebugPrivilege As String = "SeDebugPrivilege"
Public Const SeAuditPrivilege As String = "SeAuditPrivilege"
Public Const SeSystemEnvironmentPrivilege As String = "SeSystemEnvironmentPrivilege"
Public Const SeChangeNotifyPrivilege As String = "SeChangeNotifyPrivilege"
Public Const SeRemoteShutdownPrivilege As String = "SeRemoteShutdownPrivilege"
Public Const SeUndockPrivilege As String = "SeUndockPrivilege"
Public Const SeSyncAgentPrivilege As String = "SeSyncAgentPrivilege"
Public Const SeEnableDelegationPrivilege As String = "SeEnableDelegationPrivilege"
Public Const SeManageVolumePrivilege As String = "SeManageVolumePrivilege"
Public Const SeImpersonatePrivilege As String = "SeImpersonatePrivilege"
Public Const SeCreateGlobalPrivilege As String = "SeCreateGlobalPrivilege"
Public Const SeTrustedCredManAccessPrivilege As String = "SeTrustedCredManAccessPrivilege"
Public Const SeRelabelPrivilege As String = "SeRelabelPrivilege"
Public Const SeIncreaseWorkingSetPrivilege As String = "SeIncreaseWorkingSetPrivilege"
Public Const SeTimeZonePrivilege As String = "SeTimeZonePrivilege"
Public Const SeCreateSymbolicLinkPrivilege As String = "SeCreateSymbolicLinkPrivilege"
End Class
[Flags()] Public Enum SePrivilegeAction
EnabledByDefault = 1
Enabled = 2
Removed = 4
UsedForAccess = &H80000000
End Enum
[StructLayout(LayoutKind.Sequential)] Public Structure LUID
Public LowPart As Integer
Public HighPart As Integer
Public Shared ReadOnly Zero = New LUID
Public Shared Function FromPrivilegeName(ByVal PrivilegeName As String) As LUID
Dim Luid As New [Structure].LUID()
Advapi32.LookupPrivilegeValue(Nothing, PrivilegeName, Luid)
Return Luid
End Function
End Structure
[StructLayout(LayoutKind.Sequential)] Public Structure LUIDAndAttributes
Public LUID As LUID
Public Attributes As SePrivilegeAction
End Structure
[StructLayout(LayoutKind.Sequential)] Public Structure TokenPrivileges
Public PrivilegeCount As Integer
[MarshalAs(UnmanagedType.ByValArray, SizeConst:=SePrivilege.SeCount)] Public Privileges() As LUIDAndAttributes
End Structure
It seems I can not post "<" , ">" character
|
|
|
|
|
Time is a bit short for me right now. I've got a switch/fiber problem I'm working.
In a brief "wait for the other guy" moment, I've managed to come up with this[^]. See what you can get from this example, just under half way down the page.
|
|
|
|
|
It just works
Public Declare Function AdjustTokenPrivileges Lib "advapi32.dll" (ByVal tokenhandle As IntPtr, ByVal disableprivs As Boolean, ByVal Newstate As IntPtr, ByVal bufferlength As Integer, ByVal PreivousState As TokenPrivileges, ByRef Returnlength As Integer) As Boolean
Public Class TokenPrivileges
Inherits List(Of LUIDAndAttributes)
Implements IDisposable
Dim P As IntPtr
Public Function AllocHGlobal() As IntPtr
FreeHGlobal()
P = Marshal.AllocHGlobal(Marshal.SizeOf(GetType(Integer)) + Marshal.SizeOf(GetType(LUIDAndAttributes)) * Count)
Dim P2 As IntPtr = P
Marshal.WriteInt32(P2, 0, Count)
P2 = Sum(P2, Marshal.SizeOf(Count.GetType))
For Each LUIDAndAttributes As LUIDAndAttributes In Me
Marshal.StructureToPtr(LUIDAndAttributes, P2, False)
P2 = Sum(P2, Marshal.SizeOf(LUIDAndAttributes.GetType))
Next
Return P
End Function
Public Sub FreeHGlobal()
If P <> IntPtr.Zero Then
Marshal.FreeHGlobal(P)
P = IntPtr.Zero
End If
End Sub
End Class
Public Shared Function Sum(ByVal P As IntPtr, ByVal I As Integer) As IntPtr
If IntPtr.Size = 4 Then
Return New IntPtr(P.ToInt32 + I)
Else
Return New IntPtr(P.ToInt64 + I)
End If
End Function
|
|
|
|
|
I wish I had the time to play around around with the code myself.
Glad it works for you though!
|
|
|
|
|
Morning guys.
I need help with moving buttons.I need to have a button on a form move as soon as the mouse curser moves across it.
Please help guys.Thank you in advance.
kagiso
|
|
|
|
|
look at the mouseenter and mousleave events
and the top, left property's
when mouseenter --> change top,left property's
when mouseleave --> stop the change
hope this helps
If my help was helpfull let me know, if not let me know why.
The only way we learn is by making mistakes.
|
|
|
|
|
Will sure try it and let yu knw.Thanx for the assistance.
Anymore suggestions guys??
kagiso
|
|
|
|
|
You've been given the only correct answer, why are you asking for more suggestions ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
matjame wrote: Anymore suggestions guys?
No. The one you were already given is pretty much it.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Im creating 1 software ......
it is subject to internet connection.
there r following componants.....
FOrm1
button1
lable1
....................................
Now following things i want to do...
when we will click button1 , it will check that computer is connected to internet or not.
If it is connected , lable1 will be renamed as Yes
if it is not , lable1 will be renamed as No.
Plzz help me .. i searched on the internet for this coding but i failed..
plz help me
|
|
|
|
|
ankur0101 wrote: i searched on the internet for this coding but i failed..
There's about 1,600,000 answers to that ubiquitous question, here[^]. All you have to is type "vb.net is internet connected" into Yahoo or Google.
|
|
|
|
|
I am working on a project called Image Editor.
Now I am in beginning stage
It has three forms
1. Image Editor (MDI Form1, ismdi container=true)
2. Image (Form2) 3.Resolution (Form3)
I have added a Menu bar and there is File Menu on it.
File Menu has five submenus as following
1. New (opens a new window)
2. Open (open the image)
3. Save (saves the image)
4. Close (closes the active window)
5. Exit (exits the main application)
I want to do some changes in it, these are follows
1. When I click on new there should be dialogue appear (Resolution Form)
In it I can set height and width of form and then I click on OK,new window should open according to these setting. And the caption of new form (image form) should change as Image1,image2 and so on.
2. When I click on open it should load the image into the form (Image Form) what resolution image has.
It should load the form in active window(i.e. image1).If there is no open window already then it should load the image in new window(i.e. Image1).If there is new window already(i.e. image1,image2) but non of them is active then it should also open a new window and load the image in it.(i.e. Image1,image2)
3. When I click on close menu, it should close the active window .for example image1 window.
Also I have added a Panel on the Image Form and set it dock property to fill.
And I have added a Picture Box and I have loaded a Picture through property box.
Now my code can scroll and pan an image on the form.
My Code till now as follow
VB.Net 2005
Public Class ImageForm
Private m_PanStartPoint As New Point
Private Sub ImageForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'Panel Settings
Panel1.AutoScroll = True
'Picture Box Settings
pb1.SizeMode = PictureBoxSizeMode.AutoSize
End Sub
Private Sub pb1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles pb1.MouseDown
'Capture the initial point
m_PanStartPoint = New Point(e.X, e.Y)
End Sub
Private Sub pb1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles pb1.MouseMove
'Verify Left Button is pressed while the mouse is moving
If e.Button = Windows.Forms.MouseButtons.Left Then
'Here we get the change in coordinates.
Dim DeltaX As Integer = (m_PanStartPoint.X - e.X)
Dim DeltaY As Integer = (m_PanStartPoint.Y - e.Y)
'Then we set the new autoscroll position.
'ALWAYS pass positive integers to the panels autoScrollPosition method
Panel1.AutoScrollPosition = New Drawing.Point((DeltaX - Panel1.AutoScrollPosition.X), (DeltaY - Panel1.AutoScrollPosition.Y))
End If
End Sub
End Class
Help me in designing my project as I want
Code is according to vb.net2005
Thanks
Aamir Mustafa
|
|
|
|
|
Aamir Mustafa wrote: 1. When I click on new there should be dialogue appear (Resolution Form)
In it I can set height and width of form and then I click on OK,new window should open according to these setting. And the caption of new form (image form) should change as Image1,image2 and so on.
So create a form that asks for this information. If your code that starts creating a new document, create a new instance of this form and show it using ShowDialog. The user enters the details and clicks OK. You then get the data from that form and pass it along to the method that creates a new document.
Aamir Mustafa wrote: 2. When I click on open it should load the image into the form (Image Form) what resolution image has.
It should load the form in active window(i.e. image1).If there is no open window already then it should load the image in new window(i.e. Image1).If there is new window already(i.e. image1,image2) but non of them is active then it should also open a new window and load the image in it.(i.e. Image1,image2)
So what's the problem??
Aamir Mustafa wrote: 3. When I click on close menu, it should close the active window .for example image1 window.
If you're using an MDI layout, then the currently active child form will be in the MdiParent form's ActiveMdiChild property.
Now that I get to the bottom of your post, I see that you don't have much experience with designing an application, let alone designing a moderately complex one like this. You've got a LOT of learning to do, and you're not going to get it from a bunch of forum posts. You're asking a bunch of questions on how to implement very basic functionality, like putting up a small form to ask for resolution values and tracking windows you have open. These are things that you should already know how to do before moving on to implementing actual drawing on a form.
|
|
|
|
|
like the subject saying,i understand the principle of the reverse index,but how can you create it?can i use the VB.NET to do it?please give me some advice.thank u.
|
|
|
|
|
What do you mean?? This is something you do to a database table and support for it depends on the database. Access doesn't support it. A better place to ask would be the SQL Forum.
|
|
|
|
|
How can I change the width of the datagrid column at run time?
Binding Datatable with datagrid.
Using vb.net 2003
Thanks In Advance
|
|
|
|
|
Here's[^] a good faq on the old DataGrid. It has snippets for about a hundred different DataGrid modications.
|
|
|
|
|
Learn about datagrid column styles. It is easy to change the width using
ColumnStyle.Width = ###
Salman Sheikh
|
|
|
|
|
Hi All
Require a program using VB.NET 2003 that i can use to consume a web service to soap or wsdl and 1 client server but must be cross platform VB and JAVA for instance.
Thank You
|
|
|
|
|
You've come to a good site for that. Have you looked around for articles?
kendo17 wrote: must be cross platform VB and JAVA for instance.
They are two different languages and platforms, good luck. You will have to have some kind of communication bridge between the two. Probably through sockets and listeners.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
yes done a tutorial on google ap but was only with vb.net. require something else it seems to be that the tutorials are mostly in c sharp or c++ still looking for another to try.
I am hoping for the best got 3 weeks to do it.
|
|
|
|
|
|
Hi,
I found some code to create DSN programmatically and thought of developing a tool to download data from SQL server to Excel. The main need of this tool is to develop an application which accepts SQL query at runtime instead of embedding the query in the code itself.
The application works fine for simple queries like 'select * from XYZ'.I am getting the output in Excel sheet for the above query. but if i give complex queries, i'm geting only the column names in the excel not the data. The complex query works fine and gives output in SQL query analyzer.
could you please help me?
thanks
Guru
|
|
|
|
|
i like to attach the application here..but i cudnt attach...how can i attach that application?
thanks
guur
|
|
|
|
|
selvarajaguru wrote: how can i attach that application?
Nobody would be willing to open an unknown .exe anyways. So don't even bother.
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|