|
Thanks a ton Iain clarke...
It worked fine...
Thanks once again..
Rakesh
|
|
|
|
|
|
Hi Experts,
I have created an Database application using CDatabase and CRecordset.
Following is some part of code where the Exception occurs....
CRecordset UserRs(&UserCn);
.
.
Sql="Select * from UserInfo";
UserRs.Open(CRecordset::snapshot,Sql,CRecordset::none);
The Exception is :
"Attempt to open a table failed-there were no columns to retrieve were specified.."
I m confused..Becoz the same code run on my machine doesnt work on
others machine.
and the query also correct.
plz Help me..
Waitng for ur Reply..
I have never failed,I just found 1000 ways that never works.
Regards,
Victory.
|
|
|
|
|
Assuming that there is a table in your DB called UserInfo, I would check that the CDatabase object is connected to the datasource using UserCn.IsOpen before trying to open the RS.
Check that the datasource is configured the same on the target machine as it is on yours - including permissions. In my experience, that is the most common source of this type of problem... though I admit my needs have never occasioned use of C++ for database connectivity.
MZR
|
|
|
|
|
Hi All,
I'm having real difficulty in getting transparency to work in my application. I am drawing an image into the window title bar, the code (in short) is below:
void CThemedDialog::OnNcPaint()
{
CDC* pWindowDC = GetWindowDC();
CRect rcWindow;
GetWindowRect(rcWindow);
m_bitmapWindowIcon.Draw(pWindowDC->GetSafeHdc(), 5, 5);
ReleaseDC(pWindowDC);
m_bitmapWindowIcon is an ATL::CImage object that is loaded from a png file (I've also tried with a jpeg file). I never get any transparency - just white pixels where the transparent ones should be. Is there something stupid I am doing? I'm pulling my hair out over this!
Thanks in advance,
Dave
|
|
|
|
|
Please clear you question
|
|
|
|
|
in a textbox i have "Sam james thomas" which is 3 names
can anyone write a code that will only take the middle name in C++
thanks
|
|
|
|
|
Um, yep. Pretty much anyone can do it.
|
|
|
|
|
You can use of CString::Mid.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
thats a real basic homework:
1. find the 2 blank positions
2. extract the chars in between
it is no question it is a sign thats you arent engaged enough for writing code
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Tiyani Miyambo wrote: "Sam james thomas"
strtok(strtok("Sam james thomas", " "), null);
|
|
|
|
|
ahmed zahmed wrote: strtok(strtok("Sam james thomas", " "), null);
Maybe you meant this as a joke. Otherwise, you can't seriously think it would produce the desired result.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
you are correct, it won't produce the desired result. what was i thinking?
strtok("Sam james thomas", " ");
strtok(null, " ");
|
|
|
|
|
I have a thread going on a little way down, about threads and timing. Now a question came up that I felt should go into a different thread.
I have the following code piece
HANDLE hTimerQueue = CreateTimerQueue();
HANDLE hTimer;
count = 0;
CreateTimerQueueTimer(&hTimer, hTimerQueue, (WAITORTIMERCALLBACK)&DoSendHere, 0 , 20, 0, WT_EXECUTEINTIMERTHREAD);
QueryPerformanceCounter(&liStart);
::SleepEx(60, TRUE);
LONG lCount = count;
QueryPerformanceFrequency(&liFreq);
m_pLogger->Out( Logger::DEBUG, "RTPEngine: Time = %f.\n", double(liEnd.QuadPart-liStart.QuadPart) / double(liFreq.QuadPart) );
m_pLogger->Out( Logger::DEBUG, "RTPEngine: Count = %d.\n", lCount );
The liEnd variable is filled in the callback function.
Several issues:
1. Like it is the callback func is called once (like intended) but the output gives a time of appx. 30ms, not 20ms. Actually the time is never the time I set up.
2. Why does it crash if I call DeleteTimerQueueTimer( hTimerQueue, hTimer, NULL ); after the output?
The output is this
RTPEngine: Timer callback activated.
RTPEngine: Time = 0.030410.
RTPEngine: Count = 1.
RTPEngine: Sending data package with size 480 (excluding header).
RTPEngine: Timer callback activated.
RTPEngine: Time = 0.030192.
RTPEngine: Count = 1.
RTPEngine: Sending data package with size 480 (excluding header).
RTPEngine: Timer callback activated.
RTPEngine: Time = 0.030377.
RTPEngine: Count = 1.
This is the output for a 9ms dueTime:
RTPEngine: Timer callback activated.
RTPEngine: Time = 0.016252.
RTPEngine: Count = 1.
RTPEngine: Sending data package with size 480 (excluding header).
RTPEngine: Timer callback activated.
RTPEngine: Time = 0.014759.
RTPEngine: Count = 1.
RTPEngine: Sending data package with size 480 (excluding header).
RTPEngine: Timer callback activated.
RTPEngine: Time = 0.014178.
RTPEngine: Count = 1.
RTPEngine: Sending data package with size 480 (excluding header).
RTPEngine: Timer callback activated.
RTPEngine: Time = 0.014759.
RTPEngine: Count = 1.
Souldrift
modified on Monday, July 6, 2009 5:53 AM
|
|
|
|
|
I can't reproduce your results - I always see the timer triggering roughly (within around 2-300 microseconds) when expected.
Note that in my initial post about timer queue timers I posted the wrong callback function signature - that could have caused crashes, as there was an extra formal parameter - sorry about that.
You may find it useful to investigate the different values in the Flags parameter of CreateTimerQueueTimer - the callback doesn't have to execute in the same thread as the timer.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Well, I made a small adaption to your code like this (some output and another timing behaviour)
#include <windows.h>
#include <tchar.h>
#include <iostream>
LONG count;
LARGE_INTEGER liStart, liEnd, liFreq;
VOID CALLBACK DoSendHere(__in_opt LPVOID lpArgToCompletionRoutine,
__in DWORD dwTimerLowValue,
__in DWORD dwTimerHighValue)
{
QueryPerformanceCounter(&liEnd);
count++;
std::cout << "Time = " << double(liEnd.QuadPart-liStart.QuadPart) / double(liFreq.QuadPart) << std::endl;
}
void SendLoop()
{
HANDLE hTimerQueue = CreateTimerQueue();
HANDLE hTimer;
count = 0;
QueryPerformanceFrequency(&liFreq);
CreateTimerQueueTimer(&hTimer, hTimerQueue, (WAITORTIMERCALLBACK)&DoSendHere, 0 , 0, 9, WT_EXECUTEINTIMERTHREAD);
QueryPerformanceCounter(&liStart);
::SleepEx(65, TRUE);
LONG lCount = count;
DeleteTimerQueueTimer(hTimerQueue, hTimer, 0);
std::cout << "Time = " << double(liEnd.QuadPart-liStart.QuadPart) / double(liFreq.QuadPart) << std::endl;
std::cout << "count = " << lCount << std::endl;
}
int _tmain(int argc, _TCHAR* argv[])
{
SendLoop();
getchar();
return 0;
}
The result shows the same 15ms jumps I had before. Maybe there´s just no way around. I guess, I think some more and then we might have to settle for a different approach.
Thanks once again for ideas and brainstorming.
Souldrift
|
|
|
|
|
Hej Everyone,
I opened MS word file in NOTEPAD and saved it as text file so that i can read the saved file using C/C++ streams. Below i have given image of MS word file opened in NOTEPAD and then i tried to read it using C/C++ streams but my programs reads the first few characters and then terminates. Why can't i read all these characters?
http://i41.tinypic.com/nybvih.jpg[^]
Any help in this regard will be appreciated.
Thanks
|
|
|
|
|
Post some relevant code snippet otherwise we can't guess what you are doing wrong.
|
|
|
|
|
int main()
{
ifstream file("test.txt");
char ch;
if (file.is_open())
{
while ( !file.eof() )
{
file >> ch;
cout << ch;
}
}
getchar();
return (0);
}
-
This program just read the first few (5 to 6) characters of the MS word file saved as text file. How to read the remaining characters?
|
|
|
|
|
Are you aware that the file contains binary data ? What are you trying to achieve exactly ? Trying to output to the screen a binary file is probably not a good idea...
|
|
|
|
|
@Cédric Moonen
-
Thanks. Let me try it using binary.
-
Thanks everyone.
|
|
|
|
|
Member 6371145 wrote: I opened MS word file in NOTEPAD and saved it as text file so that i can read the saved file using C/C++ streams.
That makes no sense:
- Changing the file extension won't change the (binary) content.
- C/C++ can (of course) read binary content of files.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Did you tried with binary file mode?
MS word is actually writes in binary mode starts with MS word File header.
|
|
|
|
|
Hi Expert
how to get mysql database path throigh code?
|
|
|
|
|
Path to what part of mysql?
I'm pretty sure that 'path to the database' isn't meaningful - remember that the database can be on a separate machine, on a filesystem you have no visibility of.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|