|
As John Drescher suggested, use a "port access" library.
I have personally used inpOut32.dll http://www.logix4u.net/inpout32.htm[^] - works like a dream.
The only problem I remember is that the documentation was not clear regarding data size. I think that it does 8-bit inputs and outputs, so if you want to read a 16-bit value, you have to read from an odd port and from an even port, shift one byte by 8, and add, etc. And if you want to write a 16-bit value, you have to split it to two 8-bit outport32 calls.
For example, if you want to read a 16-bit status from port 0x302:
usStatusTemp1 = inp32(0x302);
usStatusTemp2 = inp32(0x303);
usStatusWord = usStatusTemp1 + (usStatusTemp2<<8);
|
|
|
|
|
I have inherited some C++ code compiled under VS 2005. I would like to generate a list of the external dependencies now that the dev environment no longer lists them. Are there any tools/ addins that can do this? Thanks.
|
|
|
|
|
|
I would like to plot a basic collection of data into a 2d line graph.
I am writing the rest of my program in Visual C++.NET as an MFC app so I would like to stick with a solution that will utilize this.
I would like to make something simple like this (only add labels for each axis):
Click for Picture
anyone have any ideas???
-- modified at 16:46 Monday 24th July, 2006
|
|
|
|
|
|
Forgive me for being the late bloomer, but I haven't had the need to add Automation support to a project using VC++ 2003 until today.
In VC++ 6.0, I was able to add a class, give it automation support, and declare the methods and properties fairly painlessly and the wizards would do most of the .idl and map stuff for me. I'm probably not standing on my head just right today or VC++ 2003 approaches this in a modified way. Is the process of adding automation support to a class performed manually now? Or is there a trick to getting the .idl and maps to get populated automagically as I add my methods to the class?
-- modified at 16:39 Monday 24th July, 2006
The project has Automation support (i.e. I checked the "Automation" checkbox during project creation.)
|
|
|
|
|
Why I can't find this stuff until after I post a question here, I'll never know.
Anyway, I found the context menu for adding methods and properties over the interface icon.
Sorry about the post.
|
|
|
|
|
function strcmp seems to be returning zero (0) while it is expected to return a negative value when, for example strSentence[1] = "this is a test" and strSentence[2] = "another test".
int iLineNumber = 1;
int x = (strcmp(strSentence[iLineNumber], strSentence[iLineNumber + 1]) < 0);
int y = NULL;
while (iLineNumber < iMaxLineNumber)
{
if ((bAscending == true) &&
// lines are not empty
(strSentence[iLineNumber]!= 0) &&
(strSentence[iLineNumber + 1]!= 0) &&
// first line is smaller than the following line
(strcmp(strSentence[iLineNumber], strSentence[iLineNumber + 1]) < 0))
{swapPos(iLineNumber, iLineNumber + 1);}
else if ((bAscending != true) &&
// lines are not empty
(strSentence[iLineNumber]!= 0) &&
(strSentence[iLineNumber + 1]!= 0) &&
(strcmp(strSentence[iLineNumber], strSentence[iLineNumber + 1]) > 0))
{swapPos(iLineNumber, iLineNumber + 1); }
iLineNumber++;
}
Jon
|
|
|
|
|
Actually strcmp[^] should return >0 for strcmp("this is a test", "another test").
|
|
|
|
|
jon_80 wrote: strcmp(strSentence[iLineNumber], strSentence[iLineNumber + 1])
jon_80 wrote: strSentence[1] = "this is a test" and strSentence[2] = "another test"
If your first line starts with a 't' and your second line starts with an 'a', strcmp will return >0. Since you are only checking for <0, it will pass that test. You probably want to change your test to either >0 or simply !=0 and then see which order it should be in.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
I'm actually checking for strcmp ... < 0 and also for strcmp ... > 0, besides I'm checking for other conditions.
bAscending is a boolean determining how the array should be sorted, while strLineNumber[] is the array holding the string values.
while (iLineNumber < iMaxLineNumber)
{
if ((bAscending == true) &&
// lines are not empty
(strSentence[iLineNumber]!= 0) &&
(strSentence[iLineNumber + 1]!= 0) &&
// first line is smaller than the following line
(strcmp(strSentence[iLineNumber], strSentence[iLineNumber + 1]) < 0))
{swapPos(iLineNumber, iLineNumber + 1);}
else if ((bAscending != true) &&
// lines are not empty
(strSentence[iLineNumber]!= 0) &&
(strSentence[iLineNumber + 1]!= 0) &&
(strcmp(strSentence[iLineNumber], strSentence[iLineNumber + 1]) > 0))
{swapPos(iLineNumber, iLineNumber + 1); }
iLineNumber++;
}
Jon
|
|
|
|
|
jon_80 wrote: function strcmp seems to be returning zero (0)...
How are you verifying this?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
strcmp() should return 1 , thus making the condition false, thus assigning 0 to x . Do you concur?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I am expecting it to return a negative value, not a zero. What do you think?
MSDN
Strcmp
Return Value
Returns zero if the strings are identical. Returns a positive value if the string pointed to by lpStr1 is greater than that pointed to by lpStr2. Returns a negative value if the string pointed to by lpStr1 is less than that pointed to by lpStr2.
Jon
|
|
|
|
|
Why would you expect it to return a negative value when 't' is clearly greater than 'a'? The function is behaving correctly.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello guys,
I was wondering if someone could tell me the code to accept keyboard shortcuts (either one or two button presses) and a music file will play
e.g I press "1" on the keyboard and a certain sound clip plays
I have been looking at "keybd_event()" and "sendinput()"
with not much luck, I have to add I am a beginner at programming with C++
I hope to develop the program so that there is an option page where you can browse for sound files and assign to different keyboard buttons
I have intermediate knowledge in programming with PHP and i have developed a simple program in c++ before
Thanks in advance
|
|
|
|
|
|
Is there anyway to open a console window, where cout/cin can be used, from within a a Windows forms project? For example, I have a typical GUI interface and would like the option to use a command line interface instead. Using cout/cin does not work because there is no console window to output to or input from. How do I open this window without having to create a completely separate Win32 Console application?
kialmur
|
|
|
|
|
kialmur wrote: Is there anyway to open a console window, where cout/cin can be used, from within a a Windows forms project?
Certainly. See here and here.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Is there no way that I can just open a console and use cout/cin? No forms are open at this point. It seems like quite a complex process just to write to a console.
|
|
|
|
|
When you create a windows app that has a WinMain entry point, there isn't an easy way to create a console. That said, if you want to go the other route (create a console app that spawns your window at some point), it isn't too difficult, but does require some work as far as setting up message loops and such.
Basically, yes, you can have a window with a console. No, it isn't easy to set up.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
kialmur wrote: Is there no way that I can just open a console and use cout/cin?
Sure, if you are creating a simple console application. However, since you have a GUI application, the rules change.
kialmur wrote: seems like quite a complex process just to write to a console.
So just wrap it all up into a nice little class, and whenever you want something to be displayed in a console window, instantiate your class, and invoke a few methods. You could even skip the class part, and just put it all in a function (or three). Just call the functions whenever you want something to be displayed in a console window.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Is it possible to prevent the user of an application to use mouse & keyboard for certain operations? Im mean disabling mouse & keyboard for some parts of the program and after that re-enablig that. In VC++, please
|
|
|
|
|
why not simply ignore mouse / keyboard events ?
|
|
|
|