|
Michel, here's an example for you.
You can group the import specs as shown here, or interspersed through your code...
class Win32
{
[DllImport("kernel32.dll")]
public static extern bool Beep(int freq,
int duration);
[DllImport("kernel32.dll")]
public static extern void SleepEx(int imeinms,
int alert);
[DllImport("kernel32.dll")]
public static extern int WinExec(string pgmname,
int hideorshow);
[DllImport("kernel32.dll")]
public static extern void ExitProcess(uint
exitCode);
[DllImport("winmm.dll")]
public static extern bool PlaySound(string
pszSound, int hmod, uint fdwSound);
[DllImport("kernel32.dll")]
public static extern uint GetCurrentProcess();
[DllImport("kernel32.dll")]
public static extern bool TerminateProcess(uint
hndl, uint exitcode);
}
call the functions from your code (say the Beep function)
as:
Win32.Beep(freq,duration);
Hope this helps.
Spolia Opima
|
|
|
|
|
Tx exactly what I was looking for.
|
|
|
|
|
Look at this code...
==============================================================================
string strClaim = "BER";
Regex objNaturalPattern = new Regex("[Bb][Ee][Rr]|[Tt][Ww][Oo]|[Ss][Tt][Oo]");
objNaturalPattern.IsMatch(strClaim);
==============================================================================
ok the return value to "objNaturalPattern.IsMatch(strClaim);" will be true as it matches [Bb][Ee][Rr]. Now what I might want to do and it needn't only apply to this example is know which Regular expression ([Bb][Ee][Rr]|[Tt][Ww][Oo]|[Ss][Tt][Oo])the string matched.
Is there any possible way to get some kinda of return value to say which one was matched?
as in a string matching [Bb][Ee][Rr] would return 0
as in a string matching [Tt][Ww][Oo] would return 1
as in a string matching [Ss][Tt][Oo] would return 2
no match could return -1
Is this posible? Is there a method that I have over looked?
elp!
Thomas
|
|
|
|
|
I might not follow you, but if you want to get the string that was matched, you
objNaturalPatter.Match(strClaim).Groups[0].Value
Bog
"Outside of a dog, a book is Man’s best friend. And inside of a dog, it’s too dark to read."
-Groucho Marx
|
|
|
|
|
Is there such a thing in C#?
|
|
|
|
|
Michel Prévost wrote:
Is there such a thing in C#?
Not in .NET 1.0, but 1.1 includes a Directory browser dialog. (or whatever its called, don't have a copy in front of me)
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
Ohh...thats nice to know, of course now I will have to download and install it.
Hey don't worry, I can handle it. I took something. I can see things no one else can see. Why are you dressed like that?
- Jack Burton
|
|
|
|
|
Michel,
Using the .Net 1.1 SDK you can just use the
System.Windows.Forms.FolderBrowserDialog.
If you are using the 1.0 SDK you can inherit from
System.Windows.Forms.Design.FolderNameEditor.
This implementation will most likely require that you use a
FolderNameEditor.FolderBrowser.
I have a class already written that can do this job if you like.
Also, I think there is at least one implementation posted here on CP.
Hey don't worry, I can handle it. I took something. I can see things no one else can see. Why are you dressed like that?
- Jack Burton
|
|
|
|
|
if you aren't aware then check out
MSDN for .NET 1.1 which includes Browse Folder also.
and lots more
|
|
|
|
|
I may need to upgrade to .NET 1.1. Is it released?
|
|
|
|
|
Hi,
Does anyone use anr O/R mapping tool for .NET platform. I searched the Internet and found two tools only" ObjectZ (www.mooongoose.com) and PORT (www.potis.com.pl). Do you have any experience in using any of them ?
Ava
|
|
|
|
|
Avaril wrote:
Does anyone use anr O/R mapping tool for .NET platform.
There is also EntityBroker from http://www.thona-consulting.com/[^]. It isn't released yet but work progresses fairly fast.
Documentation is a bit thin, especially when trying to figure out how you need to set up the database (the version I used didn't create the tables for you, I think it still doesn't).
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
Thanks. I have already found two other tools. Objectz (http://www.mongoosesolutions.com/mg/products.asp) and Port (www.potis.com.pl).
Ava
|
|
|
|
|
|
Hi all
can anyone tell me if a function exists which draws a line segment or series of line segments which adds each point in the line to an array of points?? It would also have to take into account the width of the line drawn!!! Basically i want to be able to draw a line then click on it and compare the mouse click point against all points in the line for a match??
Any ideas would be great!!
Regards,
Paul
Paul Griffin
|
|
|
|
|
you need to work with GraphicsPath using PathData , look at PathData.Points
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Have a look at:
Graphics.DrawPolygon();
|
|
|
|
|
Ok im trying to count the characters that i have loaded into a buffer i have set up the following function
void countchars(char *buffer, int *count)
/*Counts the number of characters in the text file */
{
int i,counter;
char cdata;
count['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'];
do
{
{ for(cdata='A';cdata<='Z';cdata++)
if(buffer[i]==counter[count])
{
count++;
}
i++;
}
}while(buffer[i]!=EOF);
}
I am calling this function using the following code:
countchars(buffer,cdata);
printf("\nDistribution of letters in %s is:",fname);
for (c='A';c<='Z';c++)
{
N=cdata[c]+cdata[tolower(c)];
printf("\n'%c' %4d: ",c,N);
for (i=0;i
|
|
|
|
|
You might want to post this in a C/C++ board. The code above isn't C# style.
R.Bischoff | C++
.NET, Kommst du mit?
|
|
|
|
|
How can I extract a content from the OLE object as Text in C#? I have create in VB6:
...
OLE1.object.saveas "c:\tryFile.rtf"
...
and after that I started the Automation like
Set wordAutomation = CreateObject("Word.Application")
With wordAutomation
.Visible = False
.Application.Documents.Open ("c:\tryFile.rtf")
.Application.ActiveDocument.Select
.Application.ActiveDocument.content.Copy 'now is in Clipboard as Text
End With
...
How can I transform and implement this Code in C#?
Best regards
|
|
|
|
|
Hopefully[^] (23MB) a lot of bug fixes : Marshaling hazard, IE events, just to name a few.
...
If you want to take advantage of .NET 1.1 (read : make sure it's used instead of the current .NET 1.0 that might be installed), then remove .NET 1.0. By default, apps configured to start with 1.0.3705 will start with 1.1.4322 in case 1.0.3705 is not installed. That's kind of throwing away the .NET side-by-side versioning, but that's the simplest way I can think of to make sure you are always running .NET apps with the latest CLR.
|
|
|
|
|
including Visual Studio 2003, for download is available for MSDN subscribers.
|
|
|
|
|
Thanks for the info .S.Rod.
.S.Rod. wrote:
then remove .NET 1.0. By default, apps configured to start with 1.0.3705 will start with 1.1.4322 in case 1.0.3705 is not installed.
Did you get this to work with VS.net 2002? I'm just curious, I'm going to try it on a spare machine since my dev machine is pretty stable and I hate monkeying up a "good" set-up.
Hey don't worry, I can handle it. I took something. I can see things no one else can see. Why are you dressed like that?
- Jack Burton
|
|
|
|
|
Any idea on what are the bug fixes that was done to 1.1.
I have seen lot of docs saying breaking changes and new stuff added, but is there a place where they say the bugs that where fixed. I haven't downloaded it, so i'm not sure if the readme or some place contains that information.
- Kannan
|
|
|
|
|
Is there some control or DLL that facilitates rectange selection, as found on the Windows Desktop and many paint/presentation programs? Ideally it would help select child controls.
Or is this something that must be coded from scratch on a custom basis?
For instance, let's pretend that I wanted to simulate the Windows Desktop and wanted to be able to select icons by dragging a mouse to form a rectangle selection. Without any special DLL help, I would have to manage the drawing of the rectangle via mouse events, check for controls within the rectangle's area, and select the controls, perhaps by highlighting them in some way. Or I could also change the selections list by clicking on controls with the Control key.
|
|
|
|