|
It is a code from MSDN.
It complies and links but does not executes giving the following error
File:i386\chkesp.c
line:48
The value of ESP was not properly saved across a fuction call.This is usually a result of calling function decleared with one calling convention with a funciton pointer decleared with a different calling convention.
#include windows.h,Setupapi.h>
#include stdio.h
DWORD Err;
HDEVINFO DoDeviceEnum( GUID InterfaceClassGuid)
/*
Routine Description:
Retrieves the device information set that contains that contains
the devices of the specified class.
the devices of the specified class.
Parameters:
InterfaceClassGuid - The interface class GUID.
Return Value:
If the function succeeds, the return value is a handle to the
device information set.
If the function fails, the return value is zero.
*/
{
HDEVINFO DeviceInfoSet;
HDEVINFO NewDeviceInfoSet;
// Create a device information set that will be the container for
// the device interfaces.
DeviceInfoSet = SetupDiCreateDeviceInfoList(NULL, NULL);
if(DeviceInfoSet == INVALID_HANDLE_VALUE) {
Err = GetLastError();
printf( "SetupDiCreateDeviceInfoList failed: %lx.\n", Err );
return 0;
}
// Retrieve the device information set for the interface class.
NewDeviceInfoSet = SetupDiGetClassDevsEx(
&InterfaceClassGuid, // address of guid required
NULL, // no enumerator
NULL, // no parent window handle (might not be a good idea…)
DIGCF_PRESENT | DIGCF_DEVICEINTERFACE, // flags
//DeviceInfoSet, // do not pass this in, not in function prototype
NULL, // NULL implies local machine
NULL // Reserved’ must be null
);
if(NewDeviceInfoSet == INVALID_HANDLE_VALUE)
{
Err = GetLastError();
printf( "SetupDiGetClassDevsEx failed: %lx.\n", Err );
return 0;
}
return NewDeviceInfoSet;
}
int main(int argc, TCHAR* argv[])
{
GUID var;
DoDeviceEnum(var);
return 0;
}
|
|
|
|
|
Is there anyone out there working on creating a chart program or already created one that uses (8) samples to draw the lines? Program also needs to allow user to select up to 100 samples for line smoothness. I am working on such a program and need some help finishing it. Thanks to all who can help.
|
|
|
|
|
I need a DateTimePicker that acts like a CComboBox when the drop down arrow is invoked. More specifically, I need the DateTimePicker so that the user can adjust a date as needed, but when the user selects the drop down arrow, he is able to select from a finite number of strings stored in the CComboBox.
For instance: if the DateTimePicker showed the date (which can easily be adjusted by the user) 1/1/2000, the drop down arrow would display:
5/7/1999
4/12/1998
1/20/1996
3/15/1990
Does anyone know how I can set about creating this hybrid monster?
|
|
|
|
|
Hi, I have a textbox on the main form and I want to read in some text files to it, I don't want to use MFC.
I have an OPENFILENAME structure and I can read the file, but I can't extract the file's contents into the textbox. For example I have a file called MyFile.txt and I want the text in that file to be loaded into my text box. I hope I explained it well enough.
Thank you in advance for your help.
The only thing you can count on in life is death.
|
|
|
|
|
Have you looked into CreateFile() , and ReadFile() ?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Read my iostream articles for the standard way to retrieve information from files.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
go for the basic ones.....fgetc(),fopen()....tis just a suggestion!!!
cheerz.....
"faith, hope, love remain, these three.....; but the greatest of these is love" -1 Corinthians 13:13
|
|
|
|
|
What command do I need to to use to determine the check state of a menu item in another app?
As an example lets use the "View > Status Bar" In IE. I wish to create an app that will determine the check state, and give a visual indication, as this app, unlike the status bar, has no visual unless you look at the menu itself.
Jeff
|
|
|
|
|
Well, the trouble you have is that the check state is generally determined JUST before the menu item is shown. There's a message that's called before a menu item becomes visible, and it's set to be checked there. So the only way for this code to execute in the other app is for the menu to be clicked ( ignoring all your other issues with controlling it from another app for a moment ).
Why do you need this ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
To make a long story short, I have a DJ application that allows me to hide items with a rating of zero. This is a menu item with check. I wish to have an indicator on my helper app that gives me a visible status of this setting, as well as if logging is turned on or off.
I am able to determine the state with the madcodehook, but wish to accomplish this without it's use.
http://help.madshi.net/madCodeHook.htm[^]
If I can bring it up in a known state, it wouldn't be an issue. I'm sure there is a setting in the registry for this, just not sure were it would be.
|
|
|
|
|
Maybe I just haven't seen a good example of parsing input, but you'd think it would be easier. This is what I've seen done:
...
char input[20];
string theString;
cin.getline(input, 20);
theString = string(input);
myObject A(theString);
...
But, I need to parse theString in the constructor of A , so I need to do something like...
...
private:
int firstNumber;
...
int x = 0;
while(isdigit(theString[x])) {
x++;
}
firstNumber = atoi(theString.substr(0,x));
...
...which doesn't work. If anybody could share the more elegant (and functional ) approach that they use, I would be most gratefull.
|
|
|
|
|
For starters, I prefer this:
string s;
getline( cin, s );
to creating an array needlessly.
Then, have you stepped through to see what's going on ? Where does it 'fail' ? Do you get back the entire string/nothing/half a number ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Well, I get this compile error:
error C2664: 'atoi' : cannot convert parameter 1 from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' to 'const char *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
The exact line is:
<br />
whole = atoi(theString.substr(0, x));<br />
where x and whole are integers.
|
|
|
|
|
I should have looked more closely. atio is a C library function, it knows nothing of classes or the STL. You need to call the c_str() function on the string to get back a const char *.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Thanks Christian. I changed my code to:
<br />
whole = atoi((theString.substr(0, x)).c_str());<br />
and all is well. Thanks alot!
|
|
|
|
|
This will work just fine:
firstNumber = atoi(input); atoi() stops processing when it encounters the first non-numeric character.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
This is actually a generalized question, but I am writing in C++, so I am putting it here:
In regards to Reading from the serial port in C++ using the Win32 API: Is there a way to know when there is no data to be read from the port without using flow control? Basically my situation is this: I am just passively reading from the serial port, I never send any data, just receive it. So I just want to read from the port until there is nothing more to be read, then go do something with the data I read, then go back and read some more. Currently, I was using a timer (specifically SetTimer()) to call the read function every 100ms, however, I was missing a lot of data this way, so I am looking for a way that would allow for all data to be receieved and buffered correctly. My connection is 115200 baud with 0% error rate, so it is simply my read function that is causing the missed data.
If anyone could lend some suggestions it will be greatly appreciated.
thanks
|
|
|
|
|
|
Hi all,
I need to add a chart control to my dialog.
I can find references to MSChart on the web but as far as I can tell I do not have that object on my system.
Is MSChart something that is included with VB installation?
The only charting objects I can find are Microsoft Office Chart 9 and 11. I need to add data to the chart from user input one point at a time.
What can I do?
---
|
|
|
|
|
Coremn wrote:
...as far as I can tell I do not have that object on my system.
Search for mschrt20.ocx .
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
It simply does not exist with my install of MSVC or any of the other work computers with MSVC. I have a lot of other activeX controls that I can include, just not MSChart. Did I miss it on the install?
---
|
|
|
|
|
I have a need to create an area of a CView window to hold OpenGL scenes. I was able to load a scene into a CView without problems, however, when I attempted to designate the scene coordinates, it only affected the aspect ratio of my polygons but still painted the whole view black (confirming that it did not conform to my boundaries.)
Has anybody attempted this? Please help!
When the going gets tough... just write source code to fix the problem. I suggest Perl!
|
|
|
|
|
Did you use glViewport?
Don't try it, just do it!
|
|
|
|
|
yeah, in my OnSize() function, I have a call to glViewPort to set the view's dimensions, however, whenever I alter the dimensions, it only affects the shapes themselves, but still paints the whole view black.
IloveCheeese
|
|
|
|
|
Hi, I have a simple code but I couldn't make it run...
#include "stdafx.h"<br />
<br />
typedef int DataType;<br />
<br />
const int MAX_SIZE = 50;<br />
<br />
void merge(DataType theArray[], int first, int mid, int last);<br />
void mergesort(DataType theArray[], int first, int last)<br />
<br />
int _tmain(int argc, _TCHAR* argv[])<br />
{<br />
int arrayToSend[4] = { 1, 2, 4, 3 };<br />
mergesort( arrayToSend, 0, 3 );<br />
return 0;<br />
}<br />
<br />
void merge(DataType theArray[], int first, int mid, int last)<br />
{<br />
DataType tempArray[MAX_SIZE];
<br />
int first1 = first;
int last1 = mid;
int first2 = mid + 1;
int last2 = last;
<br />
int index = first1;
for (; (first1 <= last1) && (first2 <= last2); ++index)<br />
{
if (theArray[first1] < theArray[first2])<br />
{ tempArray[index] = theArray[first1];<br />
++first1;<br />
}<br />
else<br />
{ tempArray[index] = theArray[first2];<br />
++first2;<br />
}
}
<br />
<br />
for (; first1 <= last1; ++first1, ++index)<br />
tempArray[index] = theArray[first1];<br />
<br />
for (; first2 <= last2; ++first2, ++index)<br />
tempArray[index] = theArray[first2];<br />
<br />
for (index = first; index <= last; ++index)<br />
theArray[index] = tempArray[index];<br />
}
<br />
void mergesort(DataType theArray[], int first, int last)<br />
{<br />
if (first < last)<br />
{
int mid = (first + last)/2;
mergesort(theArray, first, mid);<br />
mergesort(theArray, mid+1, last);<br />
<br />
merge(theArray, first, mid, last);<br />
}
}
I get errors like
d:\CD\myProjects\Homeworks\hw2Q4\hw2Q4.cpp(5): warning C4518: 'int ' : storage-class or type specifier(s) unexpected here; ignored
d:\CD\myProjects\Homeworks\hw2Q4\hw2Q4.cpp(5): error C2146: syntax error : missing ';' before identifier 'main'
d:\CD\myProjects\Homeworks\hw2Q4\hw2Q4.cpp(13): fatal error C1075: end of file found before the left brace '{' at 'd:\CD\myProjects\Homeworks\hw2Q4\hw2Q4.cpp(11)' was matched
Any help would be appriciated.
|
|
|
|
|