|
Please find below my definitions. When stepping into some of these
interfaces from C++ client the code either works, crashes or steps into the
wrong functions. Any ideas?
<br />
[<br />
StructLayout(LayoutKind.Sequential)<br />
]<br />
public struct _GUID<br />
{<br />
public uint x;<br />
public ushort s1;<br />
public ushort s2;<br />
<br />
[MarshalAs(UnmanagedType.ByValArray, SizeConst=8)]<br />
public byte[] c;<br />
}<br />
<br />
[<br />
StructLayout(LayoutKind.Sequential)<br />
]<br />
public struct _FILETIME<br />
{<br />
public uint dwLowDateTime;<br />
public uint dwHighDateTime;<br />
}<br />
<br />
[<br />
StructLayout(LayoutKind.Sequential)<br />
]<br />
public struct tagSTATSTG<br />
{<br />
[MarshalAs(UnmanagedType.LPWStr)]<br />
public string pwcsName;<br />
public uint type;<br />
public _ULARGE_INTEGER cbSize;<br />
public _FILETIME mtime;<br />
public _FILETIME ctime;<br />
public _FILETIME atime;<br />
public uint grfMode;<br />
public uint grfLocksSupported;<br />
public _GUID clsid;<br />
public uint grfStateBits;<br />
public uint reserved;<br />
}<br />
<br />
[<br />
InterfaceType(ComInterfaceType.InterfaceIsIUnknown),<br />
Guid("0c733a30-2a1c-11ce-ade5-00aa0044773d")<br />
]<br />
public interface ISequentialStream<br />
{<br />
void Read(out byte pv, uint cb, out uint pcbRead);<br />
<br />
void Write(out byte pv, uint cb, out uint pcbWritten);<br />
}<br />
<br />
[<br />
InterfaceType(ComInterfaceType.InterfaceIsIUnknown),<br />
Guid("0000000C-0000-0000-C000-000000000046")<br />
]<br />
public interface IStream : ISequentialStream<br />
{<br />
void Seek(_LARGE_INTEGER dlibMove, uint dwOrigin, out _ULARGE_INTEGER<br />
plibNewPosition);<br />
<br />
void SetSize(_ULARGE_INTEGER libNewSize);<br />
<br />
void CopyTo(IStream pstm, _ULARGE_INTEGER cb, out _ULARGE_INTEGER pcbRead,<br />
out _ULARGE_INTEGER pcbWritten);<br />
<br />
void Commit(uint grfCommitFlags);<br />
<br />
void Revert();<br />
<br />
void LockRegion(_ULARGE_INTEGER libOffset, _ULARGE_INTEGER cb, uint<br />
dwLockType);<br />
<br />
void UnlockRegion(_ULARGE_INTEGER libOffset, _ULARGE_INTEGER cb, uint<br />
dwLockType);<br />
<br />
void Stat(out tagSTATSTG pstatstg, uint grfStatFlag);<br />
<br />
void Clone(out IStream ppstm);<br />
}<br />
<br />
[<br />
InterfaceType(ComInterfaceType.InterfaceIsIUnknown),<br />
Guid("0000010C-0000-0000-C000-000000000046")<br />
]<br />
public interface IPersist<br />
{<br />
void GetClassID(out _GUID a);<br />
}<br />
<br />
[<br />
StructLayout(LayoutKind.Sequential)<br />
]<br />
public struct _ULARGE_INTEGER<br />
{<br />
public ulong QuadPart;<br />
}<br />
<br />
[<br />
StructLayout(LayoutKind.Sequential)<br />
]<br />
public struct _LARGE_INTEGER<br />
{<br />
public long QuadPart;<br />
}<br />
<br />
[<br />
InterfaceType(ComInterfaceType.InterfaceIsIUnknown),<br />
Guid("00000109-0000-0000-C000-000000000046")<br />
]<br />
public interface IPersistStream : IPersist<br />
{<br />
[PreserveSig()]<br />
int IsDirty();<br />
<br />
void Load(IStream Stm);<br />
<br />
void Save(IStream Stm, int ClearDirty);<br />
<br />
void GetSizeMax(out _ULARGE_INTEGER Size);<br />
}<br />
<br />
[<br />
ProgId("ICRMMC.IcrSnapin"),<br />
Guid("43C8177A-2392-419F-9156-34D24FE22319"),<br />
ClassInterface(ClassInterfaceType.None)<br />
]<br />
public class IcrSnapin : IPersistStream<br />
{<br />
public IcrSnapin()<br />
{<br />
}<br />
<br />
public void GetClassID(out _GUID a)<br />
{<br />
a.x = 0x43C8177A;<br />
a.s1 = 0x2392;<br />
a.s2 = 0x419F;<br />
a.c = new Byte [] {0x91, 0x56, 0x34, 0xD2, 0x4F, 0xE2, 0x23, 0x19};<br />
}<br />
<br />
public int IsDirty()<br />
{<br />
return 1;<br />
}<br />
<br />
public void Load(IStream Stm)<br />
{<br />
}<br />
<br />
public void Save(IStream Stm, int ClearDirty)<br />
{<br />
}<br />
<br />
public void GetSizeMax(out _ULARGE_INTEGER Size)<br />
{<br />
Size.QuadPart = 1234;<br />
}<br />
<br />
}<br />
|
|
|
|
|
I want to paste from my app into Notepad.
I am doing a straightforward
Clipboard.SetDataObject(stringValue, true)
and then when I look into Notepad, paste is disabled (as is copy/cut). I can cut and paste to and from other apps with notepad, no problem. What am I missing?
Sincerely,
Lindsay
|
|
|
|
|
The stringValue wasn't. So, since I'd not done anything with setting a DataProvider, I'm assuming that if the object type is not "well known", then you get nothing.
Sincerely,
Lindsay
|
|
|
|
|
Hi, is there a way to have a server run button jump to an anchor in the page?
Im having trouble getting request.redirect(...) to work, because just adding currenturl+#myanchorname doesnt seem to work. I dont want to use a link, becuase i want them to enter text in a box and then do a search, where it jumps to the anchor based on the text in the box.
if anyone has dont this before it be alot of help
thanks
steve
|
|
|
|
|
in c++ when i would serialize an object i would always put a version as the second string serialized.. then when i deserialized i would read that version and read in the rest of the data based on what version the file was, in case variables had been added/removed between that version and the current version.
how does C# handle this? it seems like it serializes and deserializes in its own way.. how do i handle multiple versions of an object when serializing?
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
dazinith wrote:
how does C# handle this?
Very poorly IMHO.
If the structure/class has changed between versions then you will get an exception thrown when it tries to deserialize the object.
There is currently a problem if you serialized a Hashtable in version 1.0 of the framework and try to deserialize that Hashtable in version 1.1. The cause is that MS added a new member to the Hashtable in the new version.
I do not know what would happen if you implement ISerializable to do as you mentioned (storing a Version object and have your deserialization code from ISerializable use that Version object to read back the correct data). Perhaps this would make a good article
dazinith wrote:
still a newb.. cut me some slack
We all were at one time or another
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
I have an mdi application where the parent window is split into two areas (left and right side). The left side is the navigation area and is part of the parent window. Every time a user clicks on one of the link labels on the left a new window appears on the right. But I can not get the child form to maximize to the designated work area. Does any one have any ideas on how to do this? Many thanks.
|
|
|
|
|
can we make a label or linkLabel Transparent? like we do with the forms?
sorry for my bad English.
|
|
|
|
|
You english is fine.
Maybe you can set the background color to transparent, or opacity percentage. I'm not sure....but that may be something to check.
There are only 10 types of people in this world....those that understand binary, and those that do not.
|
|
|
|
|
I am currently writing a DLL which will import records. I have an abstract class from which I have created a number of child classes. In the abstract base class I have declared the delegate and event as follows, which is basically to tell the calling client when a record has been imported:
public delegate void BtEventHandler();<br />
public event BtEventHandler RecordImported;
But when I place the following in the function of the child class that imports some data like so:
if ( RecordImported != null )<br />
{ <br />
RecordImported();<br />
}
I get the following compilation error:
... can only appear on the left hand side or += or -= (except when used from within the type [myBaseClass]
Is it possible to declare an event within a base abstract class and raise the events back to the calling client? If so what do I do? If not surely I don't have to put the same event in every child class!!!
|
|
|
|
|
You need to declare a protected virtual method called OnEventName in the base class, which raises the event. Derived classes can then call this method to raise the event, or override it to intercept the event.
Also, Event handler delegates should always take two arguments - an object and a class derived from EventArgs .
For example:
public abstract class MyBaseClass
{
public delegate void BtEventHandler(object sender, EventArgs e);
public event BtEventHandler RecordImported;
protected virtual void OnRecordImported(EventArgs e)
{
if (null != RecordImported)
{
try
{
RecordImported(this, e);
}
catch
{
}
}
}
}
public class MyDerivedClass : MyBaseClass
{
public void ImportRecord()
{
OnRecordImported(EventArgs.Empty);
}
protected override void OnRecordImported(EventArgs e)
{
Console.WriteLine("Intercepted the RecordImported event");
base.OnRecordImported(e);
}
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
|
|
|
|
|
I have c# dll. How can I know when it is loaded and unloaded by application. My application can be in any like C#,vb.net,vb,excel etc.
|
|
|
|
|
I have a trouble with my pretty big DataTable with 400 columns. Suddenly adding these columns becames very slow (5min instead of 0,5s). May be someone know what's happend?
DataTable is empty while adding, has primary key and view sort defined and initially 6 columns. It contains to DataSet with some tables with data and have no relations. I don't remember any change in this part of code but this may be Alzheimer.
Hi,
AW
|
|
|
|
|
Solved. If DataTable is displayed in DataGrid time to modify it is terribly long
Hi,
AW
|
|
|
|
|
Hi all,
i've got a really irritating problem that is probably something very simple but is driving me crazy for some time now. I have a form with a tab control containing several tab pages. On each tab page there is a panel. On the panels i have some graphics and several combo boxes at different locations. the panels are also scrollable.
My problem is every time i click on a combo box that is not in view before scrolling down the form seems to invalidate itself and redraw so that the drop down list of the combo box is in the center of the screen. Is there some property which i've missed that can be set to avoid this????
Basically when i click on a combo box i want it to display the drop down list at the location its currently at and not redraw the whole form so its centered.
Any advice is VERY welcome,
Thanks
Paul
Paul Griffin
|
|
|
|
|
well looking at the following code :
[System.Runtime.InteropServices.DllImport("kernel32")]<br />
private static extern int Beep(int dwFreq, int dwDuration);
the code above..is typicall...but i guess my question here is how do i know what in the world i can import from kernel32 or other system dlls.....and how do i know the overloads for the things that im importing. is there documents that list that information anywhere ?
Thanks alot.
Jesse M.
The Code Project Is Your Friend...
|
|
|
|
|
If you use the Dependancy Walker that came with the Platform SDK, you can see some stuff, but most API functions are listed in MSDN, so just do a search for something that you want to do, and see what native features pop up.
Dependancy walker lets you see what other dll's are being referenced so its good for finding functions that are not in the 'right' dll.
"If you just say porn then you get all manner of chaff and low grade stuff." - Paul Watson, Lounge 25 Mar 03 "If a man is standing in the middle of the forest speaking and there is no woman around to hear him, is he still wrong?" - Anon
Jonathan 'nonny' Newman
Homepage [www.nonny.com] [^]
|
|
|
|
|
Now I have never write a spider program,Can you give me some help?
Thanks for your help!
|
|
|
|
|
avoid cross-posting!
I was born intelligent Education ruined me!.
|
|
|
|
|
ok
|
|
|
|
|
Search for "stoub" on GotDotNet user samples. He is a MS employee that has done an excellent one.
Hey leppie! Your "proof" seems brilliant and absurd at the same time. - Vikram Punathambekar 28 Apr '03
|
|
|
|
|
Thank you!
by the way,his name is toub,not stoub.
|
|
|
|
|
Hello,
Problem 1:
I wonder if you could use (how) dll made in delphi in C#.
Problem 2:
How do you make dll in C# and use this dll in Delphi, C++ ...
Is this posible?
I'm made dll with delphi and open it with Dependency walker. I can see my functions.
But if I made "dll" with C# (you know: New project; ClassLibrary...),
I can't see nothing. So I think that this dll is not real dll.
How can I make "real" dll in C# : you know like dll in delphi
function Something(a, b : integer) : integer; stdcall;
begin
Result:= a+ b;
end;
exports Something;
Thank you for answers,
have a nice day,
Anze
|
|
|
|
|
This may help
http://www.csharphelp.com/archives/archive52.html
All I need is a roadmap and then I might be able to find a clue.
|
|
|
|
|
Thank you for this link..
Anze
|
|
|
|