|
Hello David,
Thanks for your reply ! I have tried your suggestion but this change produces the command line "D:\StickCopier\deveject -EjectName:""USB Mass Storage Device""" in the debugger (i.e. a PAIR of double quotes whereas single double quotes are needed for the argument to EjectName
Since my original posting, I have tried ShellExecute() and am getting a similar result - ShellExecute() succeeds (RC = 42, which is greater than 33), but the USB stick is still mounted.
New code is as follows:-
CString szFile = "D:\\StickCopier\\deveject.exe";
const CString quote = "\""; // This is actually the character '"'
CString szParameters = "-EjectName:" + quote + "USB Mass Storage Device" + quote;
CString szDirectory = "D:\\StickCopier\\";
HINSTANCE hInstance;
hInstance = ShellExecute(NULL,"Open",szFile, szParameters, szDirectory,SW_HIDE); // returns 42 (> 33 so no error
Doug
|
|
|
|
|
Hello,
I’m new in MFC programming and I have a doubt about destructor's calling in a MFC application.
I wonder if it’s necessary to insert destructors for the classes of the project.
I suppose (but I’m not sure) that Windows automatically calls destructors for classes created by the project wizard (doc, view, frame…) when I stop the program execution and close the program window.
But what’s the situation for classes that I have inserted in the software?
I never put destructor for these objects (dialogs, strings, bitmap, controls, custom objects…)
Is this a problem? What could be the problems in this situation?
Best regards.
|
|
|
|
|
lor75 wrote: I wonder if it’s necessary to insert destructors for the classes of the project. Yes, if you have clean up tasks that need to be done.
lor75 wrote: I suppose (but I’m not sure) that Windows automatically calls destructors for classes... Yes it does.
lor75 wrote: But what’s the situation for classes that I have inserted in the software? Please explain.
lor75 wrote: I never put destructor for these objects (dialogs, strings, bitmap, controls, custom objects…) You mean classes that you're using as opposed to those that you've created?
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
I try to explain with an example: I create a CBitmap object used to put a bitmap on a custom button control.
Do I have to destroy the object when I exit from the program or the object is automatically destroied?
|
|
|
|
|
Is the CBitmap object allocated on the heap (with new) or on the stack
class YourClass
{
~YourClass (){};
CBitmap m_Bitmap;
};
or
class YourClass
{
~YourClass () {delete m_Bitmap;};
CBitmap* m_Bitmap;
};
If you properly override a MFC class then the MFC (and/or underlying Win32 object) will be destructed by the framework, but everything else that you have allocated yourself should be handled by you (in a cleanup function or in the class destructor).
I'd rather be phishing!
|
|
|
|
|
If the CBitmap was dynamically allocated, then you probably need to deallocate it yourself. If it was allocated on the stack, then the framework will take care of it. For the most part, anything you new, you must delete.
As for classes that you make, you only really need an explicit destructor if you need to clean things up that you did (deallocate memory/resources, close files, close sockets, etc). The framework has default destructors that deallocate what it allocated behind the scenes, so you just have to clean up what you did for the most part.
|
|
|
|
|
which is the best book to study about graohics in c , and which compiler is the best ? i have been looking orward to make a game using c. please guide me
|
|
|
|
|
I generally use always plain C even for COM. Unfortunately nowadays almost all advanced libraries for graphics, comms, and whatever you want are available only in OOP and managed code.
But still you can do alot of things using plane C.
I suggest to start studying the old good GDI[^].
For games is available the evergreen Allegro library[^].
Hope this will help.
|
|
|
|
|
If a book offers graphics, its best for beginners! There is no problem for you to get in depth of everything, you need to get idea of it right now... Any book, would give you an idea of what graphics is, what C has for graphics and so on.
Secondly, every compiler if it compiles the code correctly, is good... You can try out multiple, and see for which one suits you. Once you've learnt enough, and you want to move to productive scenarios. Then I would suggest, you move on from C to C++ at least. GTK+, QT and many more libraries are out there to support graphics. You can learn the basic difference here: http://stackoverflow.com/a/1887094/1762944[^].
Finally, nothing is best, you have to see which product suits your requirements. Good luck!
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
c/c++ program of rabin cryptosystem
|
|
|
|
|
If you mean "Please give me the source of a c/c++ program of rabin cryptosystem", then I am afraid you have come to the wrong place.
|
|
|
|
|
|
Hello.
I am developing a small application using tapi. Well main problem is i can not have input and output voice at same time.after many search i found i should have full-duplex modem and TSP. But my modem is full-duplex so i guess all these problems is because of unimodem.tsp which does not support full-duplex. I decided to use other TSPs , but i do not know how to tell my TAPI object use another TSP not always unimodem.
Well with this situation, i should have one way voice, ok? (cause unimodem is half-duplex) but here we have another problem. I do not have any voice, not out going and neither incoming voice. It is weird. in events first i receive
JulMar.Tapi3.CALL_MEDIA_EVENT.CME_STREAM_ACTIVE but after it another event raise, it says
JulMar.Tapi3.CALL_MEDIA_EVENT.CME_STREAM_FAIL
I found this error into callmedia event:
JulMar.Tapi3.TapiException (0x8007000E): Not enough storage is available to complete this operation.
JulMar.Tapi3.CALL_MEDIA_EVENT_CAUSE.CMC_BAD_DEVICE
What it means "Not enough storage is available to complete this operation"?
I have much free memory, So what is it trying to say!?
I increased PageFile for virtual memory. Nothing changed.
I read somewhere i should not call COM object many times. But I have no idea, Cause it is event, i have no control how much event Tapi server raise.
Whats problem?
Thank you
A.H
[It is with Julmar and c#, but why i post this here, cause i think it is more ralted to COM and unmanaged tapi codes, and maybe memory management. ]
|
|
|
|
|
I haven't direct experience with the issue, but as far I can see the error isn't to be interpreted as memory problem, but missing resource.
Probably what is not found is the codec, specifically the ACM.
Try to look if it is available and connected.
Good luck.
|
|
|
|
|
Thank you to reply.
I forgot to say, in 4days before it was working, and i could hear one way voice(outgoing call in dialing, and incoming voice when answer call), also i could play wave file, and record conversations. I do not know what happened exactly, but i guess i changed modem .INF file in trying to full-duplex support, and all failed after it, then i reinstalled previous modem.
Also i do not know about ACM Codecs, i google it when i be in my work place.
Thank you again!
|
|
|
|
|
Hi,
I have Binary Data to be included in a DLL. The Tool I have developed to generate this data, currently creates a BYTE array in a CPP File. This File is subsequently compiled into an .obj File as part of the project, and linked in the normal way with the linker. The next step forward would be to have the Tool produce an obj file in the first place. Anyone any ideas how to do this? Microsoft maintains that .obj files are standard COFF Files. I know from experience that this is not strictly the case. In any case there is very little documentation about the further details, such as identification of sections of the Obj File, etc. I would need to produce a File that meets the minimum MS Linking Spec. There is only One 'C' linkable variable, the name of the array.
Has anyone any ideas?
Regards
Bram van Kampen
|
|
|
|
|
Hi,
Adding the file as a custom resource and then using FindResource set of api's to access it, does not fit your needs?
Regards,
Mauro.
|
|
|
|
|
|
The format MS uses is standard indeeded, it is named PE (portable executable), and you can get whole documentation here[^]. It is made public to avoid penalties from antitrust because, if hided, it could be seen as an abuse.
It is based on COFF, and its almost the same, apart from the interpretation of location offsets that are different.
You can create a PE object header, include your data in an initialized data section and create a symbbol in relocation..
But if only need to access that data in the DLL the really easy solution is, as they already told you, to create a resource and use it.
|
|
|
|
|
Hi everybody !
I am looking for an automated tool or script that will take a huge Borland C++ buider project and convert it into Visual Studio .NET project. A full conversion is not necessary, rather a starting point for manual intervention.
So, after researches, i focused on the vcl conversion part to .Net, win api, so i want to know if is there a tool that can do this , at worst, just partially,
|
|
|
|
|
There is no tool to do this. You're going to have to either write the tool yourself or just skip it and convert the code by hand.
|
|
|
|
|
Hello Friends
I converted MFC application to 64 bit using VS 2013. My exe is working in Release build.But As I run in Debug Build,it pops up with Window error saying "The Application was unable to start correctly(0x0c000007b).Click OK to close the application."
After Google, I tried different methods As suggested [Copied mfc100.dll,mfc00u.dll,msvcp100.dll,msvcr100.dll,msvcr100_clr0400.dll] to System32 folder.
I installed vs2010,vs2013 redistributable package too bt no Luck.
Any Ideas?
Thanks & Regards
Yogesh Sikri
|
|
|
|
|
Debug builds are not intended to be run on other machines than the development system. So try to start your program in the debugger of your VS. If that works, all is OK.
Debug builds are linked to special versions of the runtime DLLs which did not exist on machines that have no VS installed. While it would be possible to copy these special DLLs, you should know that you are not allowed to do so.
|
|
|
|
|
I am running debug build on development machine only.Still no Luck.
|
|
|
|
|
Check the debug output window to see when the error appears. You may set a breakpoint at your InitInstance method. If the error appears before that it may be some DLL that does not match. Does your application uses some self-build or other non-MS DLLs? If so ensure that these DLLs are present as 64-bit versions. Check also your debug project settings for those DDLs to ensure that there is no entry to an old one.
The MS / MFC specific debug DLLs should be already present on your system (they have the letter 'd' at the end of the name).
|
|
|
|
|