|
Hello Stefan
i understand ur condition and i respect for your valuable comments too.
But i have the scenario like this.
I told my situation,and why i am doing this bcoz my project doesnt allow me to do other things.
Not more than info I can provide to you.
in last i m going to use by using Extern variable.
By using Extern makes the performance of my aplication low.
Thanks For all your Valuable answers and comments.
I appreciate your time for my Post.
Thanks & Regards
Yogesh
|
|
|
|
|
My questions (numbering inserted for ease of reference)
Stefan63 wrote: 1 Why do you not want to use extern?
2 Why do you want to create an instance of class TEST in A.cpp?
3 Do you know what a class is?
4 Why do you not provide a header for Sample.cpp?
5 How do you even call the functions in Sample.cpp when you don't have a header?
6 Have you actually successfully compiled the code you've written so far, or any part of it?
7 Did you actually create a project?
Your response (numbers inserted for ease of reference):
yogeshs wrote: 1. By using <layer>Extern makes the performance of my aplication low.
This answer does not make sense, as "extern" has nothing at all to do with runtime performance! You did not answer any of the other questions either, except by saying
yogeshs wrote: my project doesnt allow me to do other things What do you mean? Did you get errors?
Really, if my previous posting had been a test, you'd scored -2 out of 7 points. Fortunately for you it was not a test. But as long as you keep adding nonsensical information rather than answer easy questions, we cannot help you.
|
|
|
|
|
Great response, my 5... I think the OP has no idea what he's doing.
[edit] Or trying to do. [/edit]
|
|
|
|
|
Additionally to what others said, you can also create a method to query that one instance.
E.g:
...
TEST *GetTestInstance();
...
and
...
TEST *GetTestInstance()
{
return _pObj;
}
You can also make this a static member of TEST:
class TEST
{
int num;
void fun();
public:
static TEST *GetInstance();
};
and
...
TEST *TEST::GetInstance()
{
return _pObj;
}
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> //TODO: Implement signature here<
|
|
|
|
|
Hi,
I am writing a commandline app that accepts a filename as parameter, and wonder if there is an easy way to convert the filename to a fully qualified filename when starting the app within a directory, and provide a filename that is located in the current working directory.
for example, my app is located in c:\test\myapp.exe, and the file infile.txt is located there as well. So a user can call myapp.exe infile.txt from that directory.
In my app, I'd like to be infile.txt converted to c:\test\infile.txt. Is there a function in the Win API or MFC that automatically expands filenames to full qualified path?
Next step would be to allow relativ paths as well.
Any hint how to do that?
Thanks alot.
|
|
|
|
|
I'm not entirely sure, but check if the PathResolve API does the job for you.
If not, you could maybe call GetCurrentDirectory and then append the filename to it.
|
|
|
|
|
Hi,
thanks for your hints, I have also searched in the MSDN Lib myself, and have come to the conclusion that
GetFullPathName
works best for me, since it automatically expands a given filename to the full path. That was exactly what I wanted, and it works.
|
|
|
|
|
I wrote a program using CMFCEditBrowseCtrl which had memory leaks. I identified this particular control as the issue. To confirm this, I then built a test program which just has a single CMFCEitBrowseCtrl on the dialog. It leaks upon exit.
I'm in VS2010. I used the app wizard to build a dialog based application using all the default selections. I added the CMFCEditBrowse control using the dialog editor. It compiles OK. It display the dialog and exits with memory leaks. If I remove the control, it exits ok. I can even add a CEdit control and it exits without a memory leak.
The leak is reported like this:
The thread 'Win32 Thread' (0xc3c) has exited with code 0 (0x0).
Detected memory leaks!
Dumping objects ->
{435} client block at 0x01070560, subtype c0, 212 bytes long.
a CMFCVisualManager object at $01070560, 212 bytes long
Object dump complete.
The program '[0x474] testmfcebc.exe: Native' has exited with code 0 (0x0).
Any ideas on how to proceed?
DanL
|
|
|
|
|
I just tried, and cannot reproduce the leak, using VS2010 with the latest service pack.
I create a default dialog based application with the default values, dropped a CMFCEditBrowseCtrl control to the dialog, created/added a variable for it.
build, run, quit. no leaks reported.
I tried different configuration.
Max.
Watched code never compiles.
|
|
|
|
|
Maximilien-
Thanks for taking the time to run that experiment. You solved the problem for me. It appears to have been an issue in the first release. I found a bug post on the Microsoft site by a guy who described leaks with "some" of the controls on a dialog. Microsoft said that they were aware of it. I guess the fix was in Service pack 1... I just installed it and it works correctly now. Thanks again.
-Dan
DanL
|
|
|
|
|
Yet another happy customer!!
glad it did fix it.
Max.
Watched code never compiles.
|
|
|
|
|
I'm looking to see what files are delivered with each Windows Operating system and/or what can be replaced if older versions exist on PCs we are delivering to.
I'm testing another developer's product including the installation CD. He is delivering several DLLs and Active X components (.OCX files). The program will be installed on Windows 98, XP (none or up to Service Pack 3) and Windows 2000. The OCX's are fine. No problems.
The problem is that of some of the files he is delivering, I do not know if they are already a part of the Windows Operating System and whether they should be replaced. My testing has revealed that at least for XP (at least for Service Packs 2 and 3), XP is protecting the files from being replaced even after a temporary file is created and a reboot is performed. Dlls won't be replaced in this situation but OCXs will. We have an older installation program called Setup Factory 6 which may not be up with all of the advances to XP.
Here are the culprits:
comdlg32.dll (does this have to be replaced if a newer version is avail in the delivery?)
msvcrt.dll
mfc42.dll
Which of these files are already expected to be there and should they be replaced if the delivery package has newer versions? I replaced an older version of comdlg32.dll on Windows 98 and it broke 98 because it has a dependency on a newer version of shell32.dll. I've since changed the option to install that file on Windows 98 to "never overwrite existing file".
I also do not know why he is delivering commdlg32.ocx.
Any help would be appreciated. TIA.
|
|
|
|
|
this always turns into a bit of a mess, safest way is to use your own local copy of the dll (without installing on the system folders), although some would disagree because it defeats the purpose of shared dlls (on a system level), but its such a pain sometimes. if you maintain your own local copy (in your own install directory) then its up to you to maintain the version that's appropriate for your software and just do regular updates after that.
|
|
|
|
|
Actually, the whole reason I am doing it this way is because during testing I discovered some of the OCX's were registered in the program's local directory. Of course, if and when you do an uninstall of the program, its best to leave those files in the program's directory and not delete them. The problem is that a user who knows he uninstalled the program may look at the program's directory and see there's nothing there but DLLs and OCX and do a delete *.* and then other programs that were using the registered locations will no longer work. Same as DLL hell.
I would prefer that the files are left in the system directory such that at least there is less risk of accidental deletion by the user.
|
|
|
|
|
why are you registering them? i don't think you're doing this right... if you use them in your local install directory, they should be uninstalled with your program.
|
|
|
|
|
What? I believe that an Active X control must be registered (DLLRegisterServer and/or RegSvr32) If not, that's new to me. The problem is that other programs may have registered their version and location of an Active X control and then this program (even if it stores it in the program's local directory) changes the location (because it registers it) so that any program using the previous version now is using the just installed control in a different location.
If I am not being clear, there are two problems. One with DLLs which I am not registering, and one with OCX's which I registering. I may be able to do as you suggest with the DLLs but not with the OCX's.
modified on Thursday, April 14, 2011 6:57 AM
|
|
|
|
|
Actually, Microsoft has declared msvcrt.dll to be a system level component and not to be used anymore by applications. So, probably somewhere starting XP (SP2?) you should at least not touch that component.
See http://msdn.microsoft.com/en-us/library/abx4dbyh(v=vs.80).aspx[^]. For more on known dll's, check out http://blogs.msdn.com/b/larryosterman/archive/2004/07/19/187752.aspx[^] for instance.
And for the love of god, don't touch comdlg32.dll. On older systems, if you are delivering a newer version I'm guessing it's ok, but I've had multiple times that poor installers overwrote the proper version of it, making me download a proper version from the internet again.
And mfc42.dll, it seems to have a version number in the filename, so I'd say don't touch it if its there. If it's not, install it.
Then again, I'm not an expert on any of this. But please be very reluctant to overwrite dll's (and ocx's for that matter). Only if you know you have a good installer that can check and be sure that a version on the system is newer should you consider overwriting. And, you can always display a pop-up to the user asking for confirmation as some installers do.
Best Regards,
MicroVirus
|
|
|
|
|
Thanks, MicroVirus. Took all your suggestions to heart. Besides msvcrt.dll, I also decided not to deliver comdlg32.dll.
|
|
|
|
|
I want to do an user interface in c++, I will use glui library.
I added the library as the net says.
But I could not the compile any code.
I always take the same errors:
Error 16 error LNK2019: unresolved external symbol "void __cdecl myGlutIdle(void)" (?myGlutIdle@@YAXXZ) referenced in function _main
Error 33 error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall std::locale::facet::_Register(void)" (__imp_?_Register@facet@locale@std@@QAEXXZ) glui32.lib
and so on....
How can I fixed it? I searched everywhere
|
|
|
|
|
If you are getting to the link stage of compilation then its probably that you are not linking in the required library but you have sufficient include files so there are no compile errors.
It's been a while since I have work with Glut but I think there is a Glut.lib that you should add to the linker section of the project settings.
|
|
|
|
|
Help! After windows update with KB2465361 I get crashes everywhere. My application is based on Ultimate Toolbox. MS created an own CMFCToolbar. In Ultimate Toolbox this has been renamed to COXToolbar, but it crashes somewhere in there. I've replaced the toolbar with the MS CMFCToolbar, but now my app crashes while opening a file inside filecore.cpp. Anyone else out there suffering similar problems and a way out of this?
Regards,
Franz
|
|
|
|
|
If you don't want to debug into COXToolbar, probably the best thing is to create a new app, then move your old code into the new app structure, just to make sure everything is hooked up correctly.
|
|
|
|
|
Debugging should not be the problem , but probably I do not understand what's going on .
The problem is here:
afxbasepane.cpp line 133 does a call to SetPaneStyle(dwStyle | GetPaneStyle());
This runs into virtual COleDropSource* GetDropSource(), which I do not understand. It seems that there is some linking problem, since GetPaneStyle does not exist inside OXCoolToolBar. This is strange.
|
|
|
|
|
...found out. During the update of the ultimate toolbox to Version 9.3 (Update 05) I missed one line in OXCoolToolBar.h in 1722. Instead of #define CToolBar COXMFCToolBar there was a #define CToolBar CMFCToolBar, which lead to the confusion. As I was close to getting nuts and calling for the priest I recognized this new line in the new code base of 9.3.
|
|
|
|
|
Hello, I need to rotate 90° my "graphical objects" on screen (text, lines, rect....)
Is it possible to do it just by changing any VIEW properties or anything similar ?
thanks
|
|
|
|