|
Thanks you verry much for you're quick answer!
I am verry grateful!
Happy New Year!
|
|
|
|
|
Hey,
I was wondering what this is called:
Class MyClass<MyType>
Jeroen De Dauw
---
Forums ; Blog ; Wiki
---
70 72 6F 67 72 61 6D 6D 69 6E 67 20 34 20 6C 69 66 65!
|
|
|
|
|
Hi,
class MyClass<MyType> is "generics", introduced with .NET 2.0
|
|
|
|
|
Oh ok, thanks
Jeroen De Dauw
---
Forums ; Blog ; Wiki
---
70 72 6F 67 72 61 6D 6D 69 6E 67 20 34 20 6C 69 66 65!
|
|
|
|
|
No problem.
BTW: did you notice how the C# forum turns VB code into C# automatically?
|
|
|
|
|
By applying random mutations to my code, I found for myself how it was done in C#.
Jeroen De Dauw
---
Forums ; Blog ; Wiki
---
70 72 6F 67 72 61 6D 6D 69 6E 67 20 34 20 6C 69 66 65!
|
|
|
|
|
|
Woha, that's neat.
* adds bookmark *
Jeroen De Dauw
---
Forums ; Blog ; Wiki
---
70 72 6F 67 72 61 6D 6D 69 6E 67 20 34 20 6C 69 66 65!
|
|
|
|
|
Here goes, I'm trying to read Unicode text in from a ini/uni file.
I've made the call to GetPrivateProfileStringW
[DllImport("KERNEL32.DLL", EntryPoint = "GetPrivateProfileStringW",
SetLastError = true,
CharSet = CharSet.Unicode, ExactSpelling = true,
CallingConvention = CallingConvention.StdCall)]
private static extern int GetPrivateProfileStringW(
string lpAppName,
string lpKeyName,
string lpDefault,
string lpReturnString,
int nSize,
string lpFilename);
And this is what I use at the point of actual calling.
string returnString = new string(' ', 32768);
GetPrivateProfileStringW(fetchUniSection[n], fetchUniInfo[i], "FAIL", returnString, 32768, containingFolder + @"\BiblioSelfCheckDefault.uni");
I get the text, but rather than be in proper Chinese, Japaneses, Arabic, etc.. it is just garbage characters.
Can anyone tell me what I am doing wrong? As far as I can tell, it is taking my input and forcing it onto ASCII.
Thanks!
-Elmernite
|
|
|
|
|
Hi,
AFAIK you need to pass a StringBuilder, not a string, for native strings that must be writable.
I have an article[^] in progress that shows an example.
|
|
|
|
|
After switching to StringBuild I now get
"Warning: A StringBuilder buffer has been overflowed by unmanaged code. The process may become unstable. Insufficient capacity allocated to the StringBuilder before marshaling it."
Forgive my lack of understand... But what does that mean?
---
I solved that by increasing the stringbuilder size.
Here is my new code, but I am still getting mangled results like below.
[DllImport("KERNEL32.DLL", EntryPoint = "GetPrivateProfileStringW",
SetLastError = true,
CharSet = CharSet.Unicode, ExactSpelling = true,
CallingConvention = CallingConvention.StdCall)]
private static extern int GetPrivateProfileStringW(
string lpAppName,
string lpKeyName,
string lpDefault,
StringBuilder lpReturnString,
int nSize,
string lpFilename);
StringBuilder returnString = new StringBuilder(5000);
GetPrivateProfileStringW(fetchUniSection[n], fetchUniInfo[i], "FAIL", returnString, returnString.Capacity, containingFolder + @"\BiblioSelfCheckDefault.uni");
Then I just use returnString.ToString(), store it in a string variable, and later I place it in a text box.
But in the text box, instead of the other language, I get
:رسوم الاÙتتاØ
-Elmernite
modified on Tuesday, December 29, 2009 10:40 AM
|
|
|
|
|
Hi,
I don't see anything that is fundamentally wrong.
I never used GetPrivateProfileString myself.
However:
- I would drop the "SetLastError = true" part, as I don't see anything about GetLastError in the MSDN documentation here[^]
- I trust your filename is ...BiblioSelfCheckDefault.ini not .uni
Hope this helps.
|
|
|
|
|
I dropped the "SetLastError" part, still the same results.
Actually the file is .uni not .ini, which as far as I can tell, .uni is simply an .ini file the denotes it can handle Unicode.
I guess I can manually sort through the uni/ini file and access the text that way and maybe it will be in proper unicode.
Thanks for the assistance!
-Elmernite
|
|
|
|
|
hi guz.
i wonder how can i use open gl with C# 08 express edition...
Plz rply me as soon as possible as i hav to submit a project related to these befor 8th jan,2010.
Awais
|
|
|
|
|
Message Closed
modified 23-Nov-14 7:14am.
|
|
|
|
|
That's really really old and quite buggy, better use the Tao Framework[^] these days (though it also seems quite dead now)
|
|
|
|
|
Forget about OpenGL, and use SlimDX.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
is there like file watcher for registry
|
|
|
|
|
Hello,
I'm a little lost as to how to write a class that will take in arguments from the .Add function of a List<>.
With reference to this thread, I have written the following class.
public class SnapShot
{
private DateTime m_SnapShotDateTime;
public DateTime SnapShotDateTime
{
get
{
return m_SnapShotDateTime;
}
set
{
m_SnapShotDateTime = value;
}
}
private long m_BPSAverage;
public long BPSAverage
{
get
{
return m_BPSAverage;
}
set
{
m_BPSAverage = value;
}
}
public SnapShot(DateTime snapshotdatetime, long bpsaverage)
{
m_SnapShotDateTime = snapshotdatetime;
m_BPSAverage = bpsaverage;
}
}
I have created a List and would like to use the .Add function to add "entries" for .SnapShot(DateTime snapshotdatetime, long bpsaverage).
SnapShot LiveSnapshot;
List<SnapShot> LiveSnapshotList = new List<SnapShot>();
How do I properly write the class so that it handles the .Add function of the List? Or should I be calling .Add with some other overload value?
Thanks,
Matt
|
|
|
|
|
Hi,
1.
you don't need to create a special list class, a simple:
List<SnapShot> snapShots=new List<SnapShot>();
SnapShot snap=new SnapShot(...);
snapShots.Add(snap);
...
List<SnapShot> moreSnapShots=new List<SnapShot>();
moreSnapShots.Add(...);
snapShots.Add(moreSnapShots);
would work just fine.
2.
And you could make that slightly more user-friendly with an almost empty class like this:
class SnapShotList : List<SnapShot> {}
SnapShotList snapShots=new SnapShotList();
SnapShot snap=new SnapShot(...);
snapShots.Add(snap);
...
SnapShotList moreSnapShots=new SnapShotList();
moreSnapShots.Add(...);
snapShots.Add(moreSnapShots);
|
|
|
|
|
Thanks very much Luc. I will take a look into this.
As for snap , this is of the type SnapShot as defined via the SnapShot class's SnapShot function?
Thanks,
Matt
|
|
|
|
|
bbranded wrote: as defined via the SnapShot class's SnapShot function?
yes.
however functions are passé, you should call them methods now; unless they are constructors!
|
|
|
|
|
5ed
Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Haha! What do you call a Lambda Then Luc?
|
|
|
|
|
I'm afraid I can't answer that on a public forum.
|
|
|
|