|
TCHAR szAppPath[MAX_PATH];
::GetModuleFileName(AfxGetInstanceHandle(), szAppPath, MAX_PATH);
then use _splitpath to get the folder.
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|
Alright here is the situation...I want to have an MFC image frame that when you drag a picture from a web site or hard drive onto the frame the program copies the image to a selected folder and displays the image in the frame. I found the option to accept files but i don't know what to do from there. Any assistance would be helpful. Thank You.
Never argue with an idiot because they will bring you down to their level and beat you with experience!!
|
|
|
|
|
BLIT it!
really serch for blit
Def: Blit: To copy a large array of bits from one part of a computer's memory to another part, particularly when the memory is being used to determine what is shown on a display screen. “The storage allocator picks through the table and copies the good parts up into high memory, and then blits it all back down again.” See bitblt, BLT, dd, cat, blast, snarf. More generally, to perform some operation (such as toggling) on a large array of bits while moving them.
Taken from:
http://catb.org/~esr/jargon/html/B/blit.html
"Naked we come and bruised we go."
- James Douglas Morrison
Best Wishes,
ez_way
|
|
|
|
|
In MFC how do you find the path that your application started in.
For example in VB its Path$ = App.path
Donald
|
|
|
|
|
I think These two Api Will help to do that
GetModuleFileName -->return the path of your application
_TSplitPath--> split the path acoording to your need
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
CString CGoodUtils::GetThisAppsName()
{
TCHAR szEXEPath[MAX_PATH];
GetModuleFileName ( NULL, szEXEPath, MAX_PATH );
return (CString)szEXEPath;
}
"Naked we come and bruised we go."
- James Douglas Morrison
Best Wishes,
ez_way
|
|
|
|
|
Please help me with this problem...
I'm trying to make a genetic algorithms inside a GUI with windows,
but I have some problems to make iteration with out let hanging off
the main program.
the structure of my iterations its like this
do{
select
crossover
mutation
.
.
.
}while(criterium its not met);
I was trying to do this loop with a tread and waiting for a event inside de
tread , but tread funtion makes that my main program crash
|
|
|
|
|
I want to talk to my mobile via inra red. I have found the project by Daniel Strigl that works under MFC, but I need to use it not under MFC. I can compile just useing windows.h, but it doesnt work, It keeps returning a file not found.
any ideas?
|
|
|
|
|
I have a text file which contains a list of sets of four floating point numbers. They are arranged like this, each * representing some number in the file:
* *
* *
* *
* *
.
.
.
and so on, but I don't know in advanced how many sets of four there are. I need to read them into a program using C++/VC++/MFC and I'm wondering if there is a "best" way to do it?
Currently I am using
<br />
while(fscanf(stream, "%lf %lf %lf %lf", a, a + 1, a + 2, a + 3) == 4)<br />
{...}<br />
where a is an array
double a[4]; .
I'm guessing this isn't a particularly good way to do it...
|
|
|
|
|
That's C. Read my iostream articles to see how it's done in C++
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Bring em in as a BYTE if possible. A WORD if not.
You can't do somthing faster than you can do nothing.
"Naked we come and bruised we go."
- James Douglas Morrison
Best Wishes,
ez_way
|
|
|
|
|
I have a static function and I want it to call a non-static function. The computer is telling me that I can not do this just by calling the non-static function outright.
Is there a way to call the nonstatic function from the static function?
|
|
|
|
|
Pass a pointer as a parameter of static function, call the non-static function by pointer.
|
|
|
|
|
If you need to, then the function should not be static.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
If it should not be static, so there are any problem.
You should modify your function, that can accept an argument (this pointer). So that, in the function, you can call none static function from this pointer.
For example:
class A{
static void Func(A* pA)
{
pA->NoneStaticFunc();
}
}
|
|
|
|
|
This is plain stupid. If you can only call a method when you have an instance of the class, the method should not be static. It in essence won't be static, it can only be called when you have an instance of the class to call it with, even if you don't call it from the class.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
No. I don't think so. According to C++ principle, static members should be shared with every instances of class. But in few case, we need an exception. C++ do not prevent me to implement such that. And here, the guy had a reason to have such case.
|
|
|
|
|
nguyenvhn wrote:
According to C++ principle, static members should be shared with every instances of class
Wrong - a static method is visible to anyone who can see the class scope, even if no instance exists. In C++, it's also visible from the instance scope, although in C# it is not.
nguyenvhn wrote:
But in few case, we need an exception. C++ do not prevent me to implement such that. And here, the guy had a reason to have such case.
We've not even seen his code, or know what he's trying to do. The fact remains, if you need an instance of the class to make the code work, if it needs to call a non static method, then either the other method should be static, or the other method has state, making this method also stateful, and also a method that should not be static.
If a method does not make sense to call when there's no instance of the class, it should not be static, simple as that. Your solution makes it seem static, but it's not, it can't be called without an instance. A design principle of C++ is to allow bad coding, and trust that coders will write good code, so they never have to fight the language. What you propose is possible, that doesn't make it good coding practice.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Oh oh, In fact, you are right. I have nothing to protest.
Of course, a static member has class scope, so that it can call only others static members.
But in this case, the guy need a solution to adapt with his problem (it may be by historic). Because he needed to call a none static member, it was evident that there had to be exist an instance of class.
It is very clear that we shoud avoid such case but a trick in porogamming makes the life more funny;P and I like to solve that stuck
It is so interesting in reasoning with you.;P
|
|
|
|
|
In general, I agree with Christian on this.
Christian Graus wrote:
A design principle of C++ is to allow bad coding, and trust that coders will write good code, so they never have to fight the language. What you propose is possible, that doesn't make it good coding practice.
And Microsoft encourages this practice with Windows callback functions.
The callback (if implemented as part of a C++ class) has to be a static member, but in general, what's done is that there's a programmer-supplied value (usually void*) that can be passed as well as the function address.
In those cases the approach is to pass the address of an instance of the class, as has been previously suggested.
Steve S
Developer for hire
|
|
|
|
|
Does anybody here has a tutorial or a link to a tutorial of
Visual C++.NET 2003?
|
|
|
|
|
Recently upgrading to VC++ .NET 2003, a logging utility using std::ofstream has broken. When outputting a string, the _address_ of the string gets into the log file and not the string contents!!! What is going on??
Addendum: Seems ostream has no << _Elem* operator. When I changed to write(...) it works like a charm. The standard has changed I guess...
/R
|
|
|
|
|
Yes Robert. This was the most considerable change I was able to find out in VC.NET . You dont have streams now but still you can use STL's fstream and ostream etc.
Just do a plain include like
#include <fstream>
I hope this will solve your problem.
Stuck to Programming through an unbreakable bond
My Articles
|
|
|
|
|
Thanks Aamir,
I'm not sure what you mean by the "plain include"? I do use the include:
#include <fstream>
for the std::ifstream and std::ofstream STL classes.
I checked the VC7 STL implementation and a lot of stream operators are available for the std::ofstream (through std::ostream). All _except_ char* (!!). For example, when the ofstream was passed a char* it used the operator << (void * ptr), so it was no wonder that the pointer value got into the text file instead of the string content. I'm not convinced that this is according to the standard, as STLPort is much more standard compliant and with STLPort it works just as intended. I guess the VC6 STL bugs just have been replaced by VC7 STL bugs...
/Rob
|
|
|
|
|
I have used a bit mask before but how does one
extract individual bits. Say I wanted to extract
bit 28 from 32 bit int, how do I do that?
Thank You
Bo Hunter
|
|
|
|