|
shivditya wrote: The reason I found is NM_CUSTOMDRAW not getting called . Even if I
post the message WM_ERASEBKGND.
Can anyone tell how to overcome this problem. Even if we call
TB_INSERTBUTTON at end of OnPaint it does not prove fruitful.
??? There seems to be lots of problems.
1) NM_CUSTOMDRAW isn't a "call" - it's a notification message sent in the form of a WM_NOTIFY.
It's also only available with certain common controls.
2) You really shouldn't be posting WM_ERASEBKGND messages - they are posted when necessary by the
system. Use Invalidate APIs to force this to occur.
3) Inserting buttons in OnPaint??? No no no no no
Whatcha tryin to do?
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Will you please explain little more. Current problem is toolbar is getting painted but its buttons are not getting visible when it gets repaited.
Actually I tried invalidating rect but it seems useless as OnPaint is already getting called. Problem is I am not able to change toolbar colour or customise it.
|| ART OF LIVING ||
|
|
|
|
|
What does the window proc look like? It sounds like window messages aren't being processed
correctly.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi,
I have a CString variable. I need to convert it to WChar of size 100.
How to do?? Any Suggestions would be helpful.
Thanks
Today is a gift, that's why it is called the present.
|
|
|
|
|
CString str("my text");
BSTR bstr = str.AllocSysString();
WCHAR w[100];
wcscpy(w, bstr);
// further you will need to do SysFreeString(bstr)
--
======
Arman
|
|
|
|
|
if _UNICODE is defined then you can just copy CString content. On the other hand, if _UNICODE is not defined, then you have to use MultiByteToWideChar [^] to get wide chars (see also the example [^]).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
here is an easy way to do
This is the published microsoft example:
CString theString( "This is a test" );
LPTSTR lpsz = new TCHAR[theString.GetLength()+1];
_tcscpy(lpsz, theString);
//... modify lpsz as much as you want
|
|
|
|
|
This works (for the OP) only if _UNICODE is defined, otherwise, LPTSTR translates to CHAR * , instead of WCHAR * . BTW, the Arman Z. Sahakyan solution will work fine in both cases.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
just a question. why a WCHAR[100] ?
anyway, are you aware of the CT2W() macro, that converts a TCHAR[] into a WCHAR[] ?
|
|
|
|
|
Hello All,
I have included the directory containing ws2_32.lib to the project in the Library files' directory. Now I am getting LNK2019 error which says that the function I am using from winsock2.h are unresolved externals. So I want to check whether my project is having the ws2_32.lib file available or not ? How can I check ? If someone knows please help me.
Thanks for the prompt reply.
Nikhs
Nikhil Trivedi
|
|
|
|
|
You need also to specify in your project settings that you want to link against this library. This is done in 'Linker' -> 'Input' -> 'Additional Dependencies' (for VS2005).
|
|
|
|
|
I didn't find anywhere Linker option. I am using Visual studio 2005. It is not in Project tab and not even in Tools->options tab where we can add the directory paths
Can you tell me where to add the library file in Visual Studio 2005?
Thanks for prompt reply.
Nikhs
Nikhil Trivedi
|
|
|
|
|
Nikhil Trivedi wrote: It is not in Project tab
Yes it is: you need to have a project opened and then you will have a menu '.... Properties' (where '....' is the name of your project).
|
|
|
|
|
you have to add the library to the linker input libraries (select, in menu Project->Settings , the Link tab, then add the library name in the Project Options list).
Hope that helps.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Thanks for your reply.
But that is with visual studio 6.0. I know that. But I have just upgraded to Visual studio 2005. Can you tell me how to add the library file in that one ?
Thanks for prompt reply.
Nikhs
Nikhil Trivedi
|
|
|
|
|
Yes, that was on VS6.
On VS2003 (the one I have), you have to select menu Project->Project properties then the Linker node and finally select Command line and add the library name to additional options list.
Please note, actually names maybe a bit different, I translated from my version (Italian) one.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
CPallini wrote: On VS2003 (the one I have), you have to select menu Project->Project properties then the Linker node and finally select Command line and add the library name to additional options list.
Heh I add them in Project properties->Linker->Input->Additional Dependencies.
The last time I mentioned that, somebody reminded me you can just add it to the tree in solution
explorer LOL
Cheers,
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I didn't know. Wonderful!
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
If you are using of vs2005 it installed library files(necessary ) on your machine but anyway
You can add this code to your source file
#pragma comment(lib, "Ws2_32.lib")
Whats your application type?(Console)
|
|
|
|
|
Thanks. That worked !
Can you just tell me how to add the library file in the project in Visual Studio 2005 ?
Thanks for prompt reply.
Nikhs
Nikhil Trivedi
|
|
|
|
|
I think you asked and I answered to you did you see my previous message?
|
|
|
|
|
Go 'Project' -> 'Project Properties' -> open 'Configuration Properties' -> open 'Linker' -> open 'Input' -> add the .lib file to 'Additional Dependencies'.
|
|
|
|
|
Thanks. Your answer was perfect.
I got it. Thanks to you and all that helped me.
Nikhs
Nikhil Trivedi
|
|
|
|
|
your answer was step by step
|
|
|
|
|
Dear All,
I want to develop a module in which I can block the number of ports (or all )according to requirement as well as open those ports. It must works for Windows XP(SP1/SP2)and above.
I have gone through Developing Firewalls for Windows 2000/XP By Jesús O.. article on codeproject, but it doesn't satisfy my criteria. Is there any other method to block the ports?
ThankYou In Advace.
Regards,
CraZyToLearn
|
|
|
|