This is a discussion on Visual C++ Tips & Tricks within the C and C++ Programming forums, part of the Software Development category; The following macros make it easy to add reminders which are displayed when code is compiled. You can double click ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#21
| |||
| |||
| The following macros make it easy to add reminders which are displayed when code is compiled. You can double click on a reminder in the Output Window and jump to the line. Useful for marking TODOs. // Statements like: thanks ![]()
__________________ Karpagarajan. R Necessity is the mother of invention |
|
#22
| |||
| |||
| A bug with namespaces causes Visual C++ 6.0 to move a namespace to root in cases where it should only be in another namespace. Here is a small example: #include <string> The code above should not compile since string in the main function is unknown, i.e. it should still be in the std namespace. This bug caused me to redo some code in IPL98, instead of writing using namespace std inside the ipl namespace, I am forced to explecitely write what functions/classes I need from the std library, for instance using std::string. This works. thanks ![]()
__________________ Karpagarajan. R Necessity is the mother of invention |
|
#23
| |||
| |||
| Dealing with Palettes I have written about palettes , I will say only that the application has a single palette that is created as a simple color cube to give a rough variety of colors. The application needs to handle two palette messages, and these are taken care of by these two functions: void CPaintWnd::OnPaletteChanged(CWnd* pFocusWnd) { // See if the change was caused by us and ignore it if not. if (pFocusWnd != this) { OnQueryNewPalette(); } } BOOL CPaintWnd::OnQueryNewPalette() { // We are going active, so realize our palette. if (m_pPal) { CDC* pdc = GetDC(); CPalette *poldpal = pdc->SelectPalette(m_pPal, FALSE); UINT u = pdc->RealizePalette(); ReleaseDC(pdc); if (u != 0) { // Some colors changed, so we need to repaint. InvalidateRect(NULL, TRUE); // Repaint the lot. return TRUE; // Say we did something. } } return FALSE; // Say we did nothing. } That's more or less all there is to it, except to know that each time a new CDIB or CSprite object image is loaded, it must be mapped to this common palette by calling its MapColorsToPalette function. The CCrayon and CEraser classes are both derived from CDrawingTool, which does this for you in its Load function: void CDrawingTool::Load(UINT uiID, CPalette* pPal) { ASSERT(uiID); ASSERT(pPal); BOOL b = CSprite::Load(uiID); ASSERT(b); MapColorsToPalette(pPal); } thanks ![]()
__________________ Karpagarajan. R Necessity is the mother of invention Last edited by Karpagarajan : 04-13-2007 at 04:01 AM. |
|
#24
| |||
| |||
| Hi Here is the tips for avoiding the build errors in Visual C++. To avoid build errors, when upgrading from one version of the compiler to another, make sure you have deleted your old PDB, PCH files. thanks ![]()
__________________ Karpagarajan. R Necessity is the mother of invention Last edited by Booom : 08-09-2007 at 04:41 AM. |
|
#25
| |||
| |||
| Here is the simple way to call URL... ________________________________________ Hi.. All Here i give a simple way to call the URL using visual c++ code "ShellExecute" ShellExecute(NULL,"open", "www.google.com", "", "c:\\", SW_SHOW); thanks ![]()
__________________ Karpagarajan. R Necessity is the mother of invention Last edited by Booom : 08-09-2007 at 04:41 AM. |
|
#26
| |||
| |||
| Hi. Here is another tips. When i tried to create a dll in c using visual c++ compiler i received these errors. LNK2001: unresolved external symbol _main Debug/windll.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. Can you people tell why this error was occured? .... Yeah.. The problem is I am creating a executable file hence the compiler is looking for main method.. Inorder to create a DLL file we have to some manipulation in the project properties. i.e open the project properties window and select the link tab. change the output file from exe to DLL and the "Project Options" text box change the "subsytem console" to "dll" Thanks ![]()
__________________ Karpagarajan. R Necessity is the mother of invention Last edited by Booom : 08-09-2007 at 04:42 AM. |
|
#27
| |||
| |||
| Hi All... I developed one application which contains the listviews. In that I gave the backgournd image for the listview. In Some situations I need that listview should be blank(e.i without the background). I dont know how to do this. I spent lot time to search in that. Its simple. But that time i didnt know the code. After some R&D i found it. Do u know whats that? Yeah this is what i had written in my code. m_cListCtrl.SetBkImage( HBITMAP(0)); (HBITMAP(0) will return the NULL HBITMAP.) bye .......... thanks ![]()
__________________ Karpagarajan. R Necessity is the mother of invention |
|
#28
| |||
| |||
| Hi friends... Today I am going to give the tips and tricks for the GDI+. When I was new to the GDI+, I was not able to include the GDI+ library files into my project. Here We will see how to link the GDI+ into our project. 1.) Go to Project setting by pressing Alt+F7. 2.) Go to Link tab in the Project Property, In that select Input from the category combo list. 3.) Include the GDIplus.dll file path 4.) Then go to Application class header file(e.g App.h). In that Add the following code to link the GDI+ library class and functions. #include <vector> #include "myGdiPlus.h" using namespace Gdiplus; //Image Thread Handle ULONG_PTR gdiplusToken; //And Start the GDIplus in Application InitInstance() //begin: initialize GDI+ GdiplusStartupInput gdiplusStartupInput; VERIFY(GdiplusStartup( &gdiplusToken, &gdiplusStartupInput, NULL ) == Ok ); //end: initialize GDI+ //And Shutdown the GDIplus in Application ExitInstance() //begin: shutdown GDI+ GdiplusShutdown(gdiplusToken); //end: shutdown GDI+ Now your application will support the GDI+ class and functions ........... bye Thanks ![]()
__________________ Karpagarajan. R Necessity is the mother of invention |
|
#29
| |||
| |||
| Hi friends... Here another tips. Using GDI+, You can get the image from HBITMAP. This is why i gave as a tips, some time we will need to load a picture in Static control or listview item. For that we need HBITMAP. //The following code will help for this.Hope this will help you .............. bye Thanks ![]()
__________________ Karpagarajan. R Necessity is the mother of invention |
|
#30
| |||
| |||
| Hi... Today's tips 1. You must initialize references and non-static const members in the member-initialization list of constructor 2. To get some new powerful and useful source editor commands, click Macros on the Tools menu and load the sample macrofile bye ...... thanks
__________________ Karpagarajan. R Necessity is the mother of invention |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| C# .Net Tips & Tricks | oxygen | C# Programming | 85 | 01-08-2009 12:25 AM |
| SAP Tips & Tricks | leoraja8 | Operating Systems | 0 | 03-29-2008 12:11 AM |
| Visual Studio Tips & Tricks | SaravananJ | C# Programming | 197 | 12-20-2007 03:25 AM |
| PHP Tips and Tricks | Sabari | PHP Programming | 20 | 12-18-2007 05:26 AM |
| .NET tricks & Tips | Karpagarajan | VB.NET Programming | 1 | 04-23-2007 08:17 AM |
Our Partners |