|
What .NET library function corresponds to "QueryPerformanceCounter" from the Win32 API?
|
|
|
|
|
There is a PerformanceCounter class in .net but I doubt there is an equivalent of QueryPerformanceCounter method in .net.
So you would have to take the P/Invoke technique, of calling the Win32 API directly.
Have a look at this[^] article
Hope this Helps
Cheers
Kannan
|
|
|
|
|
Hello everyone,
I have been working on Text to Speech. After I have done some manipulation to the sound wave, i write it to a .wav file. But when i play the file, only "zzzzzz" sound came out. Anyone knows what are the possible reasons?
Thanks for any help
min
|
|
|
|
|
I want to edit the datagrid control to display data like the properties window does in the visual studio environment. I.e. I have performed a database query and have a DataTable with the following in it (2 columns of data)
LABEL VALUE
Push To Talk 100
Receive to Transmit 150
Transmit to Transmit 100
Carrier Detect 100
etc..
Basically a list of parameters with values that a user can change
I have created a datagrid and set its source to this datatable and it fills up correctly however I would like it so the first column LABEL is uneditable and its background colour is identifiable as an uneditable cell. I would also like it so there is no new empty row at the bottom of the datagrid because I dont want users adding new rows??
How can this be achieved. I have seen the DataGridTableStyles property and am guessing it is by utilising these collections and adding styles. I have fiddled but havent got anything to work. Has anyone done something like this before that could help ??
Thanks
|
|
|
|
|
I'm designing an online version of a complex card game, where the rules are constantly changing (Fluxx, for any who know it). I'm keeping the actual game logic on the server. The communications between the clients and server is my only problem, however. I hope to create a Java client in addition to a .NET one (several of my close friends who play the game use Macintoshes), so I can't use Remoting. Web Services seemed promising, but I definitely need a highly controlled persistent-state connection. I have a basic design for a persistent-state XML-based connection, but I'm hoping I'll be able to avoid the hassle of creating programmatic logic to create the message (and avoid having to create a DTD or Schema, since the messages could be complex). So, I'm looking for some good ideas. Any contributions will be extremely welcome. (Oh, and if I end up posting the game onto CodeProject, I'll give credit for any contributions used.)
Thank you in advance,
Eric Astor
|
|
|
|
|
Ok this is not the answer to your question, but have you tried terrarium[^]
I believe its purely a p2p kind of architecture, you should be able to derive some ideas from that one.
Kannan
|
|
|
|
|
I have tried Terrarium, but its P2P architecture doesn't really fit the model of a card game. My client/server model, with all logic localized to the server, seems to be a more appropriate architecture.
Also, I would assume that the Terrarium communication method is probably a .NET-based proprietary solution, and therefore unfit for creating connections between a .NET server and a Java client (which is the final goal of my connection scheme, as I want to be able to play this game with my Macintosh-using friends).
Kannan, thanks for the suggestion, but I don't think the approaches used for Terrarium really fit an online card game.
Eric
|
|
|
|
|
Does anyone know how to get the icon from a specified executable path? I know there is an Icon class and the Graphics class has a DrawIcon function, however I am not sure how they work together. Note that the icons will be coming from other applications, not necessarily from another C# application.
Nick Parker
You see the Standards change. - Fellow co-worker
|
|
|
|
|
Nick Parker wrote:
Does anyone know how to get the icon from a specified executable path?
// System.Drawing.Icon constructor
public System.Drawing.Icon(
Type type,
string resource
);
(that's the equivalent of WIN32's LoadLibrary(path) + LoadResource(iconid))
doc here[^].
|
|
|
|
|
S.Rod, thanks, I had actually looked at this a few of the other 6 different constructors for the Icon class, however I wasn't/and am still not sure for exampple with your suggestion what to use as the Type and resource , where do they come from?
This below can't be right...
Icon i = new Icon(typeof(".exe"), ?);
or
Icon i = new Icon(Type.GetType(@"C:\Windows\System32\notepad.exe"),?);
I think I am shooting blanks here, thank you.
Nick Parker
You see the Standards change. - Fellow co-worker
|
|
|
|
|
The type is internally passed to that documented method : type.Module.Assembly.GetManifestResourceStream(type, resource);
After checking out that call, I have seen it's currently not implemented in .NET 1.0. It always throws an exception.
If someone has .NET Everett installed, may be he can shed us a light on whether it's now implemented.
Otherwise, I am afraid you'll have to rely on P/Invoke : LoadLibrary() + LoadImage().
Once you have your icon handle, you just need to pass it to the System.Drawing.Icon(IntPtr handle) constructor.
In addition
|
|
|
|
|
.S.Rod. wrote:
Otherwise, I am afraid you'll have to rely on P/Invoke : LoadLibrary() + LoadImage().
Ok, I feel like the smoke is starting to clear now, thank you. After looking up a few of the functions on MSDN I came up with the following:
[DllImport("kernel32.dll",CharSet=CharSet.Auto)]
static public extern IntPtr LoadLibrary(string lpFileName);
[DllImport("user32.dll",CharSet=CharSet.Auto)]
static public extern IntPtr LoadImage(IntPtr hinst,
string lpszName,
uint uType,
int cxDesired,
int cyDesired,
uint fuLoad);
And then I implement it like this:
Graphics grfx = Graphics.FromHwnd(this.Handle);
Rectangle rect = new Rectangle();
rect.X = 0;
rect.Y = 0;
rect.Width = 16;
rect.Height = 16;
IntPtr i = API.API.LoadLibrary(app1);
IntPtr i2 = API.API.LoadImage(i, app1, 1, 0, 0, 0x0010);
Icon ico = System.Drawing.Icon.FromHandle(i2);
grfx.DrawIcon(ico, rect);
I have noticed when I step through it that LoadImage returns 0 for i2 and then when I try to create the ico Icon it throws a System.ArgumentException saying the Win32 handle I passed to Icon is invalid or the wrong type. Any ideas?
Nick Parker
You see the Standards change. - Fellow co-worker
|
|
|
|
|
A few points :
- If LoadImage returns 0, that's because it has failed. There is no point in passing 0 as a handle in the FromHandle() method.
- To know more about the error, you can use the GetLastError() WIN32 function.
- LoadImage can be used in either of the following ways. Trouble is you are using a mix of it! Namely,
-- If LR_LOADFROMFILE is provided as last parameter value (0x0010), like you do, then the second parameter is the actual filename of the image. Doing so, you are directly loading a .bmp, .ico, .cur file. But, from what you told me first you wanted to do, you should not use LR_LOADFROMFILE.
-- If LR_LOADFROMFILE is not provided, then the first paramter is the module instance of the .dll or .exe, allright, and then the second parameter is the resource name. You must pass the resource name : that is either the translated resource ID (use a resource editor) obtained with MAKEINTRESOURCE, or the direct resource name as a string.
MAKEINTRESOURCE is an int --> LPSTR macro defined as is :
#define MAKEINTRESOURCE(i) (LPSTR)((DWORD)((WORD)(i)))
|
|
|
|
|
.S.Rod. wrote:
MAKEINTRESOURCE is an int --> LPSTR macro defined as is :
#define MAKEINTRESOURCE(i) (LPSTR)((DWORD)((WORD)(i)))
I have no idea how to convert that to a C# statement (I think I am lost again):
int MAKEINTRESOURCE(i)
{
return Convert.ToString(Convert.ToDouble(i)));
}
.S.Rod. wrote:
If LR_LOADFROMFILE is not provided, then the first paramter is the module instance of the .dll or .exe
That is what I am doing, correct?
.S.Rod. wrote:
You must pass the resource name : that is either the translated resource ID (use a resource editor) obtained with MAKEINTRESOURCE, or the direct resource name as a string.
I see, I think, so I need to switch the 2nd param to a resource ID huh? I will check into that. Tell me something, am I making something simple, hard? I know a little about Win32, I just havn't worked with it a lot, VB shop at work. Thanks S.Rod. I appreciate it.
Nick Parker
You see the Standards change. - Fellow co-worker
|
|
|
|
|
Nick Parker wrote:
That is what I am doing, correct?
Unfortunately no. 0x0010 = LR_LOADFROMFILE, thus wrt this you should be passing a filename pointing to an actual .bmp, .cur or .ico file. Which you don't, since you are passing a .dll/.exe filename instead.
Nick Parker wrote:
I need to switch the 2nd param to a resource ID huh?
We are not talking about ConvertToString, which is the equivalent of VB's STR$().
MAKEINTRESOURCE makes an int looks like a pointer to a string. That's obtained by casting an int to an IntPtr.
At this point, you shouldn't bother that much about all this. Just lookup Cp, MSDDEV samples, and Google with either of those keywords : LoadIcon, LoadImage.
|
|
|
|
|
Can some tell me about his experience using mySQL with .NET? what are the advantages and disadvantages? any limitations or restrications?
I want to build a corporate application which will have a network access as well as remote access and I'm planning to use mySQL because of the limitation inb MS Access and SQL server with MSDE.
Many Thanks,
Jassim Rahma
Jassim Rahma
|
|
|
|
|
You should really only post things in one forum. Pick the one suited to your post the most and then stick with it.
However, I will tell you that dealing with mySQL in general is a pain for any form of Windows development. The myODBC driver that comes along with it is such a bother to configure. If you already have it, I'd stick with SQL Server. If not, I'd go with MSDE (a scaled down version of SQL Server).
I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past.
-Chris Maunder
Microsoft has reinvented the wheel, this time they made it round.
-Peterchen on VS.NET
|
|
|
|
|
Disclaimer: Although I use MySQL, I have not used MySQL with C#
That being said, MySQL does have an ODBC driver at www.mysql.com and there is a supported version (via MySQL AB) although you will have to ask for a quote, since in a corporate edition, this can get quite pricy.
... and my experience with C# and ODBC is quite good.
Regards,
Adrian
|
|
|
|
|
then, do you recommend mySQL for corporate application, or let me ask it the other way: which database you recommend for corporate if not MS Access and MS SQL server?
Jassim
|
|
|
|
|
Thats a good question. Since I am a consultant by day and programmer by night, I'll put my consultant hat on for you.
For small deployments, it really doesn't matter what you choose. I would recommend SQL Server simply because of the ease of deployment.
For larger deployments, where performance becomes an issue (and this point is dependent on the application and the environment), I tend to recommend Oracle.
For web deployments where the data is not as critical, or other programming languages (such as PHP or Perl) need to get involved, I tend to recommend MySQL.
I say "tend to" since I sometimes come across sites which already have a database in place, and that would have a bearing on the overall cost of the solution.
-Adrian
|
|
|
|
|
Any one knows what database hotmail.com service is using?
Many Thanks,
Jassim Rahma
Jassim Rahma
|
|
|
|
|
jrahma wrote:
Any one knows what database hotmail.com service is using?
If it's not SQL 2000, M$ would be busy with the conversion.
Cheers
Mike
Johannesburg, South Africa
|
|
|
|
|
I'd like to think so too, but there still seems to be a bunch of UNIX in the Hotmail backend.
I think Passport is the only pure MS part of Hotmail at the moment.
Cheers,
Simon
"The day I swan around in expensive suits is the day I hope someone puts a bullet in my head.", Chris Carter.
my svg article
|
|
|
|
|
(Disclaimer: I work for a company producing email products, but I have no insider knowledge of
hotmail.com beyond what I have read and heard over the years).
I'm not sure hotmail.com uses a database in the traditional sense of "database" beyond the Passport authentication. The messages are likely to be held in flat files. Email systems just don't work
the same way as databases in general. Even the now defunct Internet Mail Service from Microsoft held
each message in a single RFC-822 formatted file, with an index file for the meta-data.
However, a quick look at the SMTP servers indicate that they are now running Microsoft stuff on at
least some of their servers (It looks like Exchange 2K), and their web servers are running IIS, so
I guess that they are running Microsoft stuff now.
It should be noted that on an Exchange 2K server (at least my Exchange 2K server), I can change directory
to M:\sitename\MBX\ahall\INBOX and see a series of file <number>.EML. If I connect to the IMAP port,
then I see <number> appear as an IMAP UID. .EML format is the same RFC-822 format that their defunct
Internet Mail Service saved data as. So even in Exchange 2K, the database functionality is seriously
limited.
-Adrian
|
|
|
|
|
what are all the free installers available for .NET on the web?
Many Thanks,
Jassim Rahma
Jassim Rahma
|
|
|
|
|