|
I am afraid you have to use interop services.
See this thread on Google.
From what I read in MSDN, you'll have to call the WIN32 API SHGetDesktopFolder() to retrieve the IShellFolder interface, then use either a direct cast to (IShellLinkObject) or use IShellFolder::GetUIObjectOf(...).
Once you've got the IShellLinkObject, you can use the Path method call to set the path, but to do the Save it is a little harder : cast this interface to (IPersistFile) than you'll gain access to the Save method.
I know this ain't easy because the parameters passed need marshaling, but I hope the thread on Google provides you all you need,
PS : I believe the fact you can not directly create a ShellLinkObjectClass instance is due to bad tlbimp from .Net. This is not the first bug, this is not the last either I am fraid....
And I swallow a small raisin.
|
|
|
|
|
But I think ShellLinkObjectClass should be created.
I'm amumu, and you?
|
|
|
|
|
I believe this object fails to be created because of a wrong interop class factory. I guess that, instead of using low-level interop -which is definitely the way to go when you are stuck-, there is a solution by explicitely asking the .Net framework to create a factory for us :
Marshal.CreateWrapperOfType(o, typeof(Shell32.ShellLinkObjectClass)); or Marshal.CreateWrapperOfType(o, typeof(IShellLinkObject));
Try to get a working sample about that,
And I swallow a small raisin.
|
|
|
|
|
As far as I am aware, u cannot use unmanaged classes in C#. You will need to create a wrapper around a return object. But like Stephane said, find an example.
StephaneRodriguez wrote:
Marshal.CreateWrapperOfType(o, typeof(Shell32.ShellLinkObjectClass)); or Marshal.CreateWrapperOfType(o, typeof(IShellLinkObject));
I dont think this will work with platform invoking, only COM interop.
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
leppie wrote:
I dont think this will work with platform invoking, only COM interop.
You're correct; but what he is doing is COM interop
James
"And we are all men; apart from the females." - Colin Davies
|
|
|
|
|
Does anyone know the best method to use to set the system time using C#? I am looking for the best way to programmatically set the time on my computer.
Thanks!
|
|
|
|
|
For this purpose I couldn't find anything more than API SetSystemTime() .Its very hard for me to use win32 API in C# but for some jobs its the only way.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
There are few suggestions i 've.
Try using "shell32" interop and
<br />
Shell32.shell app = new Shell32.shell();<br />
app.SetTime();<br />
This display the Date/Time properties..
If you still wanna change it programmatically , you cxan try running the time system command by creating a Process.
<br />
Process myProcess = new Process();<br />
ProcessStartInfo myProcessStartInfo = new ProcessStartInfo("time" "3");<br />
myProcess.StartInfo = myProcessStartInfo.UseShellExecute;<br />
myProcess.Start();<br />
Ragavendran Vaidhyanadhan
|
|
|
|
|
I run "time" but there is no such a file.Could you tell me the name of file that is for Date/Time property?
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Mazdak wrote:
I run "time" but there is no such a file
Hi
Here, "Time " refers to the internal system built command. Try creating a temp file called "time.bat" and write "time 2:45" into it ( just like how you specify the time command in the command line .. ) and use the file to create the startupinfo.
I am sure it will work.
Ragavendran Vaidhyanadhan
|
|
|
|
|
Thanks, guys... I will try these ideas.
|
|
|
|
|
How does one add an MFC style HTMLView control to a C# form? It seems it would be one of the basic controls included in the toolbox... Thank you in advance...
|
|
|
|
|
|
Guys,
I was trying to connect to DB2 using ODBC with no luck?
Can any one give me a working code to connect to AS400 DB2 using ODBC.
Example :
ODBC Name : AS400ODBC
Connect using : TCPIP
IP Address: 171.25.254.12
AS400 Library: DB2LIB
AS400 DB2 File: DB2OBJ
User ID: OPRUSER
Password: florida
Many Thanks,
Jassim Rahma
Jassim Rahma
|
|
|
|
|
I'm trying to make a custom installer. Is there some property of the OpenFileDialog that will let the user select a directory instead of a file? Or do I have to use a treeview to do this?
Any help would be greatly appreciated.
|
|
|
|
|
|
Okay, I must be an idiot. Isn't the point of a hashtable fast retrieval of objects based on their key? Cause I can't find any Get method for the Hashtable object in the .NET framework. The only examples in MSDN and on the web show the developer iterating or enumerating through the table, which pretty much defeats the whole purpose of using a Hashtable. Can anyone point me in the right direction?
|
|
|
|
|
object myStoredObject = myHashTable[myKey];
James
"And we are all men; apart from the females." - Colin Davies
|
|
|
|
|
Sweet, thanks. I had no idea it was indexed like this.
|
|
|
|
|
No problem, its not obvious at first; basically if you see in the documentation that a collection has an Items property then you access it like an array in C#.
James
"And we are all men; apart from the females." - Colin Davies
|
|
|
|
|
who to communicate with a process.lets say there are a number of components on its main window how to pass messages to them,who to passs data to their edit boxes and text areas.
who to get its mainwindow hawndle i tried to get its hwndle like that
Process tmpProcess;
..
tmpProcess.start();
tmpProcess.WaitForInputIdle();
IntPtr hWnd=tmpProcess.MainWindowHandle;
HWND t_hwnd=(HWND)hWnd.ToInt32();
but thats not its main window handle because when i get its rectangle its points are not correct.
what to do if i want to have processes mainwindow hwnd?
i also want to get process main window new handle when its window changes after some processing how to get it?
is there any other way to communicate with process ?
plz provide the helping metrial and related links for that?
i will be very thank full to u.
r00d0034@yahoo.com
|
|
|
|
|
First of all, I'm not an expert on data access. But in my trials and tribulations with ADO.Net and ADO I've yet to find a way to update a database without it using SQL to do its work. It seems to me that if I have a large recordset that I create which I want to add to a database, it should be doable without the overhead of converting to SQL and then having the DBMS unconvert it on its side. Is this possible with ADO.Net, and if so, how?
Let's say that I have a simple table in the database with 200 double-precision floating point fields. If at some point, I have 4,000 rows to add to the table (6,400,000 bytes of data) how can I add this data to the database as efficiently as possible? It seems to me that converting everything to a text command in SQL when I already have the data formatted as a 4000x200 table is inefficient.
|
|
|
|
|
Convert everything to a text file and use the BCP (bulk copy) utility. This is the fastest way to upload to a SQL Server database (in reasonable servers, I got about 100,000 rows/second).
The second fastest way, much slower, but much more flexible is using DTS.
Concussus surgo.
When struck I rise.
|
|
|
|
|
I was just thinking : how I can get the file structure for any software? for example if I want to read Lotus Notes nsf files, Brio Explorer, etc. Is there a way to discover how the file structure was built?
Jassim Rahma
|
|
|
|
|