|
I want to connect the excel file to my MFC gui grid . Also As any change occured into the cell of the
excel file it also reflect into the MFC gui . Is there any api for both functionality.
Trioum
|
|
|
|
|
You could set up the Excel file as an ODBC data source and then use standard database functionality to connect that to your grid?
As for getting notifications of changes...not sure about that.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi all,
I am trying to add excel add-ins programmatically through C++ code.
It is srunning fine on xp or lower OS. But it is giving an 'Unhandled exception' on Vista.
m_xlAddins = xl.GetAddIns();
if(xl.GetVersion()=="12.0")
{
m_xlAddin = m_xlAddins.Add(strAddin,covTrue);
m_xlAddin.SetInstalled(TRUE);
}
Could anyone help me please?
|
|
|
|
|
SRKSHOME wrote: m_xlAddin.SetInstalled(TRUE); //---> giving an error on vista.
Could this be attempting to write to a location on the disk or in the registry for which it does not have sufficient privileges?
"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
|
|
|
|
|
Hi there.
I have created a dll(text based logger) that can be used to create a text based log.
Now, my problem is, let's say, this component is being used by several other components and those several components are logging into the same text file. Now, that’s a problem...Synchronizing problem.
Need suggestions to resolve this problem.
Any work around will be appreciated.
Thanks
PanB
|
|
|
|
|
Single-threaded - terminate every stream output operation with std::endl to properly flush the stream before the next stream operation.
Multi-threaded - you could use a critical section to serialize use of the log file - something like:
std::ofstream logFile;
CRITICAL_SECTION csLogFile;
: : : : : :
EnterCriticalSection(&csLogFile);
logFile << stuff << std::endl;
LeaveCriticalSection(&csLogFile);
Alternatively, put all the logging information in one thread and send messages to that thread to log (you could share a queue of strings between threads and have a synchronised function that enqueued a log message?)
Multiple processes? - you could do something with file locking? But not with vanilla C++ - you'll need some OS specific functionality. And even then, I wouldn't guarantee it working on network drives.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
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);
........
|
|
|
|