|
Hello,
I have come across a strange behaviour.
I typed the following code:
<br />
[DllImport("urlmon.dll",CharSet=CharSet.Auto)]<br />
public static extern uint URLDownloadToFile(<br />
IntPtr pCaller,<br />
string szURL,<br />
string szFileName,<br />
uint dwReserved,<br />
IntPtr lpfnCB);<br />
<br />
string URL="http://www.boursorama.com";<br />
URLDownloadToFile(IntPtr.Zero,URL,"c:\test.html",0,IntPtr.Zero);<br />
When I run it (using the debugger), the function doesn't seems to send back an error and the function seems actually to work but I get no local file ! I even looked at the HTTP requests and I can see the HTTP GET issued and the 200 OK response.
I don't understand and I need UrlDownloadToFile (WebClient doesn't work with the IE cache).
I'm using the 1.1 framework on Windows 2000 Professionnal.
Thanks,
R. LOPES
Just programmer.
|
|
|
|
|
GriffonRL wrote:
"c:\test.html"
Have you tried "c:\\test.html"? The double backslash is needed to escape the \, other wise you wind up with \t which is the tab character.
James
"I despise the city and much prefer being where a traffic jam means a line-up at McDonald's"
Me when telling a friend why I wouldn't want to live with him
|
|
|
|
|
try @"c:\test.html" instead. The @ character means a string literal with no escape sequences.
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
Hello,
Thanks for answering but look at that:
URLDownloadToFile(IntPtr.Zero,"http://www.kimo.com.tw",@"c:\test1.htm",0,IntPtr.Zero);
<-- create the file
URLDownloadToFile(IntPtr.Zero,"http://www.yahoo.com",@"c:\test2.htm",0,IntPtr.Zero);
<-- create the file
URLDownloadToFile(IntPtr.Zero,"http://www.boursorama.com",@"c:\test3.htm",0,IntPtr.Zero); <-- doesn't create the file
Any idea ? Try by yourself.
R. LOPES
Just programmer.
|
|
|
|
|
Hello,
Thanks for answering but look at that:
URLDownloadToFile(IntPtr.Zero,"http://www.kimo.com.tw",@"c:\test1.htm",0,IntPtr.Zero);
<-- create the file
URLDownloadToFile(IntPtr.Zero,"http://www.yahoo.com",@"c:\test2.htm",0,IntPtr.Zero);
<-- create the file
URLDownloadToFile(IntPtr.Zero,"http://www.boursorama.com",@"c:\test3.htm",0,IntPtr.Zero); <-- doesn't create the file
Any idea ? Try by yourself.
R. LOPES
Just programmer.
|
|
|
|
|
Hello,
I have been playing a lot with the WebBrowser control past weeks and I successfully implemented the IDocHostUIHandler interface with it.
I'm now turning my focus to the InternetExplorer object. But I'm starting wondering if the IDocHostUIHandler interface works with this object. Until now I have got error when trying to cast the document object of the InternetExplorer object into a ICustomDoc object. The cast is invalid.
Is it possible to use the IDocHostUIHandler interface with the InternetExplorer object ? And if so, how to do it if I can't use the ICustomDoc interface to set the UI handler.
Thanks,
R. LOPES
Just programmer.
|
|
|
|
|
I was wondering what is the best way to implement a timer for my pong-type game.
|
|
|
|
|
I have a namespace with two classes in it: one class is for methods to work on the application(eg windows media encoder stuff, buttons and the like). The other class contains methods which are used by another application to remotly control this application. I want one class to call a method in the other class, and to do this it seems that i need to make the "called" class' method static. when i do this the comboboxs need an object reference. I tried making them static but i then when i ran the application, the boxes were not filled with what they should be filled with!!!
I dont know how to get round this problem!
Im sure ive made the description as clear as mud!!!
Any help would be much appreciated as i need this problem solved asap!
Thanks
Stevieb
stevb@hotmail.com
"I think im going mad,Ted!"
|
|
|
|
|
stevb wrote:
Im sure ive made the description as clear as mud!!!
yes
but FWIW you can't call static methods remotly if that's what you are trying to do.
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
Hi,
I'm creating a client/server business application using .net remoting. I want this program to be dynamic and extensible, this way i dont have to adapt the program with every minor change. So i was trying to create a module/plugin like architecture. Somehow my program doesn't work fine, let me explain it in some details:
-The server has a remote singleton factory, the client uses an interface to contact it.
-The client requests its own SessionObject via the server factory, this SessionObject is defined by an interface. First problem: the interface needs to be compiled into one assembly, so i have to make a shared assembly which i dislike.
-The client then request a, serializable, object which contains references to modules inherited from MarshalByRefObject (these modules contain business logic). This is the second problem, again i need to compile the interfaces of these modules into one shared assembly, that means that i need to recompile the server and client with a reference to the interfaces.
So because of all these shared assemblies my application doesn't become very dynamic.
Any tips?
|
|
|
|
|
tarmin wrote:
Hi,
I'm creating a client/server business application using .net remoting. I want this program to be dynamic and extensible, this way i dont have to adapt the program with every minor change. So i was trying to create a module/plugin like architecture. Somehow my program doesn't work fine, let me explain it in some details:
-The server has a remote singleton factory, the client uses an interface to contact it.
-The client requests its own SessionObject via the server factory, this SessionObject is defined by an interface. First problem: the interface needs to be compiled into one assembly, so i have to make a shared assembly which i dislike.
-The client then request a, serializable, object which contains references to modules inherited from MarshalByRefObject (these modules contain business logic). This is the second problem, again i need to compile the interfaces of these modules into one shared assembly, that means that i need to recompile the server and client with a reference to the interfaces.
So because of all these shared assemblies my application doesn't become very dynamic.
If I understood correctly, basically what you have is an interface, but you don't want to enforce compile-time interface implementation, because this would lead to deployment problems.
The only solution I see* to a plugin model like that is calling the method by its name as a string (see Type.InvokeMember), using Reflection. Obviously, this leads to some relaxation in compile-time checking, but, as long as your interface is not too complex, you won't run into trouble.
[edit]By the "only solution I see" I am assuming you already have investigated the possibility of proper version management and it does not solve your problem.[/edit]
My latest article: GBVB - Converting VB.NET code to C#
|
|
|
|
|
Tarmin,
I might come across a bit simplistic etc here but I don't really see your problem. The point of interfaces are that they define an "immutable contract of service" between the client object and the server object. The idea being that so long as the interfaces stay the same the underlying implementations can change with theoretically no breakage to the system. If you need to add more functionality to the system not covered by the interface, you create a NEW interface and don't break the old one.
In this respect having an assembly which contains only interfaces is actually a good idea as it is a central place to define the contracts by which the parts of your system communicate.
Shaun: C# and .NET Evangelist to the known world.... well... the UK at least...
|
|
|
|
|
I had a nice and refreshing sleep, it made me realize that you guys are right about the concept of interfaces. Besides i found some nice tricks with reflection to make things more dynamic!
Thanks guys!
|
|
|
|
|
How can I fullfil the xml information for a enumerated type?
CODE_________________________________________________
public enum SegmentationTypes {SingleFrame = 1, FixedSize = 2, BottumUp = 3, Cumulation = 4, ShotDetection= 5, MedianIncremental = 6, Filtering = 7};
END CODE______________________________________________
When I insert the "///" I just get the summary field, and during compilin I get an error: "Missing XML comment for publicly visible type or member SegmentationTypes.SingleFrame" for every type in my enumerated type
Some suggestions?
|
|
|
|
|
You should put the individual items on a separate line then stick comments over each enumeration. You said "errors"... do you have "Treat warnings as errors" enabled? Is this something most people are doing nowadays???
Apologies for code layout...
public enum SegmentationTypes
{
SingleFrame = 1,
FixedSize = 2,
BottumUp = 3,
Cumulation = 4,
ShotDetection= 5,
MedianIncremental= 6,
Filtering= 7
};
Shaun: C# and .NET Evangelist to the known world.... well... the UK at least...
|
|
|
|
|
Hi.
im creating a control from scratch , inheriting from windows.forms.control
i want to be able to bind this control to a datasource , eg a datatable , iList etc
the data from the datasouce will be painted in the controls onpaint in a grid'ish way.
the problem is that since an ilist and a datatable have almost nothing incommon , so how would i go about to read data from the underlying datasource w/o breaking my neck??
do i have to implement special code to read data from each databindable type/interface?
or is there any form of support for this in the .net framework???
ive found some classes that _seems_ to have something to do whith this , BindingManagerBase and BindingContext , but i might be way wrong here?
can i somehow use one of those or any other class to extract data in the same way w/o having to care about what underlying object is bound to my control???
//Roger
|
|
|
|
|
You will need to use Complex Binding, since you said you are going to display the results in a grid’ish way. Most complex bindings are set to the Data Source property directly, as opposed to using a Binding Object to the DataBindings Collection. This is how the DataGrid does it.
You did not say if you were supplying your own data source or not. If you supply your own Data source, you will have to implement the Ilist and Icomponent interfaces. Does this help?
david23g
|
|
|
|
|
Have you checked out listcontrol and currencymanager classes?
Bo Hunter
|
|
|
|
|
Hi Everyone
I want to set share permissions which are "Fullcontrol","change" and "read" through code. But I can't find any c# classes for this. I can set all the security options using ActiveDs but I can not set any share level permissions.
Can anyone please help me?
Ashish
|
|
|
|
|
ok, so I have this....
private void Form1_Load(object sender, System.EventArgs e)
{
Process [] localByName = System.Diagnostics.Process.GetProcessesByName("notepad.exe");
}
So, first things first. From what I understand, the variable localByName (assuming it is a varible, and if it is what kind?) is storing the data from what ever "GetProcessesByName" returns, correct? If so what kind of data is it returing? A sting? A bool?
/\ |_ E X E GG
|
|
|
|
|
It is a variable and it is returning an array of Process objects.
You can access a Process object from the array like this:
Process p = localByName[0];
You can loop through the array like this
for(int i=0;i<localByName.GetLowerBound(0);i++)
{
}
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
hi,
how can i dequeue object from a Queue when the elements type of the queue is a structer?
for example, i use the following code to Enqueue the object 'new_object' which type is ABCD :
ABCD new_object=new ABCD();
MyQueue.Enqueue (new_object);
how to Dequeue?
this method doesn't work:
ABCD another_object=new ABCD();
another_object=MyQueue.Dequeue ();
any help?
|
|
|
|
|
sultan_mu wrote:
MyQueue.Dequeue ();
Dequeue() returns an object, so you need to cast back to the original object type.
another_object = (ABCD) MyQueue.Dequeue();
James
"I despise the city and much prefer being where a traffic jam means a line-up at McDonald's"
Me when telling a friend why I wouldn't want to live with him
|
|
|
|
|
Thank u James..
now it's work!.
|
|
|
|
|
How can we get the DHTML object model as we do using IWebBrowser2 & IPersistStreamInit in COM?
Regards,
(a.k.a. Wal2k) www.wal2k.com
|
|
|
|
|