|
I'm just trying to make sure I understand. Obviously there is nothing wrong with this but it was my understanding that StructLayoutAttribute was used if the struct were to be passed to unmanaged code, otherwise it wouldn't be necessary. Is there some benefits to using the attribute for managed code as well?
|
|
|
|
|
No, it wouldn't be necessary in managed code unless marshaled to native code, but since he mentioned C/C++ I just assumed that he might require it.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thanks, just wanted to make sure I wasn't missing something.
|
|
|
|
|
I am trying to access data from the serial port using c# I don't want to use a GUI I just want to be able to recieve a stream of bytes, does anybody know how to do this or have any suggestions thanks Tim
|
|
|
|
|
there are no .NET library to use for this.
You have another couple of options.
Use a component from VS 6.0:
http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=320
OR use the win32 API:
http://msdn.microsoft.com/msdnmag/issues/02/10/NETSerialComm/default.aspx
|
|
|
|
|
Hi,
I am trying to play mp3 files from C# app. I have Windows Media Player 6.4 and I am able to play the file but with mp3 files, it disables the fast forward and rewind buttons and I also want the trackbar with it.
So, I installed Windows Media Player 9 with SDK. That has a problem that it doesn't look like the gray color simple WMP and that is the look I want. I know I can change the skin, but that seems to be a lot of work and I don't know how to choose a skin while playing a file !
I did read in help that if I put audio.URL = "c:\filename.mp3?WMPSkin=Compact" it should work, but I didn't see the skin change when I ran the applicaiton.
Any suggestions ?
Thanks,
Paul
|
|
|
|
|
pahluwalia wrote:
Any suggestions ?
Stop double posting
|
|
|
|
|
Why don't you just set the visibility to false and handle the events and methods (like Play and Stop ) yourself? It appears there is no way to change the skin using the WMP object model.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I developed a system to print our companies invoices. Now, I am trying to find ways to optimize the system. One of the biggest things is how long it takes to print. When a bill is printed, it also prints all the paperwork stored as tiff images that go with that bill. These images really seem to take a long time to print. I tried converting them to a smaller format to hopefully speed up spooling time. Funny enough, it took longer to print a 159KB gif file than a 1344KB tiff file. My question is, does anybody know of a way to decrease the amount of time it takes to print these images? Thanks.
|
|
|
|
|
I think it really depends on the capabilities of your printer. In which case short of writing your own device driver there isn't anything you can do.
|
|
|
|
|
But can anybody explain why it takes longer to print a 159KB gif image than it does to print a 1344KB tiff image?
|
|
|
|
|
.NET sends _all_ data to a printer using Raster images. This means if you only send plain taxt to a printer, it still converts it into a raster image. If you communicate with the printer via the Serial port it takes quite a while.
If you only want to send text you can develop a component in VB (VS 6.0) that sends plain text to a printer and use this in .NET.
can't help with the image though...
|
|
|
|
|
Looking of your great help gurus.
I new to know how to get the current user info, namely, domain user name and computer name, IP address.
How to get these Net details in C# ?
Best Regards,
Ashraf.
|
|
|
|
|
To get the domain name, you can use Environment.UserDomainName . For the username, you can use Environment.UserName . To get the computer name, use Environment.MachineName . If you want more information than this, you can P/Invoke the Network Management APIs. See the API documentation on MSDN at http://msdn.microsoft.com/library/en-us/netmgmt/netmgmt/network_management.asp[^] for more information about the Network Management API.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
My many thanks to you. It was very helpping..
Keep best of support to each other..
Best Regards,
Ashraf Alsadiq.
|
|
|
|
|
Hi there,
I'm a newbie in C# and learning the language right now.
I have MFC backgrounds for almost 10 years now and I want to migrate to C#.
My question is simple... What is the equivalent of the MFC TRACE macro for C#?
The goal is to display traces in the output debug window of the IDE the same way as TRACE macro.
Thanks for the answer.
Best regards.
bouli.
|
|
|
|
|
Although these are not macros they are much more powerful than the MFC equivalents.
System.Diagnostic.Trace.WriteLine();
System.Diagnostic.Debug.WriteLine();
The Debug version will only work in the debug build (or any build where you #define DEBUG ).
The Trace version is more for instrumented builds where you want the output to go to a log file of the system event log and it is valid to have available in the release build. The Trace version will only work where you #define TRACE .
See also TraceListener
Also, for future reference: In the next version of .NET the Trace classes are meant to be vastly improved.
--Colin Mackay--
EuroCPian Spring 2004 Get Together[^]
|
|
|
|
|
Hi,
Nice stuffs!
No possible comparison with the simple TRACE macro
Thanks.
|
|
|
|
|
To add to that, the DefaultTraceListener will output messages you pass to Trace or Debug to the output window when you're debugging your application in .NET. To write to files, the event log, or any custom targets you can use additional TraceListener implementations even at runtime (we use one for error logging in our app).
You're right, though, it is much better than the various TRACE macros, though - as Colin mentioned - a much better trace facility would be nice and is expected. To elaborate, every message you pass is passed to each TraceListener , regardless of whether or not they want to handle it (based on a TraceSwitch setting or other proprietary filtering). This can hamper performance.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Call me stupid, but after coding for 1 year now, I'm going to ask such a trivial question:
Object o; //Where does o fit in memory?
o = new Object(); //Now what? Instantiated? What's that?!
//Work on o somehow; then:
o = some_fuction_that_returns_a_newly_created_object(); //Now?
How about the first o that was allocated? I used the same variable to point to two instances (or at least that's what I think) consequently. What happens to the first instance? What about if I want to destroy this o in memory because I simply don't need it anymore?!
Thank you, I appreciate your patience.
Sammy
"A good friend, is like a good book: the inside is better than the cover..."
|
|
|
|
|
profoundwhispers wrote:
Object o; //Where does o fit in memory?
It allocates enough memory on the stack for a reference (pointer) to the actual object (what ever it may eventually be)
profoundwhispers wrote:
o = new Object(); //Now what? Instantiated? What's that?!
This allocates memory on the heap for the newly instantiated object.
profoundwhispers wrote:
o = some_fuction_that_returns_a_newly_created_object(); //Now?
the actual newly created object will be on the heap. o itself is still a pointer/reference on the stack to that object.
profoundwhispers wrote:
How about the first o that was allocated? ... What happens to the first instance?
The garbage collector will remove it from the system when it gets around to it, assuming nothing else is referencing it.
profoundwhispers wrote:
What about if I want to destroy this o in memory because I simply don't need it anymore?!
If you don't need it anymore just don't reference it. The garbage collector will free the memory when it gets around to it.
One caveat is objects that have a Dispose() method. These usually have resources that the managed heap in .NET cannot garbage collect efficiently. When you no longer need these objects you should call Dispose(). The garbage collector would eventually Dispose it anyway, but it will take a few attempts at it.
--Colin Mackay--
EuroCPian Spring 2004 Get Together[^]
|
|
|
|
|
Thank you, this was extremely helpful!
Sammy
"A good friend, is like a good book: the inside is better than the cover..."
|
|
|
|
|
Hi Folks,
Let me just say I'm a programming newbie. I have this problem that's been irritating me.
I have a list view in my app and I've specified a DataSource for it. I have other functions that are constantly updating the Array that is the DataSource (it's an array of integers, in this case.)
The only way I've found to have the ListView update is to set the DataSource to null and then reassign it. Is there a more elegant way to do this?
Thanks!
|
|
|
|
|
|
Hi,
I've created an icon-file with a 16x16 icon and selected that file in the "Icon" property of my main form. This changes the icon in the top-left corner of the app, but it doesn't change the icon that appears in the ALT-TAB sequence pop-up. I suppose that I need a 32x32 icon for that purpose, but even if I create a such in the icon file - it still doesn't change from the default .Net icon when running the app. Any ideas ?
/Jan
Do you know why it's important to make fast decisions? Because you give yourself more time to correct your mistakes, when you find out that you made the wrong one. Chris Meech on deciding whether to go to his daughters graduation or a Neil Young concert
|
|
|
|