|
Thanx alot Cédric ... Never knew that...
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
« Programm3r » wrote:
#if 0
.. code doesn't matter ..
#endif
that are compiler directives.. as you see if you pass false in if statement nothing will be executed same here is also goign
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
Thanx alot ThatsAlok ...... Appreciate the help
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
In addition to the other responders, pre compiler directives are very usefull.
Lets say yo wanted a common code base for different eivironments you would use #ifdef #elif #endif commands.
So, for eaxmple,
#ifdef WINDOWS_NT_4
// do NT 4 specifc code
#elif
// do code for everything else
#endif
You of course need to compile different modules then for NT4, and everything else, putting the WINDOWS_NT_4 define in a header file, or make file.
Truth is the subjection of reality to an individuals perception
|
|
|
|
|
It is a preprocessor directive. The code in between #if and #endif only gets passed on to the compiler if the preprocessor evaluates #if to true.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
currently, i have a private function in cat named privateFun.
i would like to have this function "private" to all except dog's action member function.
by using the following approach, all the dog's members can access all the cat's private members.
// cat.h
//
#ifndef CAT_H
#define CAT_H
// forward declaration.
class dog;
class cat
{
private:
friend class dog;
void privateFun() {}
};
#endif
//
// cat.h
// dog.h
//
#ifndef DOG_H
#define DOG_H
#include "cat.h"
class dog
{
private:
void action()
{
cat c;
c.privateFun();
}
};
#endif
//
// dog.h
however, i would like to have ONLY dog's action member function to access cat's private members.
i try the following approach but can't work.
// cat.h
//
#ifndef CAT_H
#define CAT_H
// forward declaration.
class dog;
class cat
{
private:
friend void dog::action(); /* HERE IS THE CHANGES AND COMPILATION ERROR HAPPENS HERE. */
void privateFun() {}
};
#endif
//
// cat.h
// dog.h
//
#ifndef DOG_H
#define DOG_H
#include "cat.h"
class dog
{
private:
void action()
{
cat c;
c.privateFun();
}
};
#endif
//
// dog.h
Of course, i would get the following compilation error:
c:\Documents and Settings\YC Cheok\Desktop\aaa\cat.h(10): error C2027: use of undefined type 'dog'
However, I just cann't include the dog header file into cat. This will introduce circular include problem.
Any advice? Can I have something like member function forward declaration? Thank you very much
|
|
|
|
|
You can declare the other cat function as protected.
In that case, the dog can not access to that function
|
|
|
|
|
Hi,
well, it's for sure a simple problem for an advanced MFC user, but I don't know how to solve it
Here's what i want to do: I want to create a MFC controls dynamically to my MFC dialog without the use of the resource editor. E.g. a simple static text at the coordinates 0,0 with text on it? The reason I'm asking is that I have to add 120 leds/labels to a dialog and I don't want to make it by hand, because if something changes, I have to redo everything, Or if I want to add tabs later.
Thanks for your help.
|
|
|
|
|
Hi,
This is simple window - you can add the new e.g. by CStatic class (derivied from CWnd):
CStatic * myStatic = new CStatic;
myStatic->Create( _T("my static"), WS_CHILD|WS_VISIBLE|SS_CENTER, CRect(0,0,150,15), pParentWnd );
-----------
Mila
|
|
|
|
|
Mila025 wrote: M
Mila025 wrote:
CStatic * myStatic = new CStatic;
myStatic->Create( _T("my static"), WS_CHILD|WS_VISIBLE|SS_CENTER, CRect(0,0,150,15), pParentWnd );
don't forget to delete the MyStatic object
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
naturally
kindest regards
-----------
Mila
|
|
|
|
|
Thanks for you help
Now to the next problem
I'm using the following controler: http://www.codeproject.com/buttonctrl/LedButton.asp[^]
It's an LED button, which interhits from CButton. I can actually create a CButton dynamically, but it doesn't work with this CLedButton class. If anyone has five free minutes, it would you could say why it doesn't work this this control
|
|
|
|
|
Hi,
hm do you mean something like that:
CLedButton * led = new CLedButton;
led->Create( "an strange text", WS_CHILD|WS_VISIBLE|BS_AUTOCHECKBOX, CRect( 2, 2, 120, 20 ), this, iCtrlId );
led->SetIcons(IDI_GRAY_LED_ICON, IDI_GREEN_LED_ICON);
...
...
...
delete led;
-----------
Mila
|
|
|
|
|
Mila025 wrote: Hi,
hm do you mean something like that:
CLedButton * led = new CLedButton;
led->Create( "an strange text", WS_CHILD|WS_VISIBLE|BS_AUTOCHECKBOX, CRect( 2, 2, 120, 20 ), this, iCtrlId );
led->SetIcons(IDI_GRAY_LED_ICON, IDI_GREEN_LED_ICON);
...
...
...
delete led;
Yes, thanks. I found it out on my own at the same time and wanted to post it here, but you were faster
The BS_AUTOCHECKBOX flag needs to be set, otherwise the class asserts.
Damn, I have the feeling that asserts are really bad implemented. I'm using my non-mfc application an custom assert, which brings me directly to the line, where the assert happend and not somewhere deep in the MFC, where I have to search the huge call stack for the place, where the real assert happend.
Anyway, thanks for you help
|
|
|
|
|
Mila025 wrote: delete led;
better make a call to DestoryWindow before deleting variable or make call to delete at destructor or OnDestroy Window handller
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
hello everyone!!! i am uploading a few files using CFtpConnection:: putfile() function. the uploading is working fine in a thread. now, i want to know if there is any way (if possible) that i can add a pause-resume option to my application?? thanks...
vijay.
|
|
|
|
|
What kind of an application is that? Multi threaded or single thread? If it is a multithreaded application and if the uploading is done by a separate thread, then you will have control of that thread. If only you are using a single threaded application, Here[^] is the answer
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
well sir, thank u very much... yes, i have a separate thread for uploading files and i have even written the code to abort the thread when i press the stop button.. but still not able to make it work.. well, i will again see what mistake i am doing... thank u..
vijay.
|
|
|
|
|
Hi All,
I'm having '.jpeg' and '.png' image files in my resource.
To convert then to IPicture, I'm loading the image to HGLOBAL and from it i'm creating a IStream using CreateStreamOnHGlobal() API. Till this point i'm getting the IStream pointer for both the image types.
I'm using OleLoadPicture() to convert the IStream to IPicture... this is working file for '.jpeg' images but for '.png' i'm getting the IPicture as NULL and the HRESULT value i'm getting is some negative value..
How can i convert IStream to IPicture for '.png' images...
These files are not in disk they are in my project itself as resources...
Thanx...
Do your Duty and Don't expect the Result
|
|
|
|
|
Hi,
I have to hook a toolbar to a messanger, how can i do that.
Can any one help me in this regards, plz provide me some links regarding this issue.
Thanks in Advance
Gopinath MV
|
|
|
|
|
Hi all,
I am getting a Linker Error while Running the my exe.
error LNK2001: unresolved external symbol "public: __thiscall
What i have done is i placed a macro
AFX_EXT_CLASS before the class definition to import that class.
// code
class AFX_EXT_CLASS CGTDMultiBitTrgSettingsDlg : public CGTDBasicDlg
//code
i am getting this problem what shall i do
Uday kiran
|
|
|
|
|
I think u had used static dll.
If you have import any static dll, u have to consider two main things
1. Add the lib details in project settings
2. Add the header files into exe path
And then compile.
|
|
|
|
|
uday kiran janaswamy wrote: I am getting a Linker Error while Running the my exe.
Not possible. If you have an .exe, then the linker has already been used and was successful. If the linker failed, then no .exe was produced.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
hi,
can anybody please help me on backup policy implementation?
or anybody having link of some small algorithm of backup policy like FULL,INCREMENTAL,DIFFERENTIAL backup.
Thanks & Regards
rakesh baldha
|
|
|
|
|
There are heaps of backup policies and schedules on the net. Start with googling for a policy that fits your needs.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|