|
Nice change to ACTUALLY see a code example that actually works...
Too many times I have to weed out the trash where people don't have the common courtesy of showing an actual code example.
They beat the dead horse to death without any clue to help those that aren't intimately familiar with all the ins and outs of C!
Thanks "Superman"!
---
Most of my programming of the last 5 to 10 years has been in Visual Basic where strings are strings.
C++ has so damn many string types that it is very easy to get confused when converting the different flavors of strings to anything and back.
If I had my way, more people would learn to program in Assembly where data is data and you have to determine what to do with it.
My first programming job for the first 5 to 7 years was purely in Assembly Language. I learned a bunch of things very quickly that way.
We all too lazy in the last 20 years it seems when programming.
Bill G.
Senior Software Engineer / Systems Analyst for over 32 years.
Age 53
|
|
|
|
|
I have an application developed in VC++6.0 using MFC MDI application type. I want to convert my application to VC++.NET.
Pls List out the steps about how to convert my application to VC++.NET?
Also Provide me any automation tools for converting the VC++6.0 application to VC++.NET (i.e., converting the .DSP, .DSW files to .SLN files in .NET)
|
|
|
|
|
What does it tell you when you try to a open VC6 solution with a VC++.net IDE?
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
|
|
|
|
|
- Open up the 6.0 DSW (or DSP) of your project in Visual Studio.NET (year of your choice) and the IDE will ask you
to convert the project files.
- Click Yes/OK
- Once that is done, save, and rebuild your project.
- Fix all the new errors and warnings.
- Test your application.
This signature was proudly tested on animals.
|
|
|
|
|
Is there any automatic tool for doing this conversion.
|
|
|
|
|
Do you want to convert your MFC application into a .NET application ? Then one can activate the /CLR compiler switch and it will compile it as managed C++.
http://msdn.microsoft.com/en-us/ms173265.aspx
Later you can convert your managed C++ into C#, and change your MFC dialogs into WinForms.
Or do you just want to upgrade to a newer version of Visual studio ? If so then Visual Studio will automatically upgrade the project files of you MFC application. And you might have to resolve some issues as the C++ compiler is more standard compliant.
|
|
|
|
|
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
|
|
|
|