|
You can run these code with a separate Thread.
|
|
|
|
|
If the event isn't exposed to you but is only handled internally in the code, you can't handle the event. You'll never see it.
Otherwise, you'll need the signature of the event handler that the code is expecting you to implement. After that, it's a simple matter of writing the event handler and wiring it to the event using the AddHandler statement.
|
|
|
|
|
I'm trying to implement IShellExtInit:Initialize using VB 2005 and have been able to successfully handle the IDataObject, but I'm at a loss as to how to handle the LPCITEMIDLIST. What I really need is a simple function (or a walkthrough) to convert a LPCITEMIDLIST to a path.
While there are some great resources out there if you know C++ (I know very little), I have yet to find this answer for VB programmers. Any help is appreciated!
Thanks,
-Tom
modified on Tuesday, September 9, 2008 4:26 PM
|
|
|
|
|
Tom,
You may have seen this page, Visual Basic Shell Programming[^], but about midway down it says:
Consider the first parameter of the Initialize method, which is an LPCITEMIDLIST. The documentation for the interface states that this is an address of an ITEMIDLIST.
Did you try casting it as an IntPtr ? A further down, there is ByVal pidlFolder As VBShellLib.LPCITEMIDLIST , which sounds like what you want. I believe this[^]is the source for that library. I'd figure a compiled version is out there somewhere, too.
Maybe not helpful, but maybe it will be.
|
|
|
|
|
Yes, I've got all this information and, in fact, own the book! However, beyond getting the pointer, I can find nothing that helps me understand what to do with the ITEMIDLIST - that's the heart of this question.
The JZ wrote: You may have seen this page, Visual Basic Shell Programming[^], but about midway down it says:
Consider the first parameter of the Initialize method, which is an LPCITEMIDLIST. The documentation for the interface states that this is an address of an ITEMIDLIST.
Did you try casting it as an IntPtr? A further down, there is ByVal pidlFolder As VBShellLib.LPCITEMIDLIST, which sounds like what you want. I believe this[^]is the source for that library. I'd figure a compiled version is out there somewhere, too.
Thanks,
-Tom
|
|
|
|
|
Ah, right in front of me the whole time! The answer for all interested is the SHGetPathFromIDList API function.
Thanks,
-Tom
|
|
|
|
|
Hello All,
How do I convert the following C# code to VB.net:
( e.State & DrawItemState.Focus ) == 0,
box.CheckState ? CheckBoxState.CheckedNormal :
CheckBoxState.UncheckedNormal )
Thank You.
|
|
|
|
|
|
Mika,
I understand that it would translate to :
IF e.state & drawitemstate.focus = 0 then
checkboxstate = checkednormal
else
checkboxstate = uncheckednormal
but I need to pass in the checked state as a parameter and it is expecting a statement where I cannot have an IF statement.
Thanks
|
|
|
|
|
I don't quite follow. I would have believed that e was referring to event arguments passed to an event handler and that State would have been a property for the argument instance.
Or is the problem that in C# & is AND operator and if I remember correctly, in VB & means concatenation?
|
|
|
|
|
Mika,
The whole statement in C# is like this:
CheckBoxRenderer.DrawCheckBox(
e.Graphics,
new Point( e.Bounds.X, e.Bounds.Y ),
e.Bounds,
box.Text,
this.Font,
( e.State & DrawItemState.Focus ) == 0,
box.CheckState ? CheckBoxState.CheckedNormal :
CheckBoxState.UncheckedNormal )
Thanks
|
|
|
|
|
|
ByVal e As DrawItemEventArgs
|
|
|
|
|
Okay, break the statement into pieces:
- define a variable of type VisualStyles.CheckBoxState
- assign a value to it using If block
- pass the variable to CheckBoxRenderer.DrawCheckBox method as state parameter
|
|
|
|
|
Running this through http://codeconverter.sharpdevelop.net/SnippetConverter.aspx[^] produces:
CheckBoxRenderer.DrawCheckBox(e.Graphics, _
New Point(e.Bounds.X, e.Bounds.Y), _
e.Bounds, box.Text, Me.Font, _
(e.State And DrawItemState.Focus) = 0, _
If(box.CheckState, CheckBoxState.CheckedNormal, CheckBoxState.UncheckedNormal))
The usage of "If" inside expressions is new in VB9 (VS08), for older versions, use IIf or split it into two statements.
|
|
|
|
|
Have you tried looking at code converters through a google search? SharpDevelop had a good one a while back, you may want to look at it.
http://codeconverter.sharpdevelop.net/[^] is the one I used before. It is helpful
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
I have wrote below code for creating Text file and then after storing line by line value in Text File.
If Not System.IO.File.Exists(strFileName) Then
Dim fs As FileStream = File.Create(strFileName)
fs.Flush()
fs.Close()
End If
Dim ObjFile As StreamWriter
ObjFile = File.AppendText(strFileName)
ObjFile.WriteLine(Now() & "---" & strStatus & "---"&strErrMsg)
ObjFile.Flush()
ObjFile.Close()
My problem is while i am running my autoprocess in server it gives me error like "The process cannot access the file XYZ.txt because it is being used by another process"
What is wrong in this code as i had close file as well object also.
Thanks.
|
|
|
|
|
First, you can comment out the file creation since it is created if it doesn't exists. After that do you still have the problem?
Mika
|
|
|
|
|
I did not get you but i had change by code with below lines
SWObj = New StreamWriter(strFile, True)
SWObj.WriteLine(rno )
SWObj.Flush()
SWObj.Close()
And i commented lines which creating File.
Thanks
|
|
|
|
|
What I meant is that the documentation for AppendText says:
Remarks: This method is equivalent to the StreamWriter(String, Boolean) constructor overload. If the file specified by path does not exist, it is created. If the file does exist, write operations to the StreamWriter append text to the file
So you don't need to create the file. The following code is enough:
Dim ObjFile As StreamWriter
ObjFile = File.AppendText(strFileName) <------- File is created if necessary
ObjFile.WriteLine(Now() & "---" & strStatus & "---"&strErrMsg)
ObjFile.Flush()
ObjFile.Close()
Did this get the problem solved?
Mika
|
|
|
|
|
Yea, Thanks you so much...Appreciate you help..
|
|
|
|
|
|
Hello Experts!!
I am creating 2 datasets after retreiving infromation from excel sheet, now i want to store these datasets in a sql database.
any ideas how to get this done?
Thanks in Advance!!
|
|
|
|
|
Anything you tried??
"If you had to identify, in one word, the reason why the human race has not achieved, and never will achieve, its full potential, that word would be 'meetings'." - Dave Barry
|
|
|
|
|
I tried sqlbulkcopy and doesnt look good for me...
|
|
|
|