|
Tamster wrote:
All I done was call Lock() and Unlock() before and after my protected code.
Yes, that's all you need to do. Odd it doesn't block multiple threads. It works fine for me.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
|
I've realised why the CCriticalSection doesn't work.
I think all my controls belong to the same thread since they are all on the same form. CCriticalSection only allows one thread at a time access to the critical section. This is no good for me since they all are on the same thread.
Using Semaphores don't work either as a thread will block while waiting for a seamphore to become available, however this is the same thread that will release the semaphore, so it'll never become available.
|
|
|
|
|
Gotcha!
How about using a poor man's critical section by opening a file for exclusive access? You can restrict this to provide exclusion within an app, across apps, or both.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
hi all
i am haviing in executing the string.
when i do with system(string) it opens the console window but i don't want this.
i have the string as
"D:\Work_Ganesh\Installer\components\Authenticate.dll" .
I want to execute this how should i execute this.
|
|
|
|
|
dll are not executable files (no entry point).
you have to point a function (into that DLL) from your code...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
|
How can I solve the unexpected EOF eror?;)
|
|
|
|
|
Well, you can test for the EOF flag (assuming you're talking about file I/O operations).
I Dream of Absolute Zero
|
|
|
|
|
MilanZ wrote:
How can I solve the unexpected EOF eror?
How can we know where you're wrong ?
what is the context ? (your code, and the error description)...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
|
I think this error occurs because of precompiled headers isn't it ? Then you need to go to the "file view", right click on the *.cpp file that generates the error -> settings/ C++ tab / choose precompiled headers category and then select 'don't use precompiled headers'. It should be something like that (from memory but I'm not sure if these are the exact names ).
|
|
|
|
|
My Project is SDI, in MainFrame class, I use OnCreateClient(...) to splitter window. And I want to change style of one view after user click a button on the toolbar.
How to update window by recreate window style like as using Invalidate() function to redraw??
Can anybody help me, please? Thanks a lots!
don't stop me now!!!
|
|
|
|
|
Is this[^] article usefull ? With this class you can create two different views and 'store' them on the same pane (one will be visible and the one wich is beyond is not visible). Thus, on command, you can switch the two views.
So your code would look also a little bit better: if the two views you need to display needs to be handled differently...
Hope this helps
|
|
|
|
|
thank you. My problem have solved.
And to My project interface become friendly and more useful. I only want to split into 3 view. And in left view, I have many my functions and store them in left panel like as tabbed control with some CPeropertyPage class. My software is used to control device, so I want all event occur at each page must be outted as logs on second view. I can't access data and invoke function in Document class from these page.
Please help me solve this problem.
Thanks.
don't stop me now!!!
|
|
|
|
|
Informs the documents of the changes you make in one view so it will take the appropriate actions (send the 'update' data to the second view).
Try to avoid having direct 'dialog' between two views: normally they should be totally independant. It is the document that must update them and have a knowledge of what's happening in one view (so to keep the other up to date)
|
|
|
|
|
Hi everybody, i am writing some functions for arithmetic operations with Huge numbers(more than 1000 digit), i am using CString class and i treat CString objects like numbers,for example :
CString s1,s2,s3;
s1="625";
s2="25";
s3=Divide(s1,s2); // now s3="25"
I have to convert Huge numbers to binary, so using simple algorithm(dividing by 2,...) is too slow, so i decided to convert these numbers first to Hex then from Hex to binary,(as converting to Hex to Bin is very fast as you know)
i thought it would make my func faster but it takes approximately the same time ?? Does anybody know why ?? or have any ideas??
Regards
m0n0
m0n0
|
|
|
|
|
Are you saying that you're using your own custom functions that perform mathematical functions on numerical strings that can run to a 1000 digits?
I Dream of Absolute Zero
|
|
|
|
|
|
Yes,not only 1000 digit but much more . How many symbols CString objects can contain ,thats INT_MAX=2147483647;
m0n0
|
|
|
|
|
Yes. I did this type of project for fun about 14 years ago. It supported the four basic operators plus factorial and exponents. I'm not sure why he is going to all of the trouble of converting from one base to another though. I'm unsure of its necessity.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I need to test these huge numbers on primality using probabilistic tests,and that's where i need converting to binary, because how do u suggest calculating for example this :
3535783465873657834623842893472389475 ^ 234623784627834682374823476782346823746823 mod (128) = ?
^ is Power
and when i convert this number to binary then there is a algorithm which calculates this number x^y (mod n) very easily and fastly.
I think it's clear to u now David why i need convertion to binary
m0n0
|
|
|
|
|
Giorgi Moniava wrote:
I think it's clear to u now David why i need convertion to binary
Not yet. The exponent and modulo operator can be implemented without using base-2.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Yes but how do you think how long will it take my program to calculate smth. like this
2346235345345345345347846823746236454 ^ 237436452376234234234234234545465 , using standard exponent algorithm , for example 5^3 = 5*5*5 = 125 , processor will have to multiply this number : 2346235345345345345347846823746236454 on itself ,
237436452376234234234234234545465 times .Thats pretty long process
m0n0
|
|
|
|
|
Well, even if you converted such a long number to binary, you've got no std function to do std operations like ^ or mod. Processors usually take 32 or 64 bit numbers. For better performance try search the web for additional libs for processing huge numbers. I'm sure there are some. Maybe even with some source...
|
|
|
|