|
Hello everyone,
My VC++ application is currently polling a digital input from a digital I/O card and perform some task if the signal is logic high. The card can be configured to generate a hardware interrupt (i.e. IRQ 2~7) on input logic-level change through jumper settings. Can anybody give me some idea on how to add codes to detect the hardware interrupt in NT systems? Do we need DDK to intercept the hardware interrupt?
Thanks..
|
|
|
|
|
You need a device driver, see the DDK documentation if you want to write one.
Does the card come with one? many times you can get the driver from the manufacture (and if you can't you should ask why not). If they provide the driver you need to ask them how to interface to it.
|
|
|
|
|
Thanks for the reply. The card comes with bunch of DOS-based libraries to access all of its functions and the manufacturer don't have driver support for Windows. Can you give me a link on where to start searching for examples on how to intercept a hardware interrupt?
Thanks in advance.
|
|
|
|
|
I couldnt even load the image..im getting errors..can anyone help me to load, display and convert an image to grayscale in c++? thank you in advance
|
|
|
|
|
|
I defined a structure called STUDENT in one header file, and I
need to use that data type in another header file. Normally,
if it was just a global variable, I could have just used extern,
however, in this case, what should I do?
Thanks
//bitree.h
<code>
typedef enum MAJOR_t {
CS, MIS, ME, PHI
} MAJOR;
typedef struct STUDENT_t {
char name[64];
unsigned int ID;
char sex[2];
MAJOR major;
struct STUDENT_t *left;
struct STUDENT_t *right;
} STUDENT;
// another header file
<code>
STUDENT* Load(FILE *fp);
void Save(STUDENT* node, FILE* fp);
-----------------------------
C++ without virtual functions is not OO. Programming with classes but without dynamic binding is called "object based", but not "object oriented".
|
|
|
|
|
Just include your header file, bitree.h, in the file that needs to use it.
A simple #include "bitree.h" , at the top of the other header file should do the trick.
I Dream of Absolute Zero
|
|
|
|
|
Yes, I included it, but I got an error. Then I combined them
into one header file, it was fine, but that was not what I
intended to. I want to make them into two seperate header files.
Any idea?
-----------------------------
C++ without virtual functions is not OO. Programming with classes but without dynamic binding is called "object based", but not "object oriented".
|
|
|
|
|
Alex Ngai wrote:
I want to make them into two seperate header files.
Having separate definition files for your classes and structures is a common practice. But in order to use the structures and classes defined in one file in another, it needs to be made aware of its existance. Now if you are getting errors on inclusion, then may need to look at the way it is being included (maybe definition conflicts between both files).
Alex Ngai wrote:
Yes, I included it, but I got an error.
What's the error message, and how are you including the file?
I Dream of Absolute Zero
|
|
|
|
|
add in your header files
#pragma once
or
#ifndef __MY_UNIQUE_FILE_IDENTIFIER_RELATED_TO_THIS_FILE_<br />
#define __MY_UNIQUE_FILE_IDENTIFIER_RELATED_TO_THIS_FILE_<br />
<br />
<br />
<br />
#endif
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Look at the order of your includes, the struct must be included before any header that will use it.
If you can't do that, you can get by with a
struct student;
declaration before you use this struct, (but I think only if you use it as a pointer, which isn't nice either)
|
|
|
|
|
I have been trying to use a 'union' with a enum type in it but keep getting various errors;
e.g. if I use this scheme:-
typedef struct <br />
{<br />
unsigned data : 1 ; <br />
}W12_RESERVED4_DATA;<br />
<br />
enum W12_SELECTED_SOURCE_DATA { ON,OFF }; <br />
<br />
typedef struct <br />
{<br />
unsigned data : 8 ; <br />
}W12_RESERVED5_DATA;<br />
<br />
union M_TT1_UNION<br />
{<br />
W12_RESERVED4_DATA item1_data;<br />
W12_SELECTED_SOURCE_DATA item2_data;<br />
W12_RESERVED5_DATA item3_data;<br />
unsigned short buffer[32];
}m_tt1;
This gives error:-
c:\Database\Database2.c(973): error C2061: syntax error : identifier 'W12_SELECTED_SOURCE_DATA'
If I wrap up the enum in a structure I get a different error
typedef struct <br />
{<br />
enum W12_SELECTED_SOURCE_DATA { ON,OFF }; <br />
}data02;<br />
<br />
union M_TT1_UNION<br />
{<br />
W12_RESERVED4_DATA item1_data;<br />
data02 item2_data;<br />
W12_RESERVED5_DATA item3_data;<br />
unsigned short buffer[32];
}m_tt1;
c:\Database\Database2.c(494): error C2208: 'W12_SELECTED_SOURCE_DATA': no members defined using this type
How can I get this enum working as part of this union. I did want to overlay many bit fields with this buffer, but no luck todate.
Are they another way to overlay bits, shorts and floats with a buffer?
|
|
|
|
|
Just to let you know that I looked at your enum problem. I cut the first snippet of code out and pasted it into my compiler to try to see what was wrong with it. It compiled just fine - very strange! Anyway just to let you know in case it helps.
Cheers,
Ali
|
|
|
|
|
Thanks for the post.
The project that caused the erros was a Win32 Static Library, but it complied fine (as you said) in another project.
I deleted the last project and started again, the only difference was I renamed the files from Myfile.c to MyFile.cpp and no errors.
I could see no different in either project settings.
But problem gone.
|
|
|
|
|
HI
while using SetTiemr (,,,,);
wt is the maximum Elapse time , we can set.
Means to say it takes it in milli seconds
we can conver it to hours or manyhrs(dayz)
1000 * 60 * 60* 24 = 24 hrs
or is it depends on System( Processor etc)
thanx
|
|
|
|
|
The elapse time is a UINT and is 32bits on Win32 machines.
So you can enter a number up to 2^32 or (4,294,967,296) which will hold 49 days quite easily.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
listCtrl problem:
Hello
I am inserting some item to list control from database.
Say items are stored in database as following:
A1, B1, C1, A2, B2, C2,A3,B3,C3 ------ line 1
My list control is in ascending sort order, so it displays the design as alphabetically ascending order:
A1, A2, A3, B1, B2, B3, C1, C2, C3 ------ line 2
Now in list box i am selecting B1,B2,B3 and using following code:
POSITION pos = m_DesignList.GetFirstSelectedItemPosition();<br />
<br />
if (pos == NULL)<br />
TRACE0("No items were selected!\n");<br />
else<br />
while (pos)<br />
{<br />
int nItem = m_DesignList.GetNextSelectedItem(pos);<br />
if(D_EXPORT == m_ModeFlag )
{<br />
IDArray[incr++] = indexArr[nItem]; -- line 3<br />
} <br />
m_indexCount ++;
}
Line 3- is the main root of problem.
When i select say B1,B2,B3 from the list , so as there index in the list are 3,4,5 (0 based), but actually in the recordset they are 1,4,7 instead
Note: I have to keep the Listcontrol items in sorted manner.
Leave your mark wherever you go
|
|
|
|
|
The usual way to resolve this is to store the correct index / or a pointer to the data using SetItemData and GetItemData methods of CListCtrl.
Have a look on MSDN for those two functions. There should be a good example.
Michael
CP Blog [^]
|
|
|
|
|
AOA
do any1 tell me how to deal with databases by using MFC as front end & microsoft access as back end......i.e how we can retrieve documents from database if document path is given in field of table.........kindly answer this........i have to do this urgent......plz plz plz...
thanks
|
|
|
|
|
Hi
derive class from Crecordset using class wizard. (Ctrl+W)
In process it will ask you database path and table name.
Give the table name and then it will show all the attributes from table as its members list.
assign name to member
Implement or use Database open and close calls
Better to start is some of the tutorials from either codeguru or codeproject
Hope this will help
Remember
Ms-Access - database limit -- 2GB
Best of luck
Leave your mark wherever you go
|
|
|
|
|
You'll probably get more replies, if you asked specific technical questions. Your message is very vague.
However there are a few methods for accessing MS Access from MFC. Personally I prefer using ADO rather than the MFC classes Database/Recordset classes.
Plenty of examples here[^]
Michael
CP Blog [^]
|
|
|
|
|
Get a copy of Mike Blazcaks excellent book on MFC. It has some very nice samples. BTW the VC IDE can create a skeleton app for you quite easily.
|
|
|
|
|
Hello everyone,
How can i link between my application(thaT I WROTE IN C++) and my MFC application,i mean i want to run my application by pressing START button in my MFC project
If any one can help ill be gratefull,
Thank you ,
Johnny
|
|
|
|
|
One way is
OnStartButton()
{
system(path to your_C++_app.exe);
}
|
|
|
|
|
Thank you!
But what if the path can vary?
Johnny
|
|
|
|