|
Hello everyone,
I read OLE DB section from MSDN and it is mentioned that to implement an OLE DB provider is very simple and easy (is it true?). But from the minimal support function list, I find there are a lot of minimal functions. Not that easy!
I am wondering where can I find some tutorials (documents) about how to implement an OLE DB provider in C/C++?
thanks in advance,
George
|
|
|
|
|
Implementing an OLE DB Provider might prove a bit ambitious for someone that can't even use Google[target="_blank">^]
led mike
|
|
|
|
|
Thanks led! Good resources! Do you have any personal recommendations, like which tutorial is your preference for a beginner like me?
regards,
George
|
|
|
|
|
can any one can give me code to handle i2C bus in c++ or C#,or VC
|
|
|
|
|
Rabia Waqas wrote:
can any one can give me code to handle i2C bus in c++ or C#,or VC
first google dude!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
how to read only last line of file.
|
|
|
|
|
Technique 1: read the file line by line. When you hit EOF, the last line you read will be the last line in the file.
Technique 2: read the file in big blocks. When you hit eof, start at the end of the last block read, and search backwards for the line-ending sequence. That will be the start of the last line of the file.
And please don't use plz. If you don't take time to write your questions in good English, don't expect people to take time to help you.
Best wishes,
Hans
|
|
|
|
|
you can also use lseek to move the file pointer to, say, 100 bytes before the end of the file, read the whole 100 bytes block and discard all the bytes preeceding the last file line.
BTW I agree completely with Hans Dietrich: make a little effort to write in better English.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
prathuraj wrote: how to read only last line of file.
CFile::Seek
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi
Can you please tell me how the default font of command buttons like NEXT,BACK,FINISH and CANCEL can be changed?
Best Regards
Neeraj Sinha
|
|
|
|
|
Consider using CWnd:::SetFont , for buttons of your interest. You can use GetDlgItem to access those buttons.
Prasad
MS MVP - VC++
|
|
|
|
|
Thanks for your reply but what ID should I pass in the parameter of GetDlgItem(), as we do not add the buttons from the resource.
With Regards
Neeraj Sinha
|
|
|
|
|
There are standard ids for cancel , help,ok button(IDCANCEL,IDHELP,IDOK).
About other buttons, you may need to take help of spy utility to find their ids.
Prasad
MS MVP - VC++
|
|
|
|
|
I created a struct
[code]
struct S{
char Name[20];
int score;
}
[/code]
to store personal info of a lot of people. I need to store the data into hard disk file for later use. i use CFile.write(....) for this purpose.
My problem is that some memory space is wasted due to the design of the struct, since it is often that one' name is much less than 20 characters. In the above design, whenever a new structure is created by 'new', 24 bytes memory space is used.
I also designed another structure to solve this problem,
<br />
sturct S{<br />
string Name;<br />
int score;<br />
}<br />
<br />
However, this design had problem with the write() function of CFile. I found that actually nothing had written into the 'Name' item of a structure when I tried to read out the data from the file, but it is normal for the 'score' item of the same structure.
Anyone please tell how to solve this problem.
Thanks.
|
|
|
|
|
You talk about memory space and then you talk about writing data to disk. Are you concerned with in-memory space, or the space used on the disk?
In memory, you could change the struct to contain a pointer to the char string, which you could allocate with new. The pointer would cost 4 bytes, plus the length of the char string. Not that much savings, unless you're dealing with huge populations, and then I think you have quite a different problem.
On the disk, you could do several things. 1) compress the records; 2) write the records as char strings - "NAME,100" - terminated with the usual line endings. Simple, but it eliminates the unused bytes, and unless you're dealing with huge populations, saving a million bytes on the disk seems like a waste of effort.
Best wishes,
Hans
|
|
|
|
|
To add to Hans Dietrich's reply...
Serialization works good for this IMO.
You could make the class(struct) serializable -
struct S{
char Name[20];
int score;
void Serialize(CFile &file);
void Unserialize(CFile &file);
}
void S::Serialize(CFile &file)
{
WORD wStrLen = (WORD)strlen(Name);
file.Write(&wStrLen, sizeof(WORD));
if (wStrLen > 0)
file.Write(Name, wStrLen);
file.Write(&score, sizeof(int));
}
void S::Unserialize(CFile &file)
{
WORD wStrLen;
file.Read(&wStrLen, sizeof(WORD));
if (wStrLen > 0)
file.Read(Name, wStrLen);
Name[wStrLen] = '\0';
file.Read(&score, sizeof(int));
}
To write an S object to a file, call Serialize().
To read an S object from a file, call Unserialize().
Also, since you're using MFC, MFC's built-in CObject serialization is available.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi!
Need help to copy string in the structure variable .
following is my structure,
struct argument_list
{
WCHAR *pszInFile;
WCHAR *pszOutFil;
what should i have used here string or char *?
char* Host; // Initially I had used string but strcpy function does not support to copy the string
char* UserID;
char* InitPackageRequest;
char* ScriptFile;
};
I have made this structure for the thread. to pass the parameter.
for that i have used the following.
struct argument_list *l;
l=(argument_list *)malloc(sizeof(argument_list));
<br />
<code>is lstrcpy require here?
l->pszInFile=bufferwithpath;
l->pszOutFil=w_Output;
l->_ProtectSet=_ProtectSet;
l->hList=hList;
//l->Host(HOST);
l->Host=NULL;
strcpy(l->Host,HOST); //got error here
l->hwndEncrypt=hwndEncrypt;
l->hWndinoutfiledir=hWndinoutfiledir;
l->hwndParent=hDlg;
l->InitPackageRequest=NULL;
strcpy(l->InitPackageRequest,sINIT_PACKAGE_RESPONSE.c_str());
l->Port=PORT;
l->ScriptFile=NULL;
strcpy(l->ScriptFile,COMMUNICATOR_SCRIPT_FILE_PATH);
l->UserID=NULL;
strcpy(l->UserID,UserID.c_str());
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
amitmistry_petlad wrote: strcpy(l->Host,HOST); //got error here
You got an error because there is no memory associated with the 'Host' member - it's just a pointer. You must either: 1) allocate memory before the strcpy - for example, l->Host = malloc(...); OR you can change the struct to a specific size for the 'Host' member - for example, char Host[100].
You seem to be confused about the difference between a char* pointer (char *s), and an array of char's (s[100]). You can use either one in the strcpy() function, but if you want to use a pointer, be sure you know where the memory has been allocated.
|
|
|
|
|
Thank you very much
sir !
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
|
Hi
All
I am doing one application in VC++,MFC in which i have to use ToolTip control with font other that default font of system.So if any body have some hint about this query then plz forward me.
Thanks
aaamm
|
|
|
|
|
hello
i'm using HRESULT GetFileDuration(Qword* duration) in win32 to get duration.
For this function i have to add "wmsdk.h and wmsdkidl.h" header files
When i add these files by giving appropriate path i'm facing errors
syntax error : identifier '__RPC__in' c:\wmsdk\wmfsdk11\include\structuredquery.h
syntax error : identifier '__RPC__out' c:\wmsdk\wmfsdk11\include\structuredquery.h ........
there are around 45 such errors
help me to solve this problem
thanks!!
|
|
|
|
|
Please use the window media format sdk 9.5. in place of 11.
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
Hi all,
My Application uses RegCreateKeyEx to create a registry.This appilcation has to work in both windows XP and Vista. In windows XP it create registry successfully ,But in Vista it fails to create registry ...
How do i Solve it ....
Manjunath S
GESL
Bangalore
|
|
|
|
|
Manjunath S wrote: But in Vista it fails to create registry ...
Vista has lots of restrictions, dealing with registry. You may like to read UAC for that. Search for UAC on MSDN .
Prasad
MS MVP - VC++
|
|
|
|