|
No questions are stupid. Everything is hard until you know how to do it. (...and some things are hard even when you know how to do them.)
|
|
|
|
|
Hi all,
i want to build an executable, wich take in parameter a path to another executable. My executable add a protection like a password with a window or an expiration time out. My executable build a new executable with new protections.
This is my idea but i don't find on a network some tutorials or group to help me
If anyome has done a similar projetc or can help me ...
Thanks
|
|
|
|
|
What framework are you using? MFC, SDK or plain C++ etc
|
|
|
|
|
|
OK, To retrieve command line information MFC provide the class CCommandLineInfo that you can derive your own class from
To get info about specific command line parameters override the ParseParam method, it's prototype:
<br />
void ParseParam( const char *pszParam, BOOL bFlag, BOOL bLast );<br />
NOTE: Call CCommandLineInfo::ParseParam( pszParam, bFlag, bLast );
at the start of your implimentation of this method
If bFlag is true then pszParam will contain the character representing the parameter type:
example parameter: -f "foo" -b "bar"
For the above line, ParseParam will be called 4 times. The first time, bFlag will be true and pszParam will contain f. The second time, bFlag will be false and pszParam will contain foo and so on as the process is repeated for the b param.
Regarding starting your app from within the parameter reeiving app, use:
ShellExecute or CreateProcess.
Tom
|
|
|
|
|
Hi,
I have a .wmv file and a .wav file. I want to add/connect the audio (.wav file)to a .wmv filw. How can I achive this?
Regards,
Hemant.
|
|
|
|
|
|
Hi all
I discovered that latest version of Viusal C++ introduced a new macro called __COUNTER__ that is replaced by an integer incremented by 1 each time is used.
I would like to create preprocessors macro like this; I tried using #define #undef multiple times wihtout success.
Do you know if it is necessary some tool or some specific language for it?
Do you know it it is a macro defined somewhere in some .h file or it is built in in the Ms compiler?
Any advice is well appreciated
Regards
Manu
|
|
|
|
|
That macro is VS version specific. It is going to be very difficult to try creating your own. The best method is to create a VB macro to be used with VS and have it read/write a value to a file.
|
|
|
|
|
Hi waldemort
me too I thought to some solution, but I thought also that this technique could be considered too intrusive by someone, so I preferred to ask before going ahead.
Many thanks for your response!
Have a nice day.
Manu
|
|
|
|
|
I'm sure this problem is related to the GDI though I am unable to see where, nor know how to resolve it. When I create a window ( 1024 x 768 ) the memory usage is upwards of 7,000k. This is giving some performance problems mainly relating to the speed of drawing. When I minimize the window, the mem usage drops to 300k. Thats a more than a 6,000k decrease in used memory. When restoring the window, the mem usage never exceeds 2,000k. So obviously, the question is, where on earth is this memory eing used and how do I release it?
|
|
|
|
|
Task Manager doesn't tell you about the memory your program is consuming. It tells you the amount of address space that is in use. How much of that address space is currently being used by your application is different.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Regardless of what the task manager is telling me, my GDI functions calls perform very slowly until the window is minimized and then restored. I'm guessing this relates directly to the number and sizes of DIB sections that my application is using.
I have however managed to resolve the problem. A call to SetProcessWorkingSetSize() after a memory intensive routine signifcantly lowers the value in the task manager and increases the performance of my app. Though I still don't quite understand what is happening.
|
|
|
|
|
Can you explain about your program about handles
|
|
|
|
|
Thats another problem I am having, please see the thread below. At the moment task manager is telling me there are 75 GDI handles, but I can only count 20 - 25. There is no memory leak since the handles are being deleted as soon as they are no longer required. But in some instances the handle count does not decrease after deleting a handle.
|
|
|
|
|
I see previous your message are you sure you have only HRGN hRgn
|
|
|
|
|
I have many handles, mainly HDC, HRGN and HBITMAP. I am convinced that the task manager is not giving true values. It claims that I have 30 GDI handles before even creating a window, that is from a break point on the very first line of WinMain.
|
|
|
|
|
For Mem Usage I have been this problem but I dont know your problem is it or no.If you use SelectObject on your code you have a return value,what happens for it?if you use of CreateDC or CreateCompatibleDC you must use DelectDC maybe it seems that its easy but its important for each create you must use of DeleteObject.
---------- ---------- ----------
For second question if you think Task Manager information isnt true I think we have a function that it says about graphic handles on a process.
|
|
|
|
|
Some of those handles will be being used under the hood. For example GDI is used to paint your applications windows by the system and thus handles will be used.
Steve
|
|
|
|
|
Dear all,
i'm pretty new in VC++, can anybody please explain me what is the "callback function" ?
and how we can use it? for what purpose?
thanks in advance,
cheers
|
|
|
|
|
A “callback” is a concept not necessarily related to C++.
In fact it is a function you write to be called by somebody else to notify your objects about his own activity with them.
The typical example is the WINDOWPROC of a windows application: you write it to be called by the system to notify you about the activity the system (or the user, through the system) is doing over a window you create.
In C++ libraries this details are typically hidden in a class implementation and exposed through virtual functions you can “override” by derivation, or by more complex mechanism like delegation, events, etc.
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
|
|
A callback function is not exclusive to C++. That said, in C++, you can have pointers to either datatypes or to functions. When you have a pointer to a function, you can pass it to an object/function that takes such a pointer and it can use it to call that callback function when it needs to.
Basically, imagine it this way: I have a function Q() that is a specialized function I want called whenever the data in object A is in a certain state. Q() is passed to A via A's constructor, and each time a method on A is called, the state is checked. When the state is what I want it to be, Q() is called via the pointer that A has. This allows me to have several functions with the same signature as Q() that may do things differently (e.g. if Q() was a logging function, I may have one function that logs to a CSV file, and another that does so in XML). I can switch which callback is used at runtime without making any code changes. (Just one example).
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
first of all, thanks for the explanations
i quote from the wikipedia :
"A callback can be used as a simpler alternative to polymorphism and generic programming, in that the exact behavior of a function can be dynamically determined by passing different (yet compatible) function pointers or handles to the lower-level function"
does it mean that we can use callback instead of polymorphism and vise versa? and that both methods (callback and polymorphism) have actually the same philosophy?
cheers
|
|
|
|