|
Nevermind, I found the answer. Guess I'll have to use a custom statusbar component or make my own.
|
|
|
|
|
When you find answers to your own questions, please post them here. The forum is here to help the community; had anyone else replied you should've been provided the answer.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
The statusbar only displays the first 127 characters of the text string. To get around this, I made an owner-drawn panel, and used DrawString to draw the text.
|
|
|
|
|
Hi there, again...
Now I have here a little problem.
I was searching on the net, and I discovered an algorithim to detect scene changes with the histogram method. The method is something like this:
A - histogram of the first frame (an array of 255)
B - histogram of the second frame (an array of 255)
If A - B > thershold it is a scene change, If A - B < thershold it isn´t.
My problem is, I have to Bitmaps with the frames, how can I read the bitmap values to the two arrays that I have created?!!
Sorry, this is a newbie doubt, but I don´t know how I do this =/
Thanks, Sérgio
|
|
|
|
|
What values do you mean, exactly? If you want to read the pixels in, the easiest and safest way is using Bitmap.LockBits , enumerate the scan lines and pixels returned in the BitmapData (return value for LockBits ), and then call Bitmap.UnlockBits passing the BitmapData back. I say safest because you can do this a little faster using unsafe code (i.e., direct memory access using pointer math).
For an example, read Christian Graus's Image Processing for Dummies with C# and GDI+ Part 1 - Per Pixel Filters[^].
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Thanks very muck, I already know what I have to do.
YOur help was very useful 
|
|
|
|
|
Hi,
Have you been able to do a scene change detection in C#? I am currently breaking my head, trying to develop a scene change detection component, which will give me the frames of a video, where a scene change is detected.
Can you help me on this? Can you please contact me at manajit(at)yahoo.com
Regards,
Manajit.
|
|
|
|
|
This is the API I want to use:
long LoginDlg<br />
(<br />
long lDSType,<br />
LPTSTR lptstrDataSource, <br />
long lDSLength,<br />
LPCTSTR lpctstrUsername, <br />
LPCTSTR lpctstrPassword,<br />
)
I wrap it like this:
[DllImport("user.dll")]
int LoginDlg<br />
(<br />
int lDSType,<br />
stringlptstrDataSource, <br />
int lDSLength,<br />
stringlpctstrUsername, <br />
stringlpctstrPassword,<br />
)
Now I got the new version of this api, the only difference is using LPWSTR instead of LPTSTR
long LoginDlg<br />
(<br />
long lDSType,<br />
LPWSTR lptstrDataSource, <br />
long lDSLength,<br />
LPCWSTR lpctstrUsername, <br />
LPCWSTR lpctstrPassword,<br />
)
I use the same wrapper, it doesn't work as usual. Do you have any ideas what's wrong with my wrapper?
Thanks in advance.
|
|
|
|
|
First, understand how the unmanaged code (i.e., native code) looks (essentially):
typedef char CHAR;
typedef CHAR* LPSTR;
typedef wchar_t WCHAR;
typedef WCHAR* LPWSTR;
#ifdef UNICODE
typedef WCHAR TCHAR;
typedef WCHAR* LPTSTR;
#else
typedef CHAR TCHAR;
typedef CHAR* LPSTR;
#endif That means that any Unicode strings use "W" as a convention (this is true with most Microsoft APIs - as well as others' APIs - that take strings as parameters; they end with either "A" for ANSI or "W" for Unicode and are #define'd without either "A" or "W", which is the one you typically call).
When you use P/Invoke or COM interop (both are interop features), you must dictate which string encoding to use. By default in C#, CharSet.Ansi is used. In most cases when calling Microsoft APIs (and others - those I mentioned above), you will want to use CharSet.Auto . Where do you use those?
When declaring P/Invoke methods, you use them in the DllImportAttribute like so:
[DllImport("user32.dll", CharSet=CharSet.Auto)]
static extern bool GetComputerName([Out] string name, ref int size); When you're declaring a struct with string members, you do the same in the StructLayoutAttribute .
In both cases, you can override the string encoding using the MarshalAsAttribute .
Lets say, for some reason, you had a struct with ANSI and Unicode versions, except for one string member that must always be ANSI:
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
public struct Example
{
public string Field1;
public string Field2;
[MarshalAs(UnmanagedType.LPStr)] public string Field3;
} We default to CharSet.Auto (saves typing and is easier to maintain) but override the unmanaged type as UnmanagedType.LPStr (as opposed to UnmanagedType.LPWStr ), so that it's always ANSI. You can do the same with P/Invoke declarations.
Just make sure you understand the unmanaged code well enough to know whether it's always ANSI or Unicode, or if it is platform dependent (i.e., ANSI on Windows, Unicode on Windows NT).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
According to my understanding, the new method is using Unicode all the time. So I wrap it like this now:
[DllImport("user.dll", CharSet = CharSet.Unicode)] <br />
int LoginDlg<br />
(<br />
int lDSType,<br />
string lptstrDataSource, <br />
int lDSLength,<br />
string lpctstrUsername, <br />
string lpctstrPassword,<br />
)
But why it still doesn't work?
|
|
|
|
|
Since the function is defined externally, you have to modify it as such, and all P/Invoke functions are static (i.e., they aren't defined by a class). Your signature should look like this:
[DllImport("user.dll", CharSet=CharSet.Unicode)]
extern static int LoginDlg(
int lDSType,
string lptstrDataSource,
int lDSLength,
string lpctstrUsername,
string lpctstrPassword); Drop the comma after lpctstrPassowrd and add a semi-colon after the declaration, as well.
BTW, since the parameter names begin with either lptstr or lpctstr , they are most likely using platform-dependent string encodings. You best check your API documentation and thoroughly examine your headers. Using "t" typically means that a string is platform dependent, although thiscould be just a different naming convention for your APIs. If these are Microsoft APIs, I assure you they're platform-dependent strings and you should use CharSet.Auto .
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Then write up an article on it. If you post it here, your answer will disappear into the "forum oblivion" in about a day...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi,
You wrote :
I am bangin my head against the
What you mean by this post ?
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
What is your question? If you need help regarding string searches and other string manipulation, you should read the String class[^] documentation in the .NET Framework SDK.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
I am banging my head against the wall on this one:
i am attempting to do a comparison between 2 strings. what i am attempting to do is this
I have strings String #1 and String #2.
I have turned string #1 into an array, and what i want to do is
foreach (string arrayvalue in array)<br />
{<br />
if (arrayvalue exists in string #2)<br />
{<br />
blah blah blah<br />
}<br />
else<br />
{<br />
blah blah<br />
}<br />
}<br />
I know how to do a wildcard search in a rowfilter, but unfortunately that code does nto seem to translate directly into the above format. Any ideas?
Yes, I am the highly suggestable type.
|
|
|
|
|
hi,
Here the senario is you want to check whether any of the string which is there in your first array exists on second array.
upto my level best i didn't found any keyword 'exists' in C#.
You can do this logic insted of your logic.
foreach(string Str in ab)
{
foreach(string Str2 in bc)
{
if(Str.Equals(Str2))
Console.WriteLine("String Found");
else
continue;
}
}
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
Thanks for the reply. i had done something very similar to this previously (i did if( Str == Str2) in the same format. what happens, though is that if you have 4 objects in each array, it returns 16 results, 3/4 12, etc. what i am attempting to do is a comaprison of the two, and for any matches, print "yes", and for any that are in one strin but not the other, print "no". for example:
string 1 is red*blue*yellow*green*black
string 2 is green*red*blue*pink
the results i am looking for are
red = yes
green = yes
blue = yes
pink = no
black = no
in regards to your other post, i hit the tab key when typing the original message and accidentally made a gibberish post.
Yes, I am the highly suggestable type.
|
|
|
|
|
hi,
I gave the idea and now you are asking for logic. We won't encourage developers by giving logic. It is upto you to structure your program to get required result.
Apart from that i don't have enough time to sit and code for you. But Still if i get time i will do that. Ok.
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
hi,
Ok. Don't repeat this anymore. That's is don't ask supporters for code block.
string[] ab=new string[5];
string[] bc=new string[4];
string[] cd=new string[5];
int ctr,ctr1=-1;
ab[0]="red";
ab[1]="blue";
ab[2]="yellow";
ab[3]="green";
ab[4]="black";
bc[0]="green";
bc[1]="red";
bc[2]="blue";
bc[3]="pink";
foreach(string Str in ab)
{
ctr=0;
ctr1++;
foreach(string Str2 in bc)
{
if(Str.Equals(Str2))
{
ctr++;
}
else
continue;
}
if(ctr!=0)
cd[ctr1]=Str+"|Yes";
else
cd[ctr1]=Str+"|No";
}
foreach(string str in cd)
{
string[] part=str.Split('|');
Console.WriteLine(part[0]+"="+part[1]);
}
}
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
I am bangin my head against the
Yes, I am the highly suggestable type.
|
|
|
|
|
Hi @all,
I can't fix the following problem:
I have an ArrayList filled with data (from a self joined table) that should be the names of the nodes of a TreeView:
{"0", "Categories",
"Categories", "Music",
"Categories", "Videos",
"Music", "Audio-CD",
"Videos", "SVCD",
"Videos", "MPEG"}
The first is the parent node and the second is the child. The data pair, which contains "0" and "Categories" is the root.
The TreeView should looks like
+Categories
-Music
*Audio-CD
-Videos
*SVCD
*MPEG
I tried a lot without success. Please help me!
Thank you!
Sebastian.
|
|
|
|
|
I haven't tested it but I think something like this should work.
Hashtable table = new Hashtable();
for(int i = 0; i < arrayList.Count; i++)
{
treeView.Items.Add(arrayList[i].ToString());
table.Add(arrayList[i].ToString(), table.Count);
i++;
}
int index;
for(int i = 1; i < arrayList.Count; i++)
{
index = table[arrayList[i-1].ToString()];
treeView.Items[index].Add(arrayList[i].ToString());
i++;
}
|
|
|
|
|
Hey...
thank you for your reply...
The problem is that the keys are not definite. That's why I had to exchange key and value.
But how can I get the keys for the values now ?
Greetings
S.
|
|
|
|
|
Hi,
I am trying to get the duration of a wmv/wma file, without playing that pleasea anyone can suggest me how to find this .
Vaibhav
Vaibhavgupta28@gmail.com
|
|
|
|
|
hi,
you can use Duration property of your Media Control.
Eg:
OpenFileDialog fld=new OpenFileDialog();
fld.ShowDialog();
axMediaPlayer1.FileName=fld.FileName;
double Due=axMediaPlayer1.Duration;
Here i am getting the duration of movie file without playing it.
**************************
S r e e j i t h N a i r
**************************;)
|
|
|
|
|