|
There's no need to call KillTimer . Just call SetTimer again with the same ID and the new interval.
DoEvents: Generating unexpected recursion since 1991
|
|
|
|
|
guys,
i get some porblem. i degine a graph region and i have drawn some grids with the following codes.
BOOL CUserInterfaceDlg::PlotGrid(void)
{
int i;
GraphRegion->
SelectObject(Brush);
GraphRegion->SelectObject(PenGrid);
GraphRegion->
FillRect(&GraphRect,&Brush);
for (i=1;i<(GraphRect.Width()/2);i++)
{
GraphRegion->MoveTo(i*((double)GraphRect.Width()/30),0);
GraphRegion->LineTo(i*((double)GraphRect.Width()/30),GraphRect.Height());
}
for (i = 1;i<(GraphRect.Height()/2);i++)
{
GraphRegion->MoveTo(0,GraphRect.Height()-i*((double)GraphRect.Height()/30)); GraphRegion->LineTo(GraphRect.Width(),GraphRect.Height()-i*((double)GraphRect.Height()/30));
}
return 0;
}
then i tried to draw another line on the grid by the following codes:
BOOL CUserInterfaceDlg::PlotRunWay(void)
{ UpdateData(TRUE);
GraphRegion->SelectObject(PenRunWay);
RXArray[0]=m_AirXPisition;
RYArray[0]=m_AirYPosition;
RPoints[0].x=RXArray[0];
RPoints[0].y=RYArray[0];
RPoints[1].x=RPoints[0].x+30000;
RPoints[1].y=RPoints[0].y+200;
GraphRegion->MoveTo(RPoints[0]);
GraphRegion->LineTo(RPoints[1]);
return 0;
}
but this is not working. it just drawing the grid lines. can anyone tell me why it happening.
thanking you all,
shohel
|
|
|
|
|
Please don't repost your message twice !
Where are you calling that code ? All drawing routines should be called from within the OnPaint handler.
Also, it is better to create a custom control instead of drawing directly on your dialog (this way, you can resize it or put it on another dialog).
Anyway, if you want to make a kind of 2D chart, I suggest you take a look at my signature: I developped a charting control and maybe you could find it usefull...
|
|
|
|
|
How can I access individual elements of linked lists? Can you show me a code example? Thanks.
|
|
|
|
|
can you explain a bit more on the following?
1.how did you start to create a linked list application.
2.what is the structure of your node.
please be clear.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
What list ?? You mean a std::list ?
Please be precise when asking your question.
|
|
|
|
|
nawal_bo wrote: How can I access individual elements of linked lists? Can you show me a code example? Thanks.
you have to traverse each and every element of linked list for individual element
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|
|
Do you have code for adding to this list?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
i want to load japanese string from the string table.
can any body tell me the encoding format of .rc file (in Gereral) in Visual Studio 2005.
|
|
|
|
|
sumit.durg wrote: .rc file (in Gereral) in Visual Studio 2005.
Look at the solution part, which is at the end of this page:
Internationalization Cook book - Unicode .RC in VS 2005[^]
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Can you tell me how to read japanese string from string table
|
|
|
|
|
Try CString::LoadString(IDS_STRING);
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Does it work for other languages?
|
|
|
|
|
How i should i use CString::LoadString(IDS_STRING);
|
|
|
|
|
|
in continuation with try CStringW::LoadString!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|
|
I am creating a logging .dll utility. Which shud support multithreading.
I am a bit confused about how shud I be handling multithreading using MUTEX.
From the application(using my dll) I can call initializelog() function which get's the necessary data from properties file etc, and logmin(),logmid() and logmax() functions which passes the messages to the dll to log. Now if I have many threads running in my application and each thread calls any of the above functions. It should pass the message and the thread ID to dll to log. I know the Mutex function which synhronises the threads. But am confused WERE and HOW to use this in my DLL to synchronise the threads one at a time.
Please help me out to solve this..
THANKS
|
|
|
|
|
I think the easiest way to go is to use a critical section. Are you using MFC ? If yes, you can use a CCriticalSection object, otherwise you can go with the plain CRITICAL_SETION (win32).
Basically what you would is the following: in your function that logs text in your file, you wrap your logging code with an access to a critical section. This will ensure that only one thread will be able to log data in the file at a certain point of time:
void CLogger::Log(....)
{
m_CriticalSection.Lock();
m_CriticalSection.Unlock();
}
m_CriticalSection is an object of CCriticalSection and has been instancied previously.
|
|
|
|
|
I will try to do this. But I would also request you to please suggest me using MUTEX.
THANKS
|
|
|
|
|
Please suggest me reagrding this using mutex.
THANKS
|
|
|
|
|
Why, you need Mutex and don't want to use critical section as suggested earlier.
[Using Mutex Objects (WIN32)^]
[CMutex (MFC)^] To access or release a CMutex object, create a CMultiLock or CSingleLock object and call its Lock and Unlock member functions
|
|
|
|
|
Haven't Googled yet [^], have you?
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
|
|
|
|
|
Hi Im having two structures as follow
struct TagModel
{
float SPV [900];
float SPV1 [900];
float IPV [900];
float ISV[900];
};
struct Mystruct
{
float SPV [900];
float SPV1 [900];
}
From first structure, just i need only first two variables,and values of all varaibles are stored in shared memory. I used BELOW coding to read from first strucutre and write to my strucuture.
htBackTrackFile = FileName;
no_bt = 1;
struct Mystruct *temp;
temp = (struct Mystruct*) malloc(sizeof(struct Mystruct));
DWORD fp = SetFilePointer( htBackTrackFile, (no_bt * sizeof(struct TagModel)) + 10,NULL,(DWORD)FILE_BEGIN );
Flag = ReadProcessMemory((HANDLE)GetCurrentProcess(),(struct TagModel*)First,temp, (DWORD)sizeof(struct Mystruct),(LPDWORD)&ReturnVal );
WriteFile( htBackTrackFile,temp,(DWORD)sizeof(struct Mystruct), (LPDWORD&ReturnVal,(LPOVERLAPPED)NULL );
When i check this in debug mode...it shows as
First->SPV[1] = 50.000 //Its the correct value. from Fisrt TagModel struct
But mystruct writes as
temp->SPV[1] = 4.50000 .
Where is the problem..totally it shows very different value.
Is it the correct way to read very few member varaibles from one main structure to another strucute???
Anu
|
|
|
|
|
actually to copy the required amount of data from one memory to other, <b>memcpy</b> should be enough. please try it.
good luck.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
Anu_Bala wrote: Flag = ReadProcessMemory((HANDLE)GetCurrentProcess(),(struct TagModel*)First,temp, (DWORD)sizeof(struct Mystruct),(LPDWORD)&ReturnVal );
WriteFile( htBackTrackFile,temp,(DWORD)sizeof(struct Mystruct), (LPDWORD&ReturnVal,(LPOVERLAPPED)NULL );
You may had better code if you are not aware of those API's.
what about directly writting to file from First(TagModel struct) without a memory copy.
WriteFile(htBackTrackFile,First,(DWORD)sizeof(struct Mystruct), (LPDWORD)&ReturnVal,(LPOVERLAPPED)NULL )
Anu_Bala wrote: But mystruct writes as
temp->SPV[1] = 4.50000 .
how do you verified it. have you considered the below calculation, (no_bt * sizeof(struct TagModel)) + <big>10</big>
Anu_Bala wrote: SetFilePointer( htBackTrackFile, (no_bt * sizeof(struct TagModel)) + 10,NULL,(DWORD)FILE_BEGIN );
|
|
|
|