|
This is not C++.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Guy Incognito wrote:
That was my first reaction too, but cout is definatelly C++.
yeah, that is. I reckon the rest is some custom library, or assembler. I dunno enough assembler to be sure either way.
Guy Incognito wrote:
Perhaps it is not even possible to perform this task if the .NET Framework does not support such file information. Am I right?
I can't see the code now, but it looked like it was polling a port for an external device from memory. In theory I think you can call functions to do that by loading the dll, assuming they exist. But I'd go the COM interop route personally.
Guy Incognito wrote:
Wrap the function in a COM DLL and generate an interop assembly.
Yeah, that's what I'd do. I didn't really think about it before, sorry.
Guy Incognito wrote:
Sorry. Push-ups for you...
Not sure why, but fine, they'll do me good. )
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
sorry i forgot to check the box that says 'Do not treat <'s as HTML tags'
here's what it was:
#include <iostream.h>
#include <windows.h>
#include <conio.h>
and this is suppose to be code to read the cpu temp from a winbod W83697HF/F chip. so if i can't get this converted to c# can someone help me make it work in c++?
thanks,
Rob Tomson
--
There are 10 kinds of people. Those who understand binary and those who don't.
|
|
|
|
|
Or just type < for < and > for >.
You won't be able to get this to work in C# because it's too low-level for what the framework allows (not C#, since it's just a language that compiled to IL and targets the CLR).
Your best bet is to go to the manufacturer site for your mobo or cpu. You're answers should be there. As Christian mentioned, either put this code in a COM dll or as an export function in a simple DLL that you can P/Invoke. Either way works, but the latter doesn't require registration.
-----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-----
|
|
|
|
|
Is there a way of coloring the scrollbars of the list view?
Also is there a way of using only the vertical scrolling without the horizontal ?
Thanx in Advance
compubaby
|
|
|
|
|
The answer to both questions (though the second may not be possible) is to override WndProc and handle the Windows messages yourself (calling base.WndProc for the default implementation when desired). See the Platform SDK for more information on the list view common control and its related messages, notifications, and styles.
-----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-----
|
|
|
|
|
Hello,
I have a few general questions about how to go about implementing sounds in my application.
I have created a dictionary program with english and spanish words. It uses an Access database to store the dictionary information.
I want to record sound clips of all of the spanish words (about 600 of them), and allow the user to push a button to hear the pronunciation of the word. First of all, does anyone have any opinions on what the best way to implement sound would be. Should I use wav files and use the playsound from the Windows API, or should I use DirectSound, or should I try something else like the nBASS library? I basically just want the easiest way to play sounds, and I don't want to take up too much space on the user's computer.
Also, would it be best to embed the sounds in the database, or to have them as external files in the application folder?
Any suggestions would be helpful. Thanks!
Blake
|
|
|
|
|
Any of those libraries deal with WAV files, and your WAV files will pretty much be the same size depending on recording quality. As we discussed before, if you want to decrease the size you'll need to encode them as MP3s, OGGs, WMAs, or whatever.
As far as storing them in the database, it's just my opinion that this would add a lot of complexity because you have to (in most cases) get a "pointer" to the data and use a stream to save the file (perhaps just to memory) so that it could be played. Perhaps there's an easier way, but simplying playing a persistent file would be easier. In either case, the file will take up about the same amount of room. The database (at least Access) won't compress the contents, so it would be the same size in the database that it would be on disk. The only difficulty with the disk approach is that your database probably shouldn't store absolute paths (to work in any case and in any location) so your program should resolve the path to the same file. For instance, lets say you store the path relative to the application's installation directory. You could then do a simple Path.Combine :
string relpath = path_from_database;
string path = Path.Combine(Application.StartupPath, relpath);
PlaySound(path);
-----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 for the information.
The main reason that I thought about storing the sounds in the database is to keep from having 600 individual wav files in the application folder, so that it seems neater. Do you think this would matter at all?
Blake
|
|
|
|
|
Not really, no. NTFS does a lot better job of many files in a directory. Overall, I would think, it'd still be faster than having to stream BLOBs froma database. I've never done this myself, though (never had a reason to), and have only read about it for the SQL classes (presume that OLE DB would be a little more cumbersome because it's generic - if even possible).
As far as the "application folder", I would create a subdirectory (if you choose this approach) to hold them so it doesn't clutter the application directory itself. This is pretty common in a lot of applications (take Office and its directory structure, for example).
-----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-----
|
|
|
|
|
Heath Stewart wrote:
NTFS does a lot better job of many files in a directory.
As long as that many is below 10000, after that it starts choking...
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
blakeb_1 wrote:
I want to record sound clips of all of the spanish words (about 600 of them),
I suggest as Heath said a database would be good, seeing that maintainance will be easier.
Another option is to make a binary container file with a header specifying offsets to the soundfiles. nBASS allows you to play a sound clip straight from a MemoryStream.
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
What should I search for to find good references for doing this?
|
|
|
|
|
nBASS[^] (you'll notice that leppie wrote 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-----
|
|
|
|
|
Actually I was talking about information for making a binary container file. Is this the actual name for these types of files. I searched for it in Google but couldn't find anything that looked like it was a way to store all the sounds in one file. I'm just trying to find a reference for making a binary container file.
Blake
|
|
|
|
|
As leppie was saying, it's just a file with offsets - your typical archive type file. You could have a structure as the first blob in the file like so:
public struct Header
{
public int count;
public FileHeader[] headers;
}
public struct FileHeader
{
public string Filename;
public long Offset;
public long Length;
} You fill the Header structure with information, such as how many files are in the archive and an array that represents each file. You can provide a filename (might as well) and a byte offset to where that file is found. You can get a lot more advanced than this, and even this basic example wouldn't work as well as many others out there.
Basically, though, you take that offset (either from the beginning of the file (offset 0) or from the end of the Header (offset == size of Header , including the array of FileHeader s), and start reading a byte array from that Offset until Length bytes has been read.
There is no standard way of doing this, but I do remember seeing a couple of articles about archives here on CP. You could try googling for keywords such as archive, header, and other stuff I've used here. leppie might have some other suggestions.
-----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-----
|
|
|
|
|
how can i detect whether or not the computer is connected to the internet? i guess i need the .NET version of InternetGetConnectedState().
thanks
|
|
|
|
|
Short of attempting to make a connection (through many different means using classes in the System.Net namespace) and catching / parsing the appropriate exception, you could just P/Invoke InternetGetConnectedState :
[DllImport("wininet.dll")]
public static extern bool InternetGetConnectedState(out int flags, int reserved); If you don't care about the state of the connection (just whether or not there IS a connection), you don't have to worry about the flags parameter, but you still have to pass a value:
int flags;
if (InternetGetConnectedState(out flags, 0))
{
}
-----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 never used it in vb6, but now I need it in c#, lol. Does anyone know of an easy way to emulate a datarepeater control in c#. I need to add multiple user controls that have timers going on them to a listbox, and have them viewed and edited in that list box, which Im pretty sure the datarepeater control use to do.
Thanks,
Ryan
|
|
|
|
|
All you need to do is use a collection of controls (these timer controls you mentioned) and add them sequentially to the parent control's Controls collection, while setting their Size and Location properties. Presumably, their Size would be based on the parent's Width and the control's Height , and you could set the X and Y coordinates in the Location property programmatically when you add the controls to the parent control collection (incrementing and keeping track of the last Y position used, for instance.
If you're talking about the Repeater control in .NET, however, that is only for ASP.NET and won't work for Windows Forms controls since it merely generates HTML.
-----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 am reasonably competent with C# (please note that "reasonably" is a very subjective term), but don't have much (read: any) experience building user controls.
The (very simple) user control I am having problems with contains two panels, three labels and a combobox. Which of the two panels is visible depends on whether the control is currently in edit mode. Currently I have the control go into edit mode and thus change which panel is visible when any control in the user control is clicked. I am looking for a clean way of doing the opposite: I can't seem to find an event that will fire when a user clicks on another part of the form. Therefore, the control still looks like it's being edited while the user is off doing something else entirely.
I'm sure the answer will be sufficiently simple so as to make me feel foolish for asking, but it's really starting to irritate me.
Any help would be appreciated.
Charlie
Here I am. Love me.
|
|
|
|
|
You should be able to handle the LostFocus event (or Leave event) of the UserControl itself, since the GotFocus and Enter events bubble up. This way, when any control in your UserControl (and thus the UserControl itself) loose focus, you can switch your panels' visibility.
-----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-----
|
|
|
|
|
Thank you for the response. It turned out that by making the panel visible, but not giving focus to any of the controls on it, that the original control still had the focus and as such, no LostFocus event would fire Your reinforcement that I was handling the correct event allowed me to stop looking araound aimlessly and figure out what the problem was.
Thank you.
Charlie
Here I am. Love me.
|
|
|
|
|
"Dynamic Table Creation on Database Using SQL Datatypes from a Dataset" quite a mouth full, but that's what we are trying to do!
We have a source database which is of one data-provider, and a destination which is of another provider. The source database is in structural flux, so we need to be able to dynamically create a destination database from a dataset populated by a select * from table. Then read off the column names and types and recreate it on a different database.
There are about 30 million examples of Datasets and datagrids, but nothing that actually has the same effect as an CREATE TABLE as we've seen.
When interrogating the dataset we get the .Net datatypes. What we need is the SQL datatypes associated with those .Net datatypes for that particular provider (probably via the SqlDataAdapter?) so we can build a decent CREATE TABLE query that the provider will understand from the contents of the dataset.
Or better yet just get .Net to do it, because it obviously already knows the mappings or it wouldn't be able to translate datasets into .Net types from SQL types when reading, and back again when updating!
Any ideas or avenues of investigation gratefully received!
/**********************************
Paul Evans, Dorset, UK.
Personal Homepage "EnjoySoftware" @
http://www.enjoysoftware.co.uk/
**********************************/
|
|
|
|
|
No, a database can't be created from a DataSet - at least not with classes in the BCL. There might be some third-party library out there that can do it, though. Mapping from a database (table, view, or stored proc) to a DataSet is easy but there just isn't support for the other way because it typically is not done (backends are usually written and mostly solidified when application coding begins).
It's obvious that one of these is a SQL Server installation, so why not just use a DTS transform? For any database with an OLE DB provider, you can create appropriate table structures, transform (if necessary) and copy data, and some other things. You even get a nice graphic utility to help you with the transform and these DTS transforms can be saved and executed again and again (hint, you can use this technique with the SQL DMO library, either using a script, native COM client, or .NET interop assembly). This is by far a better - and faster - way of doing 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-----
|
|
|
|