IT Community - Software Programming, Web Development and Technical Support

Visual C++ Tips & Tricks

This is a discussion on Visual C++ Tips & Tricks within the C and C++ Programming forums, part of the Software Development category; Hi, using the following win32 API we can find Multiple VGA card in Display. EnumDisplayDevices() .......... thanks...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > C and C++ Programming

Register FAQ Members List Calendar Mark Forums Read
  #51  
Old 08-02-2007, 03:16 AM
Karpagarajan Karpagarajan is offline
D-Web Analyst
 
Join Date: Mar 2007
Posts: 301
Karpagarajan is on a distinguished road
Post Re: VC++ Tips & Tricks

Hi,

using the following win32 API we can find Multiple VGA card in Display.

EnumDisplayDevices()

..........
thanks
__________________
Karpagarajan. R
Necessity is the mother of invention
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #52  
Old 08-02-2007, 03:18 AM
Karpagarajan Karpagarajan is offline
D-Web Analyst
 
Join Date: Mar 2007
Posts: 301
Karpagarajan is on a distinguished road
Default Re: VC++ Tips & Tricks

Hi,
I need: Get Handle of Main Window from process handle.

Here is the answer....

1. - Use GetProcessId() to get process id from process handle.

Use EnumWindows() to look at each top-level window.
For each top-level window call GetWindowThreadProcessId() to get the thread id and process id that was used to create the window.
Break when you find a top-level window that was created by the specified process handle/id.
2. - Use GetWindowThreadProcessId() to get the thread id and process id that was used to create the window.

...........
thanks
__________________
Karpagarajan. R
Necessity is the mother of invention
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #53  
Old 08-02-2007, 03:20 AM
Karpagarajan Karpagarajan is offline
D-Web Analyst
 
Join Date: Mar 2007
Posts: 301
Karpagarajan is on a distinguished road
Post Re: VC++ Tips & Tricks

Trapping Windows Shutdown and Cancel the shutdown...

Hi,

Use WM_QUERYENDSESSION for system shutdown in WndProc system function.

When that message is received, return 0, pass the WM_CANCELMODE message

to that window message and then shutdown on your own by using

ExitWindowEx Api .

................
thanks
__________________
Karpagarajan. R
Necessity is the mother of invention
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #54  
Old 08-02-2007, 03:22 AM
Karpagarajan Karpagarajan is offline
D-Web Analyst
 
Join Date: Mar 2007
Posts: 301
Karpagarajan is on a distinguished road
Post Re: VC++ Tips & Tricks

To change attributes for a directory
if (! SetFileAttributes("c:\\ResOrg",FILE_ATTRIBUTE_READ ONLY))
{
DWORD dwError = GetLastError();
}
................
thanks
__________________
Karpagarajan. R
Necessity is the mother of invention
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #55  
Old 08-02-2007, 03:25 AM
Karpagarajan Karpagarajan is offline
D-Web Analyst
 
Join Date: Mar 2007
Posts: 301
Karpagarajan is on a distinguished road
Post Re: VC++ Tips & Tricks

Using multiple resource...

Hi ,

Here I am giving the tips for using multiple resource (*.rc) in your Visual C++ project

steps

1) Goto menu view-> Resource Includes
2) Resource Includes Window will be open. In that add #include "yourRes.rc" in the Compile - time Directives: textbox
3) Edit the main resource file and add #include yourRes.h behind the
#include "afxres.h"
#include yourRes.h
now your resource file will be linked

..........
thanks
__________________
Karpagarajan. R
Necessity is the mother of invention

Last edited by Booom : 08-09-2007 at 04:46 AM.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #56  
Old 08-02-2007, 03:27 AM
Karpagarajan Karpagarajan is offline
D-Web Analyst
 
Join Date: Mar 2007
Posts: 301
Karpagarajan is on a distinguished road
Post Re: VC++ Tips & Tricks

To get the Cursor (X,Y) position in PreTranslateMessage add the following code.
POINTS pts = MAKEPOINTS( pMsg->lParam );
POINT point;
point.x = pts.x;
point.y = pts.y;
in the mouse message trapping like WM_LBUTTONUP ,WM_MOUSELEAVE etc.


thanks
__________________
Karpagarajan. R
Necessity is the mother of invention
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #57  
Old 08-02-2007, 04:26 AM
Karpagarajan Karpagarajan is offline
D-Web Analyst
 
Join Date: Mar 2007
Posts: 301
Karpagarajan is on a distinguished road
Thumbs up Re: VC++ Tips & Tricks

Change the color of the VC++ IDE...

by changing the registry values, we can change the color of the Visual C++ IDE...

[HKEY_USERS\.Default\Software\Microsoft\Devstudio\6 .0\Format\Source Window]
"FontFace"="Comic Sans MS"
"FontSize"=dword:00000009
"Text"=hex:c0,80,c0,00,00,00,00,00,12,01,b2,00
"Text Selection"=hex:00,00,00,00,c0,80,c0,00,19,00,19,00
"Current Error/Tag"=hex:ff,ff,ff,00,00,00,80,00,d2,01,b2,01
"Bookmark"=hex:00,00,00,00,00,ff,ff,00,10,00,1 0,00
"Breakpoint"=hex:ff,ff,ff,00,80,00,00,00,10,00 ,10, 00
"Current Statement"=hex:00,00,00,00,ff,ff,00,00,70,00,70,00
"Selection Margin"=hex:d8,e0,f0,00,d8,e0,f0,00,13,00,13,00
"Keyword"=hex:00,ff,00,00,00,00,00,00,10,00,10 ,00
"Comment"=hex:ff,ff,00,00,00,00,00,00,10,00,11 ,00
"Number"=hex:ff,00,00,00,00,00,00,00,10,00,11, 00
"String"=hex:ff,00,00,00,00,00,00,00,10,00,11, 00
"Operator"=hex:00,ff,00,00,00,00,00,00,10,00,1 1,00
"Wizard IDL/ODL Code"=hex:80,80,80,00,00,00,00,00,14,00,15,00
"HTML Element Name"=hex:c0,80,c0,00,00,00,00,00,14,00,15,00
"HTML Attribute Name"=hex:00,ff,00,00,00,00,00,00,14,00,15,00
"HTML Attribute Value"=hex:ff,00,00,00,00,00,00,00,14,00,15,00
"HTML Comment"=hex:ff,ff,00,00,00,00,00,00,14,00,15,00
"HTML Entity"=hex:ff,c0,40,00,00,00,00,00,14,00,15,00
"HTML Tag Delimiter"=hex:00,ff,00,00,00,00,00,00,14,00,15,00
"HTML String"=hex:ff,00,00,00,00,00,00,00,14,00,15,00
"HTML Tag Text"=hex:ff,00,ff,00,00,00,00,00,14,00,15,00
"HTML Operator"=hex:00,ff,00,00,00,00,00,00,14,00,15,00
"HTML Server-Side Script"=hex:00,00,00,00,ff,ff,00,00,14,00,14,00
"Wizard Code"=hex:80,80,80,00,00,00,00,00,14,00,15,00
"User Defined Keywords"=hex:00,00,ff,00,00,00,00,00,14,00,15,00

...........
thanks
__________________
Karpagarajan. R
Necessity is the mother of invention

Last edited by Booom : 08-09-2007 at 04:46 AM.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #58  
Old 08-20-2007, 08:03 AM
Karpagarajan Karpagarajan is offline
D-Web Analyst
 
Join Date: Mar 2007
Posts: 301
Karpagarajan is on a distinguished road
Smile Re: VC++ Tips & Tricks

Hi,

here is another tips,

When debugging, you can single step into functions by pressing F11.

To break the debugging, press Ctrl+F5(this is to run the same application for debugging)

thanks
__________________
Karpagarajan. R
Necessity is the mother of invention
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #59  
Old 08-20-2007, 09:20 AM
roboeinstein roboeinstein is offline
D-Web Trainee
 
Join Date: Aug 2007
Posts: 1
roboeinstein is on a distinguished road
Question Re: VC++ Tips & Tricks

Hi,


#include<windows.h>

int_stdcall WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpszCmdLine,int nCmdShow)

{
MessageBox(0,"HELLO","TITLE",0);
return 0;

}
This program is not running it produces an error

syntax error : missing ';' before identifier 'WinMain'
error C2501: 'int_stdcall' : missing storage-class or type specifiers
fatal error C1004: unexpected end of file found
Error executing cl.exe.

How to I solve it.

Last edited by roboeinstein : 08-20-2007 at 09:22 AM.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #60  
Old 08-21-2007, 01:03 AM
Karpagarajan Karpagarajan is offline
D-Web Analyst
 
Join Date: Mar 2007
Posts: 301
Karpagarajan is on a distinguished road
Post Re: VC++ Tips & Tricks

Hi,

I hope you have started VC application wrongly. Here is the steps to run the WinMain. It is a Win32 Application. Follow the steps

1. New Project -> In Project tab, select Win32 Application
2. In your source code file for en example, if you started the project as test, then edit "test.cpp"
3. Add your Message box.
#include "stdafx.h"

int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
MessageBox(0,"Hello","Title",0);

return 0;
}
thanks
__________________
Karpagarajan. R
Necessity is the mother of invention

Last edited by Karpagarajan : 08-21-2007 at 01:09 AM.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

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


All times are GMT -7. The time now is 09:40 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.
Our Partners
One Way Moving Companies | Stamford Dentist | Euro Millions Lottery | Home Loans| Furniture

SEO by vBSEO 3.0.0