|
Stuart my requirement is implement synchronisation across network. On the basis of your exp. what's your suggestion? Give me just a pointer, after that i will dig the concept
|
|
|
|
|
PankajB wrote: implement synchronisation across network
Multiple machines?
If that's the case, I'd be tempted to use RPC or some TCP/IP service, so you have a single point of contact for logging.
File-locking is not (I seem to remember) particularly recommended for files on a network server, so I'd really be tempted to use a client-server mechanism.
The easiest way would be to have a very primitive web server on a machine (you can implement one in a few hundred lines of code[^] - that one's Unix specific, but (from experience) I know you can reuse 95% of the code on Windows) that, when you POST ed a message to a particular URL, would write that message to the log-file.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
A straight questions – By any mean, can we open any file in exclusive lock mode.
I mean, if I open a file, it will be locked automatically and then, in case any other process try to use the same file, the process can get that state.
What I am planning is, in case I can find that the file is locked, I will create a temp file and write my log into in that file. And my logger will be intelligent enough to find whether any temp files exists and if they do, then it will copy the content to the mail file and will delete temp files.
May be what I said is just an imaginary idea….but if I can find out that the file I want to use is locked, then I will be able to implement this approach.
|
|
|
|
|
PankajB wrote: By any mean, can we open any file in exclusive lock mode
Yes - use CreateFile with 0 for the dwShareMode parameter.
Anyway - that scheme sounds feasible
Some points...what happens if you can open the log file but a temp file is locked? Does out-of-order insertion into the log matter?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I have got a trouble of GDI+, my code is like this:
CPaintDC dc(this); // device context for painting
CRect rect;
GetClientRect(&rect);
CDC dcMem;
dcMem.CreateCompatibleDC(&dc);
CBitmap bitmap;
bitmap.CreateCompatibleBitmap(&dc, rect.Width(), rect.Height());
dcMem.SelectObject(&bitmap);
Graphics graphics(dcMem.m_hDC);
SolidBrush brushBKGnd(Color(0,0,0));
//freeze at here
graphics.FillRectangle(&brushBKGnd, Rect(rect.left, rect.top, rect.Width(), rect.Height()));
The code will freeze at the last line, I don't know why, please help me.
|
|
|
|
|
Well - your code is OK - I've just tried it and it works even if you don't startup GDI+ properly. You do have to remember to blit the bitmap to the window DC to see anything, mind.
So - your code's (superficially) OK - maybe there's something about your setup that's not quite right?
What are the co-ordinates of your rectangle? What happens if you paint to dc rather than dcMem ?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I have tried to test the parameters which were sent to FillRectangle function, I found that when they are big numbers(i.e, 200,000), the calling to FillRectangle will freeze.
But from my code, the value of CRect is got from API GetClientRect, does this function have some possibility to fail?
|
|
|
|
|
Can I suggest you set a breakpoint on FillRectangle and see what the client rect value is?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
No,I didn't set breakpoint, I just create a CRect object with large paramaters:
CRect rect(0, 0, 200000, 200000);
//Disable this line
//GetClientRect(&rect);
|
|
|
|
|
No - get rid of those test parameters and try to find what the rectangle co-ordinates are when the call freezes when the rectangle is derived from the client rect.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I see, thanks for your mention
|
|
|
|
|
Hi there. The reason is clear. It's because that I called the GDI+ APIs in another thread, and GDI+ doesn't support multi-thread calling
|
|
|
|
|
大家好!我在处理从虚拟打印出来的EMF文件时,如果是打印的word。(打印其他文件没问题)在我旋转EMF文件时,图片会消失,图片上如果有表格的话,表格不会消失,文字绝对消失!!!!我旋转是用Matrix来实现的
这到底时什么原因啊!高手来说说,谢谢
================================================================
sorry ! my english is poor!
virtual Printer print the EMF file ,if this file print from the word ,when i rotating the emf file ,the pictrue will disappear!
my code Like this
.........
Matrix mtx;
mtx.RotateAt(m_nRotateAnle,PointF((minX+maxX)/2,(minY+maxY)/2),MatrixOrderAppend);
graphics->SetTransform(&mtx);
.....
graphics->DrawImage(m_pImage,rect,0,0,(float)m_pImage->GetWidth(),(float)m_pImage->GetHeight(),UnitPixel);
........
Why is it part of the disappearance when i rotating it, I do not know
modified on Tuesday, March 3, 2009 3:08 AM
|
|
|
|
|
This is an international forum, so please ask your question in english. If you can't do that in english, then I suggest you search for a forum in your language.
|
|
|
|
|
Does it your qeustion?
Hello everyone! Treatment at my print out from the virtual EMF file, if it is to print the word. (No problem printing other documents) in my rotating EMF file, the picture will disappear, pictures on the table if there is, then, the form will not disappear, the disappearance of language is absolutely!!!! My rotation Matrix are used to achieve the
This is why when in the end ah! Master for that thank you
Btw You are in the USA but you speak chinese?
-----------------------------------------------
Can you show your code? (您可以查看您的代码)
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 )
|
|
|
|
|
So you offer an extra service ? Great! How's that Hamid?
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
I am sure you forgot me because you are not here(if you remember these members were active on this forum toxxct,David Crow,Cedric Mooen,Nibu Babu thomas,...) we spoke together two years ago(my username was WhiteSky)
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 )
|
|
|
|
|
Hamid. wrote: I am sure you forgot me because you are not here
Yeah I very well remember them lol and I strongly remember WhiteSky. One fine day I saw a name called WhiteSky that got stuck into the forum forever later. lol Forgot that it's the reference to Hamid. cool.
Hamid. wrote: we spoke together two years
Exactly! Goddamn the last two years. I went to through hell & back . I couldn't even open CP for my own requirements. My job was too hectic.
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
Like this
.........
Matrix mtx;
mtx.RotateAt(m_nRotateAnle,PointF((minX+maxX)/2,(minY+maxY)/2),MatrixOrderAppend);
graphics->SetTransform(&mtx);
.....
graphics->DrawImage(m_pImage,rect,0,0,(float)m_pImage->GetWidth(),(float)m_pImage->GetHeight(),UnitPixel);
........
|
|
|
|
|
For your project you can use of GDI+ and use of Image::RotateFlip
using of it is easy:
Image m_image(L"c:\\123.jpg");
Graphics m_gdi(need to a hdc);
m_gdi.DrawImage(&image, 0, 0, m_image.GetWidth(),m_image.GetHeight());
m_image.RotateFlip(Rotate90FlipY);
m_gdi.DrawImage(&image, 120, 10, m_image.GetWidth(),m_image.GetHeight());
but did you see MSDN for "Matrix Representation of Transformations" ?
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 )
|
|
|
|
|
thanks!
but i want rotate the EMF at all angle,don't like this.And i can rotate the image but a part of image will Disappear
|
|
|
|
|
Do you understand Chinese? Awesome!
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]
|
|
|
|
|
Except english I like two languages Chinese and Italian and I think they are like this: Chinese != Italian
(Chinese is very difficult and Italian is easy (of course for me)).you can see <a href="http://www.google.com/url?q=http://en.wikipedia.org/wiki/Mandarin_Chinese&ei=UvusSfzqM4u4-Qa2hNjYBg&sa=X&oi=spellmeleon_result&resnum=2&ct=result&cd=1&usg=AFQjCNF2qXPRlDhmCxBvWTinPXDu6FSnVA">Mandarin</a>[<a href="http://www.google.com/url?q=http://en.wikipedia.org/wiki/Mandarin_Chinese&ei=UvusSfzqM4u4-Qa2hNjYBg&sa=X&oi=spellmeleon_result&resnum=2&ct=result&cd=1&usg=AFQjCNF2qXPRlDhmCxBvWTinPXDu6FSnVA" target="_blank" title="New Window">^</a>].
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 )
|
|
|
|
|
I am not familiar with this issue, but as a chinese, I'm glad to help you. Do you need some translation?
|
|
|
|
|
thanks!
yes. I need !
Writing English too painful for me
|
|
|
|
|