|
If you opt to receive notification messages when you're replied to, they aren't lost. And unlike IRC, all threads are archived and accessible for several years here on CodeProject. If you need real-time communicae, then it means you're not planning ahead researching your project before you start. If you need answers immediately, you didn't plan ahead.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Bah! =P
It's still think it's nice to talk to a person in real time, discussing program related things =)
I'm not saying anything is bad here, I love this site =)
~~~~~~~~~~~~~~
Martin Lundberg
Student, Sweden
I have to thank every member of the Code Project for making it such a great place for a beginner to learn!
|
|
|
|
|
|
Word?
~~~~~~~~~~~~~~
Martin Lundberg
Student, Sweden
I have to thank every member of the Code Project for making it such a great place for a beginner to learn!
|
|
|
|
|
|
Hi,
I'm have problem with api functions in C#.I want to call API function to retreive listview information such as itemtext, item position... I use function SendMessage to get it but it doesn't work.
//API function :
//#define TreeView_GetItem(hwnd, pitem) \
// (BOOL)SNDMSG((hwnd), TVM_GETITEM, 0, (LPARAM)(TV_ITEM *)(pitem))
and my code in C# is :
public const int LVM_GETITEM =(LVM_FIRST + 75);//unicode
[DllImport("user32", CharSet = CharSet.Auto)]
public extern static int SendMessage(
IntPtr hWnd,
int wMsg,
long wParam,
ref LVITEM lParam);
//with LVITEM is the struct of ITEM in ListView :
unsafe struct LVITEM
{
public uint mask;
public int iItem;
public int iSubItem;
public uint state;
public uint stateMask;
public string pszText;
public int cchTextMax;
public int iImage;
public long lParam;
//public int iIndent;
public int iGroupId;
public uint cColumns; // tile view columns
public uint* puColumns;
} ;
Please show me anything wrong in my struct LVITEM ???
Thank you.
NTHEVU
|
|
|
|
|
Why are you even P/Invoking anything? What you want is already possible using the ListView class and the ListViewItem class. The ListViewItem.Text property gets the text of the ListViewItem , which you can get by enumerating through the ListView.Items or using ListView.SelectedItems or something similar. If you want a particular item's region, then you can use ListView.GetItemRect , which can retrieve information about several parts of a ListViewItem .
Besides, you don't need an unsafe context and your SendMessage declaration is wrong. The wParam should be an IntPtr since it will be 32 bits on a 32-bit OS and 64 bits on a 64-bit OS (which is dependent on the processor). The last member of your struct should also be just an IntPtr .
Seriously, though, don't waste your time doing this. Everything you're trying to do according to your post is easy using what's provided in the .NET FCL (namely, the System.Windows.Forms.dll assembly).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi and thank you for your answer. I know C# have class ListView with many function to manage my code but i want to use API function to retrieve listview information form the difference application. So i choose API, because i don't know how to retreive listview information in other application. So if you experience in this case, please help me.
Ah, IntPtr type have error when i try to convert or cast to String or other common Type in API structture such as LVITEM, LVFINDINFO ...
NTHEVU
|
|
|
|
|
You can't simply cast a string to and from an IntPtr . You need to use the Marshal class methods, such as Marshal.PtrToStringAuto . If you're looking for these signatures and not sure what you're doing, I recommend you take a look at http://pinvoke.net[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thank you so much, i learn much from your instruction
thankx, NTHEVU
|
|
|
|
|
I wanna know, wich files i have to upload.
Only the Server.asmx? or Server.dll ?
or Server.asmx and Server.asmx.cs...
and how i use this DLL?
Thanks.
|
|
|
|
|
If you want to modify the code, you'll need the Server.asmx.cs, if you just want to reference the dll in a project, then use Server.dll.
Could you be more specific in what you are trying to do? The question is a bit vague.
R.Bischoff
.NET, Kommst du mit?
|
|
|
|
|
If you're doing this in VS.NET, just click on the Copy Project button at the top of the Solution Explorer when your project is selected. It asks which you want to copy. Typically in a deployment scenario you just copy files necessary for the application to run. This would be the Server.asmx file and the Server.dll file, which either goes into the bin sub-directory of the application root directory (/, /myapp, whatever) or the Global Assembly Cache (GAC) making it easily accessible for web applications that require it and easy to version (since the GAC stores all versions of an assembly that you install in it, unless of course you were to remove certain versions).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi all,
It's my first time to join this site. I having a problem with my program. It deals with huge amout of input. My input size is 15 MB which causes a low in virtual memory...
The program is about to search for a certain pattern in this input text. I'm using the Boyer moore pattern matching algorithm, so i have to load the whole file when started.
Is there a way or an algorithm to divide this file or something?
Thank you all.
yomna
|
|
|
|
|
If the algorithm requires that the whole file be read in (and frankly, I've never seen such an algorithm but it's true that I'm not familiar with the Boyer-Moore pattern), then you should find a new algorithm. Still, though, it may work if you buffer your file in a particular way.
Buffering the file reads in blocks at a time (commonly 4K, but it can be anything). If the algorithm allows for partial matches, for example, then you know you should keep the previous buffer (or at least part of it), read-in the next buffer, and join the two together to complete the entire match (if it does match).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
I want to sign my application and the assemblies that it use, so I know it has not been tampered with when it runs
Right now there are a binary crack for my application, and I thought I might make it a bit harder for the crackers by signing my assemblies...
So I read in MSDN about signing my assemblies with a strong name, but then I read that all the assemblies that the application calls need to be signed with the same private key...
This is a problem as I'm exposing a plug-in interface where people can make plug-in that the application loads at runtime.
If my program is signed with a strong name, does that mean that the plug-in's need to be signed with the same private key?
If it does it makes the whole strong-name thingy useless for me, as no one can develop plug-in's then...
Anyone out there that know more about this than me who can fill me in on it?
- Anders
Money talks, but all mine ever says is "Goodbye!"
ShotKeeper, my Photo Album / Organizer Application[^]My Photos[^]
|
|
|
|
|
But when a user make a plug-in he makes it in a separate dll, and MSDN states that an assembly with a strong name can only load other assemblies that are signed with the same private key...
Or have I got something wrong...
- Anders
Money talks, but all mine ever says is "Goodbye!"
ShotKeeper, my Photo Album / Organizer Application[^]My Photos[^]
|
|
|
|
|
If I sign an assembly using signcode.exe (and yes, I have a personal certificate ) is there any way to check if the program is signed when it loads?
That way the program could check that it is signed itself (and not has been changed) and that all the dll's also are signed with my certificate and not tampered with, but ignore the plug-in's...
Is that possible, ot just a bad idea?
- Anders
Money talks, but all mine ever says is "Goodbye!"
ShotKeeper, my Photo Album / Organizer Application[^]My Photos[^]
|
|
|
|
|
Anders,
After doing just a little reading on MSDN, you could invoke the Certificate Verification Tool (Chktrust.exe) with a Process object which should which will extract the X.509 certificate and with the /q flag you could read the result; Succeeded or Failed. There is probably a much better way with Reflection, this would require more research. HTH
- Nick Parker My Blog | My Articles
|
|
|
|
|
Actually, you can use code access security to state that your assembly must be signed with an X.509 certificate or that your application will only load assemblies signed with your certificate. The CLR will make sure that it hasn't been tampered with.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
Let say that you only wanted your assembly loaded if it was signed with your X.509 certificate, you'd add the assembly-level attribute:
[assembly: PublisherIdentityPermission(SecurityAction.RequestMinimum,
X509Certificate="hex-encoded value of your certificate")] If you wanted only plugins to be able to call a method if it was signed with the certificate, attribute your method like so:
[PublisherIdentityPermission(SecurityAction.Demand,
X509Certificate="same thing")]
public void MyMethod()
{
} There's a lot of information about code access security in the .NET Framework SDK that will explain more, as well as a pretty decent (but long) article here on CP, Understanding .NET Code Access Security[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Of course, just use sn.exe -k KeyFile.snk to create one, and you could even put it into a user or machine store using sn.exe -i KeyFile.snk MyContainerName, using the path (project-relative or absolute) in the AssemblyKeyFileAttribute in the former case, and AssemblyKeyNameAttribute in the latter case.
As far as plugins, they do not need to use the same key unless you use code access security to state that plugins must use the same key (not a good idea). Think about this: in your .config file there's several sections where you can specify a type (like in .NET Remoting config sections or system.net config sections) and they load into your application (though typically in these cases you don't load them directly).
Signing an assembly not only identifies the assembly but provides a level of security as you've discovered, such as determining when the file has been tampered with (the CLR takes care of this) or by using CAS to determine what assemblies to trust.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
I read some tutorials about scrren capture with C#.
I need a way to draw rectangle selection over whole screen ?
I am able to draw rectangle selection inside my form (application), but I want to draw rectangle selection acros whole screen area (over all active windows, outside my form) to select screen area for capturing ?
How to do rectangle drawing outside app.form ?
Thanks,
|
|
|
|
|