|
No one knows something ?
|
|
|
|
|
I've been trying to find a webpage containing the syntax of connection strings, especially for Tab, Space, and multiple delimiters. Right now, I am trying to query a text file that is space delimited where I treat consecutive delimiters as one.
The following code snippet is from my connection string in C++ .NET
Extended Properties=\"text;HDR=Yes;FMT=Delimited(' ')\""
Do you know what the syntax should be and where I can find a page with a list of the delimiters with syntax? I have examples for csv format, but have not found other examples on google yet.
|
|
|
|
|
Have you tried www.connectionstrings.com/[^]?
I have not checked for text file connections, but that site has helped me when I can't remember connection string syntax.
|
|
|
|
|
Yes, I already have checked connectionstrings.com. They have examples with Tab, semi-colon, and comma. I have not gotten a space delimiter to work however.
|
|
|
|
|
I want to save variable Values to a file and start another application when unhandled error occurs.
Does anyone has any idea?
Regards Mahdi Ghiasi
|
|
|
|
|
mahdigh wrote: Does anyone has any idea?
About what exactly?
Writing things to a file shouldn't be much of a problem. There's an event[^] that's triggered when an unhandled exception occurs. Starting an application is done via Proces.Start [^].
That about covers it, I guess
I are Troll
|
|
|
|
|
Where is Proces.Start in VB?
Mahdi Ghiasi
|
|
|
|
|
mahdigh wrote: Where is Proces.Start in VB?
In VB.NET you'll find it in the diagnostics namespace.
If you're using VB6, then there won't be a namespace. You'd use the built-in Shell function, or call the CreateProcess [^] API.
Hope this helps
I are Troll
|
|
|
|
|
Where is diagnostics namespace in VB.NET?
Mahdi Ghiasi
|
|
|
|
|
It's under the System namespace. You can call it like this;
System.Diagnostics.Process.Start(@"c:\Them_Variables_Be_Here.txt")
That would open the file in the application that's associated with text-files, which defaults to Notepad. A more elaborate example can be found on MSDN[^].
Enjoy
I are Troll
|
|
|
|
|
Hi,
I am trying to create an application in VB.net which requires the user to enter some information into a form as soon as he unlocks his system, i am able to popup the form as soon as the user unlocks, however it allows the user to access the desktop, can anybody help me to create a form that will allow the user to access the desktop only after closing the form
Thanks for any help in this regards.
|
|
|
|
|
System modal dialogs disappeared with the rise of Windows NT. System-modal only applied to Windows 98 and below.
Let me say it this way. Microsoft removed support for system modal dialogs in Win32. That means they are no longer possible in Windows NT, 2000, XP, Vista, 7, ...
|
|
|
|
|
Hi Dave,
Thanks for ur reply...
If u notice the Windows XP shutdown/logoff dialog, these are modal to the system.
Is there anyway we can replicate this into our applications or maybe an alternative suggestion...
|
|
|
|
|
dileep2009 wrote: If u notice the Windows XP shutdown/logoff dialog, these are modal to the system.
No, they are not. They are dialogs shown on entirely seperate desktops from the one the user normally sees.
dileep2009 wrote: Is there anyway we can replicate this into our applications or maybe an alternative suggestion...
Learn how WindowStations and Desktops work, here[^].
Oh, BTW, there is no support for this stuff native in the .NET Framework. You'll have to P/Invoke all the functions yourself.
|
|
|
|
|
Dave,
Appreciate your help...
i am able to create a new desktop and show a msgbox onto it, however i am unable to show a form in the new desktop, the form is displayed in the original desktop.
below is the code i am using ...
(this is working wonderfully....)
<DllImport("user32.dll")> _
Private Shared Function CreateDesktop(ByVal lpszDesktop As String, ByVal lpszDevice As IntPtr, ByVal pDevmode As IntPtr, ByVal dwFlags As Integer, ByVal dwDesiredAccess As Integer, ByVal lpsa As IntPtr) As IntPtr
End Function
<DllImport("user32.dll")> _
Public Shared Function SetThreadDesktop(ByVal hDesktop As IntPtr) As Boolean
End Function
<DllImport("user32.dll")> _
Public Shared Function GetThreadDesktop(ByVal dwThreadId As Integer) As IntPtr
End Function
<DllImport("kernel32.dll")> _
Public Shared Function GetCurrentThreadId() As Integer
End Function
<DllImport("user32.dll")> _
Public Shared Function SwitchDesktop(ByVal hDesktop As IntPtr) As Boolean
End Function
'desktop
Public Const DESKTOP_CREATEWINDOW As Integer = &H2
Public Const DESKTOP_ENUMERATE As Integer = &H40
Public Const DESKTOP_WRITEOBJECTS As Integer = &H80
Public Const DESKTOP_SWITCHDESKTOP As Integer = &H100
Public Const DESKTOP_CREATEMENU As Integer = &H4
Public Const DESKTOP_HOOKCONTROL As Integer = &H8
Public Const DESKTOP_READOBJECTS As Integer = &H1
Public Const DESKTOP_JOURNALRECORD As Integer = &H10
Public Const DESKTOP_JOURNALPLAYBACK As Integer = &H20
Public Const AccessRights As Integer = DESKTOP_CREATEWINDOW Or DESKTOP_SWITCHDESKTOP
Public Const MB_SERVICE_NOTIFICATION As UInteger = &H200000
Private Sub CreateNewDesktop()
'Get the current desktop
Dim _hOrigDesktop As IntPtr = GetThreadDesktop(GetCurrentThreadId())
'create our desktop
Dim _hNewDesktop As IntPtr = CreateDesktop("MyDesktop", IntPtr.Zero, IntPtr.Zero, 0, AccessRights, IntPtr.Zero)
' set the thread desktop
SetThreadDesktop(_hNewDesktop)
SwitchDesktop(_hNewDesktop)
'MessageBox.Show("test", "test", MessageBoxButtons.OK, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2, MessageBoxOptions.ServiceNotification)
Form2.showdialog() 'this is not shown in the new desktop
SwitchDesktop(_hOrigDesktop)
SetThreadDesktop(_hOrigDesktop)
End Sub
is there something i am missing out...Also is there a way to get all the processes in the original desktop to the new desktop just to imitate the original one..
|
|
|
|
|
SwitchDesktop only shows the new Desktop. This does not put new windows you create on the new Desktop. For that to happen, you have to close ALL other windows your app created, call SetThreadDesktop (properly), then create the new window. When the window is dismissed, you can reverse this process to set the desktop back to the users normal desktop.
The call to SetThreadDesktop WILL FAIL if your app has ANY windows or hooks in place on the user desktop when you call it.
|
|
|
|
|
Hi Dave,
I am somewhat able to show the form properly on the new desktop.....i just used a different thread to execute the new desktop procedure....
However there are a few glitches...
1). i am unable to move/drag the form
2). the close button on the form is automatically disabled
|
|
|
|
|
dileep2009 wrote: .....i just used a different thread to execute the new desktop procedure....
Not a good idea. Creating forms off of the initial UI thread (start up thread of your app) will result is funky things happening to your form. At least, I'm assuming you're creating the form on a different thread.
|
|
|
|
|
Hi Dave,
Now i hv a different thought in my mind, can i create a form, take a snapshot of the desktop and set it as its background image, maximize it to the screen width, height(after hiding the caption bar), and then show a modal dialog on top of it....
Am i sounding weird or will this help to some extent....?
(or may be instead of the desktop image, can i make the parent form 100% transparent...?)
|
|
|
|
|
If you're talking about scrapping the alternate desktop concept, you could do what you descrbie, but it is easily defeatable. All the user has to do is hit Alt-Tab to get around your app and see whatever app they want, or they could just hit Ctrl-Shift-Esc to launch Task Manager and end your app without you being able to prevent it.
|
|
|
|
|
If you're 'securing' the computer, then I got some bad news - it's not actually securing anything. If your specs demand it, then take a look into a writing your own credential provider or your own gina-stub.
May I ask what it is that you are trying to achieve with this code? I'm not asking what you're trying to achieve technically, but rather the functionality that you're after.
I are still stuck @lvl 74
|
|
|
|
|
Hi Eddy,
its basically not to secure the system, but i just want the user to access the desktop only after entering some information (basically its an employee utilization tracker, so when the user has locked his system for a while, he/she needs to provide justification before accessing his/her usual applications).
|
|
|
|
|
Unless you replace the logon-logic, you'll find people bypassing the form. As for the justification, I'd go for "I work here, how about you?" every single time
I are Troll
|
|
|
|
|
Eddy,
i hope the user of my application doesnt read ur justification....
if i can create a transparent form, maximize it to the height and width of the screen and then show a modal dialog, will it serve my purpose....?
|
|
|
|
|
Nope. People can just get around it quite easily.
|
|
|
|