|
ShowWindow(SW_HIDE) , ShowWindow(SW_SHOW) .
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
i thought ShowWindow did not work for the controls, but only the windows.
thank you!
|
|
|
|
|
Controls are windows also .
|
|
|
|
|
If you make a button on a form/dialog invisible, you might also want to disable it as well, because otherwise, the user might still tab to it or otherwise activate the window.
ControlWindow.EnableWidnow(FALSE);
ControlWindow.ShowWindow(SW_HIDE);
...
ControlWindow.ShowWindow(SW_SHOW);
ControlWindow.EnableWidnow(TRUE);
|
|
|
|
|
I'm trying to use a macro to include/exclude a function based on another define.
e.g.
#ifdef CK_DUMP
#define CKOBJ_DUMP_HEAD(CkClass) \
void FkObjDump( const CkClass &OBJ, CkFile &F ) \
{
#define CKOBJ_DUMP_TAIL \
}
#else // !CK_DUMP
#define CKOBJ_DUMP_HEAD(CkClass) /*
#define CKOBJ_DUMP_TAIL */
#endif
And use like:
CKOBJ_DUMP_HEAD(MyClass)
F.Write("blah blah blah");
CKOBJ_DUMP_TAIL
What i want is to comment out the block of code, but it doesn't like the /* */, nor does it like #if 0 #endif, nor anything else i've tried.
Any ideas ?
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Hello,
This certainly looks strange! I can see what you are trying to do and I'll show you a good solution in a moment.
First, your CKOBJ_DUMP_HEAD(CkClass) is a single line macro. The problem here is that you have placed a multiline comment there that comments out everything until a '*/' is found. Therefore the CKOBJ_DUMP_TAIL does not exist. Therefore your solution will never work.
Now, a solution that will work is the following and this is applied often in a class design. I assume here that you have objects that you want to dump.
1) Add a dump method to all the classes that need one. (in the CKDUMP section)
2) Define the following maco
<br />
#ifdef CKDUMP<br />
# define CK_DUMP_OBJ(OBJ) OBJ->Dump(); <br />
#else // !CK_DUMP<br />
# define CK_DUMP_OBJ(OBJ) <br />
#endif // CKDUMP<br />
Hope this helps.
I also got the blogging virus..[^]
|
|
|
|
|
Bob Stanneveld wrote:
The problem here is that you have placed a multiline comment there that comments out everything until a '*/' is found.
Yes, i knew what the problem was.
What i am looking for is a way to comment out the entire dump function, not just a call to it.
While i appreciate the reply, your solution doesn't do what i want.
It still requires that a dump function gets compiled - the method in the class.
What i was doing was:
MyClass.cpp
-----------
#ifdef CKDUMP
void FkObjDump( const MyClass &OBJ, CkFile &F )
{
...
}
#endif
which works fine.
I am trying to remove the #ifdef's from each source file and was looking for a way to move the equivalent functionality to a macro.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
http://www.codeproject.com/com/outlookaddin.asp[^] the above article has a line
spCmdButton2->PutFaceId(1758); where spCmdButton2 is Office::_CommandBarButton.
Thi loads the bitmap resource with id 1758 from somewhere ! Can some body help me to find out from which file it loads the resource.
|
|
|
|
|
helloo......great people......
i want to use "ObjectFromLresult" but problem is this:->
Windows 95/98/Me: Unsupported......
So what should i do??????? plz help me ASAP...
Thanx .
__________________________________________________________________________
keep smilling.....b'coz smile is the shortest distance between people....
|
|
|
|
|
The Redistributable line in MSDN Library documentation indicates that support for older operating systems is available by installing a redistributable library.
For this feature, use the Active Accessibility 2.0 RDK[^].
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
hi,
I have created one service called MyService. In this service, I want to
run an executable file which resides in Shared folder of remote
machine. i.e. \\COMP1\share\file.exe
For that I want to use CreateProcessWithLogonW() method.
In MSDN, it is mentioned that CreateProcessWithLogonW() is declared in
WINBASE.H. But when i searched WINBASE.H, it was not there.
Please help .
bhavesh
|
|
|
|
|
CreateProcessWithLogonW is only available on Windows 2000 and later. Visual C++ 6.0 predates Windows 2000. Download the latest Platform SDK[^].
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
How can i use picture controls?
|
|
|
|
|
u can use picture controlz to either put in pictures(non interactive tye) or use it to make ur own control,for creating graphic controlz.....
cheerz.....
"faith, hope, love remain, these three.....; but the greatest of these is love" -1 Corinthians 13:13
|
|
|
|
|
|
You have to be more specific.
What picture control?
JohnCz
|
|
|
|
|
Hi,
I wrote a function with variable parameters to do some log stuff in my project. The function prototype looks like this :
static void write(char* str,...);
What I wish to do is to link this function to a #define so that I can easily get rid of all my logs. The code should look like this :
<br />
#ifdef _DEBUG<br />
#define VCNLOG(x) write(x)<br />
#else<br />
#define VCNLOG(x)<br />
#endif<br />
<br />
VCNLOG("my value is %i",var);<br />
But this doesn't work due to the variable parameters (Visual complains about too much parameters in macro VCNLOG)
Any idea of how to get this work ?
thanks,
Ed
|
|
|
|
|
#ifdef _DEBUG
#define TEST test
#else
//#define TEST
#define TEST 0
#endif
void test(int, ...)
{
std::cout << "Hello, World from test() \n";
}
int _tmain(int argc, _TCHAR* argv[])
{
TEST(5, std::cout << "Hellow, World from _tmain! \n");
return 0;
}
Note that if
#define TEST
in Release mode, the test() function will never get called, but its parameters are get evaluated; so if you do not want this side effect, use:
#define TEST 0
Regards,
Serge
|
|
|
|
|
One solution:
static void write(char* str,...)
{
#ifdef _DEBUG
write to log file here
#endif
} Now all of the calls to write() can remain untouched.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
The following was based on how it is done in MFC (Afx.h):
#ifndef __MYTRACE_H__
#define __MYTRACE_H__
void MyTrace(int nLevel, LPCTSTR pFmt, ...);
#ifdef _DEBUG
#define MYTRACE MyTrace
#else
#define MYTRACE 1 ? ((void)0) : MyTrace
#endif
#endif // __MYTRACE_H__
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Yes, that is another way.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
ok, I'll try that. In fact the idea is not to include the parameters in the define...
What I don't understand is what it will do in release mode : 0(myparameters). This should crash, shouldn't it ? Or maybe there's something I missed in #define principle
thanks
Ed
|
|
|
|
|
Ed01 wrote:
What I don't understand is what it will do in release mode : 0(myparameters). This should crash, shouldn't it ? Or maybe there's something I missed in #define principle
The function gets called the same in release mode as it is in debug mode. The only difference is that the body of the function is "missing" in debug mode.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hello Friends,
What is memory leak ?
How does it affects the cpp programs and how can memory leaks can be avoided using the virutal destructors ?
Hoping for are reply.
Yours,
Phijo
|
|
|
|
|
In my knowledge you can only create memory leaks when you don't use delete for every new .
When you use new , your program reserves some memory to store the object you're creating.
You have to manually release that memory (using delete ) so it can be used again.
If you don't you reserve more and more unused memory exhausting the cpu's resources.
It's one of the things you really, really don't do. If I see a big memory leak my reaction would be: and ! Memory leaks aren't always that easy to avoid though.
try to google for more info.
good luck.
only 1 thing to remember : for every new (including the ones in loops!) do a delete !
(equal: malloc , alloc : or something (don't use them myself))
No hurries, no worries.
|
|
|
|