|
|
Hi ,
this is a question about providing exclusive access to a control .
Consider my case where I am using a active x control to log certain details. My application works on a REQUEST - RESPONSE mechanism where I request a certain piece of data externally (serial or network ) , wait a certain duration and conitinue processing the next REQUEST. There is another callback function that actually reports the data I am requesting and needs to log the RESPONSE To the same active x control .
I am running into problems when both of these threads are running . i.e Main request loop and the call back thread . They tried to access the same resource via a variable(say the current row of a grid !!!!!) and that is when results go messy .
I know that I can use CCriticalSection to protect a block of code , but how do i provide exclusive access to a resource when they are not part of the same code ? like a control which is spread across different functions? Please help
|
|
|
|
|
If the resource is managed by a C++ class you can put a critical section in the class and lock it whenever any code needs exclusive access to the resource. Of course you also need to ensure you can't get into a deadlock situation.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
Hi,
Can anyone answer the following question or at least tell me where I can find the answer ?
When you install VB, Visual studio, Ms word etc... and you have a PC with multiple registries (say one for stand-alone use/login and one for network use/login) the software manages to register itself in all the registries and you can use it whichever way you log in. With my own software it will register OK but the settings I enter into the registry are only visible in the registry active at the time of registration. When you log in differently and another registry is used the program cannot access the values in the original one.
The solution seems simple: register the software in all possible registries as the Microsoft products seem to do. The question is: how do you do that ?
Any answers most welcome and appreciated.
Filip
|
|
|
|
|
one thing you can consider is to add your registry entries to HKEY_LOCAL_MACHINE, instead of HKEY_CURRENT_USER. the first is readable to most processes, regardless of user login. the second is unique for each user.
-c
Image tools: ThumbNailer, Bobber, TIFFAssembler
|
|
|
|
|
Are you confusing HKLM (Local Machine) and HKCU (Current User)?
You need administrative rights to write into HKLM but it is visible to all users.
Art
|
|
|
|
|
Thank you for the help. A case of "glaringly obvious once pointed out". It ought to make all the difference.
Filip
|
|
|
|
|
I'm using doxygen for the first time and I'm trying to configure the configuration file with the doxywizard. When I run the generation I've got "unknown command or file name" dos window and that's all.
How can I figure out what's wrong with my configuration file this way ?
I'm using the latest 1.3.
Yarp
http://www.senosoft.com/
|
|
|
|
|
|
Thanks a lot Andreas, I did a search in the articles before asking but I don't know why I missed this.
My main problem comes with the wizard, I think the files included in the zip file will greatly help me solve this.
Thank again
Yarp
http://www.senosoft.com/
|
|
|
|
|
hi,i'm newer developer on visualc++ and i want to know how can i add a bitmap(more than 256 color) for a button,
Please help,
Thanks
Bye
liuqid
|
|
|
|
|
|
I'd like to use a "output iterator" as a function parameter, but somehow I fail to do that. Any hints where to read about this?
Off to in ~74 days
|
|
|
|
|
Post an example of your code.
Kuphryn
|
|
|
|
|
|
Andreas Saurwein wrote:
Sometimes the SGI STL documentation is really useful
No, it's the VC STL documentation that sucks!
It's not the fall that kills you: it's the sudden stop - Down by Law, Jim Jamursch (1986)
|
|
|
|
|
Daniel Turini wrote:
it's the VC STL documentation that sucks!
I second that
Cheers,Joao Vaz
And if your dream is to care for your family, to put food on the table, to provide them with an education and a good home, then maybe suffering through an endless, pointless, boring job will seem to have purpose. And you will realize how even a rock can change the world, simply by remaining obstinately stationary.-Shog9
Remember just because a good thing comes to an end, doesn't mean that the next one can't be better.-Chris Meech
|
|
|
|
|
Hi.
Is it possible for me to use CSplitterWnd class in My ActiveX object or Dialog box .Can i use any oter method to achive a Normal SplitterWindow like view in my activeX control; or Dialog box. So that i hav a Left view & Right View
the left view may contain few controls and the rightView too, and i must manage all these controls position when i move the splitter.
Please do a reply as early as possible
regds..
Jibesh.V.P
Jibesh.V.P.
India
|
|
|
|
|
|
This link shows the method of using CDoument and CView in a Dialogbased application .
http://www.codeguru.com/dialog/vwindlg.html
When i tried the same Procedured in my Active -X there is a Excpetion in Assiging CDocument class to the CCreateContext member variable.
how can i perfor that in my ActiveX
Jibesh...
|
|
|
|
|
I have two files:
a.txt:
20020102,23.0
20020103,23.0
.............
20021220,23.5
b.txt:
20010101,22
20010102,25
...........
20010301,35
Now I want to append the lastest datas of the file "a.txt" to the file "b.txt". How could I do ! Please tell me the easy way to do it! Thanks a lot!
|
|
|
|
|
You can do somethig like that:
<br />
FILE* m_pFile1;<br />
FILE* m_pFile2;<br />
<br />
m_pFile1 = fopen("a.txt","r");
m_pFile2 = fopen("b.txt","a");
<br />
char Dummy;<br />
while (!feof(m_pFile1))<br />
{<br />
Dummy = fgetc(m_pFile1);<br />
fputc(Dummy,m_pFile2);<br />
}<br />
|
|
|
|
|
Don't be rediculous,
fgetc & fputc? Reading & writing file by character....
LPTSTR lpBuf;
DWORD dwRead, numChars;
HANDLE hFile = CreateFile(fileNameA, GENERIC_READ,0,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);
if ( hFile != INVALID_HANDLE_VALUE)
{
numChars = GetFileSize(hFile,0);
if ( numChars )
{
lpBuf = new char[numChars+1]
::ReadFile(hFile, lpBuf, numChars +1, &dwRead, NULL);
HANDLE hFileB = CreateFile(fileNameB, GENERIC_WRITE,0,0,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,0);
if ( hFileB != INVALID_HANDLE_VALUE)
{
::SetFilePointer(0, 0, FILE_END);
::WriteFile(hFileB, lpBuf, numChars, &dwRead, NULL);
CloseHandle(hFileB);
}
CloseHandle(hFile);
}
}
|
|
|
|
|
Oh , the spelling mistake. the lastest should be "latest"
The focus is: I want appending the "latest" datas of aa.txt to the file bb.txt
The latest datas in the file aa.txt are the datas that are not included in the file bb.txt.
Note: i only want to append the datas that the bb.txt is not included.
Thanks!
|
|
|
|
|
i have placed a CRichEditCtrl in a View.Size of that Control is exactly same as that of the View.No Vertical & Horizontal scrollbars for that CRichEditCtrl. AutoScrolling also disabled.using lfHeight of LOGFONT i set the hieght & using SetFont, i have set it to that Ctrl.now i know the Font height & height of the CRichEditCtrl.(GetClientRect())
With this information how can i calculate maximum number of lines that could be displayed in that Ctrl without scrolling?.
I assumed,
MaxNumberOfLines=(Height of the CRichEditCtrl)/ FontHeight.
but it is not exactly correct.i think there i am missing the vertical space b/w 2 lines.
Vinothini A
|
|
|
|