|
From MSDN -
A module-definition (.def) file is a text file containing one or more module statements that describe various attributes of a DLL. If you are not using the __declspec(dllexport) keyword to export the DLL's functions, the DLL requires a .def file.
If you have functions in a DLL written in C++ that you want to access from a C-language module, you should declare these functions with C linkage (extern "c") instead of C++ linkage. Unless otherwise specified, the C++ compiler uses C++ type-safe naming (also known as name decoration) and C++ calling conventions, which can be difficult to call from C.
Moral of the story -
A .def file is required if you are not using __declspec(dllexport) keyword.
extern "c" stops the compiler from decorating the function names.
|
|
|
|
|
i am using Dialog based MFC application.
simple application i have create is add new node in Tree-view as text specified in edit box.
now problem is that when i am adding i dont want duplicated node being added to Tree-view.
i should get reference to already existing node when i try to add node with same text.
Help needed : how to search node in tree-view ..
|
|
|
|
|
You can use HTREEITEM hKid = GetChildItem (hParent); in a loop to get all the children of a parent, but the better idea is to maintain a array of nodes or labels that are already added in the tree.
You can search in the array to check if this node or label is already added.
If you want to check the labels, then it's always good to use CMapStringToString class, as you can directely check if the string is there or not. (In array, you have to search the whole array to find if item is there or not)
|
|
|
|
|
You have to search the node using GetNextItem. It will return the HTREEITEM. If the text is same, you can call SetItemState for that node
- NS -
|
|
|
|
|
Thank you ...
i am sooo that no direct function available ....
|
|
|
|
|
Hi all,
I'm trying to connect to an Oracle database, with the following function:
...
ret = SQLConnect(m_hDbc,
(SQLCHAR*)szDSN,
strlen(szDSN),
(SQLCHAR*)szUser,
strlen(szUser),
(SQLCHAR*)szPass,
strlen(szPass));
...
But I keep recieving the following error:
[Microsoft][ODBC driver for Oracle][Oracle]ORA-12154: TNS:could not resolve the connect identifier specified
I have added the entry to the tnsnames.ora file, and checked the "tnsping" using TNS service name, which worked.
Can anyone please help?
Many Thanks in advacne
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
hi
try this code to connect to oracle
SAConnection con; // connection object
SACommand cmd; // command object
{
con.Connect("test", "tester", "tester", SA_Oracle_Client);
cmd.setConnection(&con);
}
|
|
|
|
|
I want to know a computer's byte order.
Somebody would like to tell me how to get the order?
Thanks.
GOOD LUCK.
|
|
|
|
|
It depends on your CPU. I believe most (if not all) PCs are Little-Endian, meaning (going off memory here) that the bytes are ordered, within a word, with the least significant byte first. You can google "Endian-ness" for a more complete and correct answer.
|
|
|
|
|
OK,I will go and have a look.
Thanks.
|
|
|
|
|
|
Maxwell Chen wrote: Endianness[^]
Were you afraid that kcynic would not be able to Google the suggestion from Azteke correctly?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
One way to do it. I'm not sure if it works on 64-bits CPU's though.
Remark (before I get flamed): Yes, it is old C code.
Detection of Little- and Big-endian:
bool bIsLittleEndian = false;
unsigned int test = 0x12345678;
unsigned char firstByte = *(unsigned char *) &test;
if(firstByte == 0x78) bIsLittleEndian = true;
Detection of Little-, Middle and Big-endian:
enum {LITTLE_ENDIAN, MIDDLE_ENDIAN, BIG_ENDIAN};
int endian;
unsigned int test = 0x12345678;
unsigned char firstByte = *(unsigned char *) &test;
if(firstByte == 0x78) endian = LITTLE_ENDIAN;
else if(firstByte == 0x34) endian = MIDDLE_ENDIAN;
else endian = BIG_ENDIAN;
-- modified at 5:38 Friday 14th September, 2007
Maxwell Chen made me aware there are such a thing as Middle-endian, so I made another sample. (Middle-endian is appearantly used in some PDAs and mobile phones that is using CPU's with ARM architecture.)
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
|
Thanks for the comment.
I will change my reply, since it could be fatal to execute my code on a PDP 11 machine.
OK, it seems as some PDAs and mobile phones uses CPU's with ARM architecture. That scenario seems a bit more likely. I will change my reply accordingly.
Thaks for pointing it out.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
Kakan,
That's interesting, I never though of using code to determine the Endian=Ness. I'll remember that.
Azteke
|
|
|
|
|
Hi, I'm working on a project where I need to do the following:
1) Constantly (at some defined rate that approximates "constant") sample the microphone input.
2) Take the input that is read and determine the frequency of the tone being input.
If it's possible, number 2 would run on each execution cycle. The idea is to have a big if-block that performs different logic depending on what range the frequency is in.
What I need is an API (and a document to help explain it would be helpful) that will allow me to do this sampling/frequency determination. I'm new to PC programming for the most part, coming from about a year and a half of embedded (fairly basic) development, but I'm excited to start learning! I do know the basics of MFC apps/dialogs and I have VS2005 Professional at my disposal.
The one last thing is that I would like this to run on Linux also eventually so if there's a good API that is cross-platform that would be ideal if it doesn't add too much trouble.
Much appreciated,
Tim
|
|
|
|
|
|
Ressell, after a quick scan-through I think that third link is exactly what I need. Thanks. Does anyone know of a cross platform API though for future Linux ports?
Thanks,
Tim
|
|
|
|
|
Thanks
About Linux:
I don't know anything about it to help you, sorry.
You can start a new thread,...but think also to post it in another forum: here more than 90% of members are expert on Windows. I don't want to mean that here noone can help you, but that it is not so impossible.
good luck
Russell
|
|
|
|
|
Hello,
Good Day!
Step 1:
struct user
{
unsigned short us_nbs;
unsigned short us_debit;
unsigned short us_flowctrl;
};
Step 2:
In another header file contains this:
"class C_User : public CObject, public user"
Step 3:
class C_Subscriber : public C_User
Step 4:
C_Subscriber subdeviceSubs = *lpSubscr;
Step 5:
I got that us_flowctrl value is "0" by executing this statement : subdeviceSubs.us_flowctrl. How?
Thanks in advance
Raja Ratheesh
-- modified at 1:56 Friday 14th September, 2007
|
|
|
|
|
rajaratk wrote: C_Subscriber subdeviceSubs = *lpSubscr;
What is this lpSubscr?
- NS -
|
|
|
|
|
Instance of
typedef struct user far *LPUSER;
|
|
|
|
|
So you are getting values changed...
class C_User : public CObject, public user
class C_Subscriber : public C_User
typedef struct user far *LPUSER
C_Subscriber subdeviceSubs = *lpSubscr;
So the C_Subscriber has CObject in the first memory area. I doubt that it could be the problem.
Dont you get any compilation error by "C_Subscriber subdeviceSubs = *lpSubscr;" ?
- NS -
|
|
|
|
|
Hi friends........
I have a question on tab oreder.......?
How the tab order will effect the visibility of controls placed on a dialog?
Thank u in advance.....
Sairam Madem
|
|
|
|