<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>CodeGuru Forums - C++ and WinAPI</title>
		<link>http://forums.codeguru.com/</link>
		<description>Discuss Windows API related issues using C++ (and Visual C++).  This is a non-MFC forum.</description>
		<language>en</language>
		<lastBuildDate>Thu, 23 May 2013 15:43:45 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://forums.codeguru.com/images/misc/rss.png</url>
			<title>CodeGuru Forums - C++ and WinAPI</title>
			<link>http://forums.codeguru.com/</link>
		</image>
		<item>
			<title><![CDATA[[RESOLVED] Largest Console window supported?]]></title>
			<link>http://forums.codeguru.com/showthread.php?537087-RESOLVED-Largest-Console-window-supported&amp;goto=newpost</link>
			<pubDate>Sat, 18 May 2013 07:45:59 GMT</pubDate>
			<description><![CDATA[I am having issues with establishing the largest console window supported on my system.  I have written this code:


Code:
---------
void vmApp::GetMaxConsoleAppSize()
{
    COORD maxConsoleSize;


    maxConsoleSize = GetLargestConsoleWindowSize(m_hStdOut);
    cout << "X = " << maxConsoleSize.X << " Y = " << maxConsoleSize.Y << endl;


    m_nMaxAppWidth = maxConsoleSize.X;
    m_nMaxAppHeight = maxConsoleSize.Y;
}
---------
This reports X = 170 Y = 59 on my system.  Issue here is that if I open a dos window (CMD), I am able to open the properties of that window and adjust the window size beyond what my method reports?  How can I achieve this?]]></description>
			<content:encoded><![CDATA[<div>I am having issues with establishing the largest console window supported on my system.  I have written this code:<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">void vmApp::GetMaxConsoleAppSize()<br />
{<br />
&nbsp; &nbsp; COORD maxConsoleSize;<br />
<br />
<br />
&nbsp; &nbsp; maxConsoleSize = GetLargestConsoleWindowSize(m_hStdOut);<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;X = &quot; &lt;&lt; maxConsoleSize.X &lt;&lt; &quot; Y = &quot; &lt;&lt; maxConsoleSize.Y &lt;&lt; endl;<br />
<br />
<br />
&nbsp; &nbsp; m_nMaxAppWidth = maxConsoleSize.X;<br />
&nbsp; &nbsp; m_nMaxAppHeight = maxConsoleSize.Y;<br />
}</code><hr />
</div> This reports X = 170 Y = 59 on my system.  Issue here is that if I open a dos window (CMD), I am able to open the properties of that window and adjust the window size beyond what my method reports?  How can I achieve this?</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?47-C-and-WinAPI">C++ and WinAPI</category>
			<dc:creator>Gerald Bates</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?537087-RESOLVED-Largest-Console-window-supported</guid>
		</item>
		<item>
			<title>Wm_drawitem</title>
			<link>http://forums.codeguru.com/showthread.php?537075-Wm_drawitem&amp;goto=newpost</link>
			<pubDate>Fri, 17 May 2013 17:20:39 GMT</pubDate>
			<description><![CDATA[I'm writing a chessboard with GDI and when I click on a square the color changes to the opposite color but then it wont get redrawn again to normal.
I verified and I get only 5 WM_DRAWITEM message after I click a case instead of 64.

I wonder why?


Code:
---------
#include <windows.h>
#include <iostream>
using namespace std;

#pragma comment(linker, "/subsystem:\"console\" /entry:\"WinMainCRTStartup\"")

#define ID_SQUARE_1      101
#define ID_SQUARE_2      102
#define SIZE     80
bool BlackOrWhite = 0;
int j=1, k=1, Ycoord=SIZE;
HINSTANCE hInst ;

LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;
void CheckClickedSquare(int wParam)
{
    switch (wParam)
    {
    case ID_SQUARE_1:
        //cout <<"1 work"<< endl;
        break ;
    case ID_SQUARE_2:
        //cout << "2 work" << endl;
        break ;
    }
}

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                    PSTR szCmdLine, int iCmdShow)
{
    static TCHAR szAppName[] = TEXT ("GDI Chessboard") ;
    MSG          msg ;
    HWND         hwnd ;
    WNDCLASS     wndclass ;

    hInst = hInstance ;

    wndclass.style         = CS_HREDRAW | CS_VREDRAW ;
    wndclass.lpfnWndProc   = WndProc ;
    wndclass.cbClsExtra    = 0 ;
    wndclass.cbWndExtra    = 0 ;
    wndclass.hInstance     = hInstance ;
    wndclass.hIcon         = LoadIcon (NULL, IDI_APPLICATION) ;
    wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW) ;
    wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
    wndclass.lpszMenuName  = szAppName ;
    wndclass.lpszClassName = szAppName ;

    if (!RegisterClass (&wndclass))
    {
        MessageBox (NULL, TEXT ("This program requires Windows NT!"),
                    szAppName, MB_ICONERROR) ;
        return 0 ;
    }

    hwnd = CreateWindow (szAppName, TEXT ("GDI Chessboard Demo"),
                         WS_OVERLAPPEDWINDOW,
                         CW_USEDEFAULT, CW_USEDEFAULT,
                         820, 800,
                         NULL, NULL, hInstance, NULL) ;

    ShowWindow (hwnd, iCmdShow) ;
    UpdateWindow (hwnd) ;

    while (GetMessage (&msg, NULL, 0, 0))
    {
        TranslateMessage (&msg) ;
        DispatchMessage (&msg) ;
    }
    return msg.wParam ;
}

LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    static HWND h[64];
    static int       cxClient, cyClient, cxChar, cyChar ;
    int              cx, cy ;
    LPDRAWITEMSTRUCT pdis ;
    POINT            pt[3] ;
    RECT             rc ;
    PAINTSTRUCT ps;
    HDC hdc;
    int x = 116,y=100, number=0;
    char ch = 'A';
    char str[2], num[2];

    switch (message)
    {
    case WM_CREATE :
    cout << "WM_CREATE" << endl;
        cxChar = LOWORD (GetDialogBaseUnits ());
        cyChar = HIWORD (GetDialogBaseUnits ());

        for (int i=1; i<65; i++)
        {
            h[i] = CreateWindow (TEXT ("button"), TEXT (""),
                                 WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
                                 0, 0, SIZE, SIZE,
                                 hwnd, (HMENU)(i+100), 0, NULL);
        }
        return 0 ;

    case WM_SIZE :
    cout << "WM_SIZE" << endl;
 
        for (int i=1; i<65; i++)
        {
            if(i%8==1)
            {
                j=1;
                Ycoord += SIZE;
            }

            MoveWindow (h[i], j*SIZE, Ycoord-90, SIZE, SIZE, TRUE);
            j++;
         
        }
        return 0 ;

    case WM_DRAWITEM :
    cout << "WM_DRAWITEM" << endl;
        pdis = (LPDRAWITEMSTRUCT) lParam ;
        // Fill area with white and frame it black

        if(k++%8==1)
        {
            BlackOrWhite = !BlackOrWhite;
        }
        if(BlackOrWhite)
        {
            FillRect (pdis->hDC, &pdis->rcItem,
                      (HBRUSH) GetStockObject (WHITE_BRUSH)) ;
        }
        else
        {
            FillRect (pdis->hDC, &pdis->rcItem,
                      (HBRUSH) GetStockObject (BLACK_BRUSH)) ;
        }
        BlackOrWhite = !BlackOrWhite;

        FrameRect (pdis->hDC, &pdis->rcItem,
                   (HBRUSH) GetStockObject (BLACK_BRUSH)) ;

        return 0 ;

    case WM_PAINT:
    cout << "WM_PAINT" << endl;
        hdc = BeginPaint(hwnd, &ps);

        for (int i=1; i<9; i++)
        {
            sprintf(str,"%c", ch++);
            TextOut(hdc, x+((i-1)*(SIZE)), 40, str, 1);
            sprintf(num,"%i", i);
            TextOut(hdc, 60, y+((i-1)*(SIZE)), num, 1);
        }
        EndPaint(hwnd, &ps) ;
        return 0;

    case WM_COMMAND :
        cout << wParam << endl;
        CheckClickedSquare(wParam);
        return 0 ;

    case WM_DESTROY :
        PostQuitMessage (0) ;
        return 0 ;
    }
    return DefWindowProc (hwnd, message, wParam, lParam) ;
}
---------
]]></description>
			<content:encoded><![CDATA[<div>I'm writing a chessboard with GDI and when I click on a square the color changes to the opposite color but then it wont get redrawn again to normal.<br />
I verified and I get only 5 WM_DRAWITEM message after I click a case instead of 64.<br />
<br />
I wonder why?<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">#include &lt;windows.h&gt;<br />
#include &lt;iostream&gt;<br />
using namespace std;<br />
<br />
#pragma comment(linker, &quot;/subsystem:\&quot;console\&quot; /entry:\&quot;WinMainCRTStartup\&quot;&quot;)<br />
<br />
#define ID_SQUARE_1&nbsp; &nbsp; &nbsp; 101<br />
#define ID_SQUARE_2&nbsp; &nbsp; &nbsp; 102<br />
#define SIZE&nbsp; &nbsp;  80<br />
bool BlackOrWhite = 0;<br />
int j=1, k=1, Ycoord=SIZE;<br />
HINSTANCE hInst ;<br />
<br />
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;<br />
void CheckClickedSquare(int wParam)<br />
{<br />
&nbsp; &nbsp; switch (wParam)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; case ID_SQUARE_1:<br />
&nbsp; &nbsp; &nbsp; &nbsp; //cout &lt;&lt;&quot;1 work&quot;&lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; break ;<br />
&nbsp; &nbsp; case ID_SQUARE_2:<br />
&nbsp; &nbsp; &nbsp; &nbsp; //cout &lt;&lt; &quot;2 work&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; break ;<br />
&nbsp; &nbsp; }<br />
}<br />
<br />
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PSTR szCmdLine, int iCmdShow)<br />
{<br />
&nbsp; &nbsp; static TCHAR szAppName[] = TEXT (&quot;GDI Chessboard&quot;) ;<br />
&nbsp; &nbsp; MSG&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; msg ;<br />
&nbsp; &nbsp; HWND&nbsp; &nbsp; &nbsp; &nbsp;  hwnd ;<br />
&nbsp; &nbsp; WNDCLASS&nbsp; &nbsp;  wndclass ;<br />
<br />
&nbsp; &nbsp; hInst = hInstance ;<br />
<br />
&nbsp; &nbsp; wndclass.style&nbsp; &nbsp; &nbsp; &nbsp;  = CS_HREDRAW | CS_VREDRAW ;<br />
&nbsp; &nbsp; wndclass.lpfnWndProc&nbsp;  = WndProc ;<br />
&nbsp; &nbsp; wndclass.cbClsExtra&nbsp; &nbsp; = 0 ;<br />
&nbsp; &nbsp; wndclass.cbWndExtra&nbsp; &nbsp; = 0 ;<br />
&nbsp; &nbsp; wndclass.hInstance&nbsp; &nbsp;  = hInstance ;<br />
&nbsp; &nbsp; wndclass.hIcon&nbsp; &nbsp; &nbsp; &nbsp;  = LoadIcon (NULL, IDI_APPLICATION) ;<br />
&nbsp; &nbsp; wndclass.hCursor&nbsp; &nbsp; &nbsp;  = LoadCursor (NULL, IDC_ARROW) ;<br />
&nbsp; &nbsp; wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;<br />
&nbsp; &nbsp; wndclass.lpszMenuName&nbsp; = szAppName ;<br />
&nbsp; &nbsp; wndclass.lpszClassName = szAppName ;<br />
<br />
&nbsp; &nbsp; if (!RegisterClass (&amp;wndclass))<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; MessageBox (NULL, TEXT (&quot;This program requires Windows NT!&quot;),<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; szAppName, MB_ICONERROR) ;<br />
&nbsp; &nbsp; &nbsp; &nbsp; return 0 ;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; hwnd = CreateWindow (szAppName, TEXT (&quot;GDI Chessboard Demo&quot;),<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  WS_OVERLAPPEDWINDOW,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  CW_USEDEFAULT, CW_USEDEFAULT,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  820, 800,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  NULL, NULL, hInstance, NULL) ;<br />
<br />
&nbsp; &nbsp; ShowWindow (hwnd, iCmdShow) ;<br />
&nbsp; &nbsp; UpdateWindow (hwnd) ;<br />
<br />
&nbsp; &nbsp; while (GetMessage (&amp;msg, NULL, 0, 0))<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; TranslateMessage (&amp;msg) ;<br />
&nbsp; &nbsp; &nbsp; &nbsp; DispatchMessage (&amp;msg) ;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; return msg.wParam ;<br />
}<br />
<br />
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)<br />
{<br />
&nbsp; &nbsp; static HWND h[64];<br />
&nbsp; &nbsp; static int&nbsp; &nbsp; &nbsp;  cxClient, cyClient, cxChar, cyChar ;<br />
&nbsp; &nbsp; int&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cx, cy ;<br />
&nbsp; &nbsp; LPDRAWITEMSTRUCT pdis ;<br />
&nbsp; &nbsp; POINT&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pt[3] ;<br />
&nbsp; &nbsp; RECT&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  rc ;<br />
&nbsp; &nbsp; PAINTSTRUCT ps;<br />
&nbsp; &nbsp; HDC hdc;<br />
&nbsp; &nbsp; int x = 116,y=100, number=0;<br />
&nbsp; &nbsp; char ch = 'A';<br />
&nbsp; &nbsp; char str[2], num[2];<br />
<br />
&nbsp; &nbsp; switch (message)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; case WM_CREATE :<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;WM_CREATE&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cxChar = LOWORD (GetDialogBaseUnits ());<br />
&nbsp; &nbsp; &nbsp; &nbsp; cyChar = HIWORD (GetDialogBaseUnits ());<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int i=1; i&lt;65; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; h[i] = CreateWindow (TEXT (&quot;button&quot;), TEXT (&quot;&quot;),<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  0, 0, SIZE, SIZE,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  hwnd, (HMENU)(i+100), 0, NULL);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; return 0 ;<br />
<br />
&nbsp; &nbsp; case WM_SIZE :<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;WM_SIZE&quot; &lt;&lt; endl;<br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int i=1; i&lt;65; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(i%8==1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; j=1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Ycoord += SIZE;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MoveWindow (h[i], j*SIZE, Ycoord-90, SIZE, SIZE, TRUE);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; j++;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; return 0 ;<br />
<br />
&nbsp; &nbsp; case WM_DRAWITEM :<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;WM_DRAWITEM&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; pdis = (LPDRAWITEMSTRUCT) lParam ;<br />
&nbsp; &nbsp; &nbsp; &nbsp; // Fill area with white and frame it black<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(k++%8==1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BlackOrWhite = !BlackOrWhite;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(BlackOrWhite)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FillRect (pdis-&gt;hDC, &amp;pdis-&gt;rcItem,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (HBRUSH) GetStockObject (WHITE_BRUSH)) ;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FillRect (pdis-&gt;hDC, &amp;pdis-&gt;rcItem,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (HBRUSH) GetStockObject (BLACK_BRUSH)) ;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; BlackOrWhite = !BlackOrWhite;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; FrameRect (pdis-&gt;hDC, &amp;pdis-&gt;rcItem,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  (HBRUSH) GetStockObject (BLACK_BRUSH)) ;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; return 0 ;<br />
<br />
&nbsp; &nbsp; case WM_PAINT:<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;WM_PAINT&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; hdc = BeginPaint(hwnd, &amp;ps);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int i=1; i&lt;9; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sprintf(str,&quot;%c&quot;, ch++);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TextOut(hdc, x+((i-1)*(SIZE)), 40, str, 1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sprintf(num,&quot;%i&quot;, i);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TextOut(hdc, 60, y+((i-1)*(SIZE)), num, 1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; EndPaint(hwnd, &amp;ps) ;<br />
&nbsp; &nbsp; &nbsp; &nbsp; return 0;<br />
<br />
&nbsp; &nbsp; case WM_COMMAND :<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; wParam &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; CheckClickedSquare(wParam);<br />
&nbsp; &nbsp; &nbsp; &nbsp; return 0 ;<br />
<br />
&nbsp; &nbsp; case WM_DESTROY :<br />
&nbsp; &nbsp; &nbsp; &nbsp; PostQuitMessage (0) ;<br />
&nbsp; &nbsp; &nbsp; &nbsp; return 0 ;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; return DefWindowProc (hwnd, message, wParam, lParam) ;<br />
}</code><hr />
</div> </div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?47-C-and-WinAPI">C++ and WinAPI</category>
			<dc:creator>MasterDucky</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?537075-Wm_drawitem</guid>
		</item>
		<item>
			<title><![CDATA[[RESOLVED] Simple Handle question]]></title>
			<link>http://forums.codeguru.com/showthread.php?537065-RESOLVED-Simple-Handle-question&amp;goto=newpost</link>
			<pubDate>Fri, 17 May 2013 12:19:36 GMT</pubDate>
			<description><![CDATA[When using GetStdHandle() function I can understand you need to make sure that you have a valid Handle to be able to write (output) and read (input) to the console.  What I don't understand, is whether obtaining those handles would ever fail?  MSDN tells me that I could get INVALID_HANDLE_VALUE or NULL.  I have never received those values?  Clearly if either write or read handles did produce an error my program should exit?

This brings me to the STD_ERROR_HANDLE.  Is it really necessary to use this handle or even quit a program if this returned an error?  This handle is not as important as the two I mentioned earlier?

I am new to this and just need a better understanding of these handles.]]></description>
			<content:encoded><![CDATA[<div>When using GetStdHandle() function I can understand you need to make sure that you have a valid Handle to be able to write (output) and read (input) to the console.  What I don't understand, is whether obtaining those handles would ever fail?  MSDN tells me that I could get INVALID_HANDLE_VALUE or NULL.  I have never received those values?  Clearly if either write or read handles did produce an error my program should exit?<br />
<br />
This brings me to the STD_ERROR_HANDLE.  Is it really necessary to use this handle or even quit a program if this returned an error?  This handle is not as important as the two I mentioned earlier?<br />
<br />
I am new to this and just need a better understanding of these handles.</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?47-C-and-WinAPI">C++ and WinAPI</category>
			<dc:creator>Gerald Bates</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?537065-RESOLVED-Simple-Handle-question</guid>
		</item>
		<item>
			<title>GetDIBits() returns wrong BGR values:</title>
			<link>http://forums.codeguru.com/showthread.php?537061-GetDIBits()-returns-wrong-BGR-values&amp;goto=newpost</link>
			<pubDate>Fri, 17 May 2013 07:36:07 GMT</pubDate>
			<description><![CDATA[GetDIBits() was not passing the correct BGR values to a COLORREF array:


Code:
---------
#include <windows.h>
#include <iostream>
using namespace std;

int main() {int i; HBITMAP hBit; HDC bdc; BITMAPINFO bmpInfo; COLORREF pixel[100];


    hBit=(HBITMAP)LoadImage(NULL,(LPCTSTR)"F:\\bitmap.bmp",IMAGE_BITMAP,10,10,LR_LOADFROMFILE);
    bdc=CreateCompatibleDC(NULL);
    SelectObject(bdc,hBit);


    bmpInfo.bmiHeader.biSize=sizeof(BITMAPINFO);
    bmpInfo.bmiHeader.biWidth=10;
    bmpInfo.bmiHeader.biHeight=-10;
    bmpInfo.bmiHeader.biPlanes=1;
    bmpInfo.bmiHeader.biBitCount=24;
    bmpInfo.bmiHeader.biCompression=BI_RGB;
    bmpInfo.bmiHeader.biSizeImage=0;


    GetDIBits(bdc,hBit,0,10,pixel,&bmpInfo,DIB_RGB_COLORS);


    for (i=0; i<100; i++) {
        cout<<GetBValue(pixel[i]);
        cout<<GetGValue(pixel[i]);
        cout<<GetRValue(pixel[i]);
        cout<<endl;
    }


    ReleaseDC(NULL,bdc);
    DeleteDC(bdc);
    DeleteObject(hBit);
    free(pixel);
    while (1) {}
}
---------
bitmap.bmp is an entirely blue (RGB(0,0,255)) 10x10 24-bit bitmap file. The first few lines of the output look like:

0
0
255

255
0
0

0
255
0

0
0
255

And it's not only the order of the values that changes; some color values are 0 when they shouldn't be. The last few COLORREF values are RGB(0,0,0). What could be the problem with the code?]]></description>
			<content:encoded><![CDATA[<div>GetDIBits() was not passing the correct BGR values to a COLORREF array:<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">#include &lt;windows.h&gt;<br />
#include &lt;iostream&gt;<br />
using namespace std;<br />
<br />
int main() {int i; HBITMAP hBit; HDC bdc; BITMAPINFO bmpInfo; COLORREF pixel[100];<br />
<br />
<br />
&nbsp; &nbsp; hBit=(HBITMAP)LoadImage(NULL,(LPCTSTR)&quot;F:\\bitmap.bmp&quot;,IMAGE_BITMAP,10,10,LR_LOADFROMFILE);<br />
&nbsp; &nbsp; bdc=CreateCompatibleDC(NULL);<br />
&nbsp; &nbsp; SelectObject(bdc,hBit);<br />
<br />
<br />
&nbsp; &nbsp; bmpInfo.bmiHeader.biSize=sizeof(BITMAPINFO);<br />
&nbsp; &nbsp; bmpInfo.bmiHeader.biWidth=10;<br />
&nbsp; &nbsp; bmpInfo.bmiHeader.biHeight=-10;<br />
&nbsp; &nbsp; bmpInfo.bmiHeader.biPlanes=1;<br />
&nbsp; &nbsp; bmpInfo.bmiHeader.biBitCount=24;<br />
&nbsp; &nbsp; bmpInfo.bmiHeader.biCompression=BI_RGB;<br />
&nbsp; &nbsp; bmpInfo.bmiHeader.biSizeImage=0;<br />
<br />
<br />
&nbsp; &nbsp; GetDIBits(bdc,hBit,0,10,pixel,&amp;bmpInfo,DIB_RGB_COLORS);<br />
<br />
<br />
&nbsp; &nbsp; for (i=0; i&lt;100; i++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout&lt;&lt;GetBValue(pixel[i]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout&lt;&lt;GetGValue(pixel[i]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout&lt;&lt;GetRValue(pixel[i]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout&lt;&lt;endl;<br />
&nbsp; &nbsp; }<br />
<br />
<br />
&nbsp; &nbsp; ReleaseDC(NULL,bdc);<br />
&nbsp; &nbsp; DeleteDC(bdc);<br />
&nbsp; &nbsp; DeleteObject(hBit);<br />
&nbsp; &nbsp; free(pixel);<br />
&nbsp; &nbsp; while (1) {}<br />
}</code><hr />
</div> bitmap.bmp is an entirely blue (RGB(0,0,255)) 10x10 24-bit bitmap file. The first few lines of the output look like:<br />
<br />
0<br />
0<br />
255<br />
<br />
255<br />
0<br />
0<br />
<br />
0<br />
255<br />
0<br />
<br />
0<br />
0<br />
255<br />
<br />
And it's not only the order of the values that changes; some color values are 0 when they shouldn't be. The last few COLORREF values are RGB(0,0,0). What could be the problem with the code?</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?47-C-and-WinAPI">C++ and WinAPI</category>
			<dc:creator>Awais Chishti</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?537061-GetDIBits()-returns-wrong-BGR-values</guid>
		</item>
		<item>
			<title>Trouble with GetDIBits()</title>
			<link>http://forums.codeguru.com/showthread.php?537045-Trouble-with-GetDIBits()&amp;goto=newpost</link>
			<pubDate>Thu, 16 May 2013 17:44:20 GMT</pubDate>
			<description><![CDATA[Hello guys, I'm new to C++ and I couldn't figure out the proper way to store pixel data of a device context into an array using GetDIBits(). Currently I am trying to get the RGB values of a single pixel of a bitmap file:


Code:
---------
#include <windows.h>
#include <iostream>
using namespace std;
int main() {HDC MemDC=CreateCompatibleDC(NULL);
	SelectObject(MemDC,(HBITMAP)LoadImage(NULL,(LPCTSTR)"F:\\gBit.bmp",IMAGE_BITMAP,1366,768,LR_LOADFROMFILE));
	HBITMAP hBit=(HBITMAP)LoadImage(NULL,(LPCTSTR)"F:\\gBit.bmp",IMAGE_BITMAP,1366,768,LR_LOADFROMFILE);
	BITMAPINFO bmi;
	BYTE p[3];


	bmi.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
	bmi.bmiHeader.biWidth=1;
	bmi.bmiHeader.biHeight=-1;
	bmi.bmiHeader.biPlanes=1;
	bmi.bmiHeader.biBitCount=24;
	bmi.bmiHeader.biCompression=BI_RGB;
	bmi.bmiHeader.biSizeImage=0;
	bmi.bmiHeader.biXPelsPerMeter=0;
	bmi.bmiHeader.biYPelsPerMeter=0;
	bmi.bmiHeader.biClrUsed=0;
	bmi.bmiHeader.biClrImportant=0;


	GetDIBits(MemDC,hBit,0,0,p,&bmi,DIB_RGB_COLORS);
	cout<<p[0]<<endl<<p[1]<<endl<<p[2];
	ReleaseDC(NULL,MemDC); DeleteDC(MemDC);
	DeleteObject(hBit); while (1) {}
}
---------
gBit.bmp, the bitmap file selected into MemDC, is an entirely white 24-bit bitmap image, so I thought cout should display 255, but for some reason it displays some weird characters. Most probably p is not initialized since the same values are returned when I remove the line containing GetDIBits(). Am I using this function properly? What could I possibly be doing wrong here?]]></description>
			<content:encoded><![CDATA[<div>Hello guys, I'm new to C++ and I couldn't figure out the proper way to store pixel data of a device context into an array using GetDIBits(). Currently I am trying to get the RGB values of a single pixel of a bitmap file:<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">#include &lt;windows.h&gt;<br />
#include &lt;iostream&gt;<br />
using namespace std;<br />
int main() {HDC MemDC=CreateCompatibleDC(NULL);<br />
&nbsp; &nbsp; &nbsp; &nbsp; SelectObject(MemDC,(HBITMAP)LoadImage(NULL,(LPCTSTR)&quot;F:\\gBit.bmp&quot;,IMAGE_BITMAP,1366,768,LR_LOADFROMFILE));<br />
&nbsp; &nbsp; &nbsp; &nbsp; HBITMAP hBit=(HBITMAP)LoadImage(NULL,(LPCTSTR)&quot;F:\\gBit.bmp&quot;,IMAGE_BITMAP,1366,768,LR_LOADFROMFILE);<br />
&nbsp; &nbsp; &nbsp; &nbsp; BITMAPINFO bmi;<br />
&nbsp; &nbsp; &nbsp; &nbsp; BYTE p[3];<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; bmi.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);<br />
&nbsp; &nbsp; &nbsp; &nbsp; bmi.bmiHeader.biWidth=1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; bmi.bmiHeader.biHeight=-1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; bmi.bmiHeader.biPlanes=1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; bmi.bmiHeader.biBitCount=24;<br />
&nbsp; &nbsp; &nbsp; &nbsp; bmi.bmiHeader.biCompression=BI_RGB;<br />
&nbsp; &nbsp; &nbsp; &nbsp; bmi.bmiHeader.biSizeImage=0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; bmi.bmiHeader.biXPelsPerMeter=0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; bmi.bmiHeader.biYPelsPerMeter=0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; bmi.bmiHeader.biClrUsed=0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; bmi.bmiHeader.biClrImportant=0;<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; GetDIBits(MemDC,hBit,0,0,p,&amp;bmi,DIB_RGB_COLORS);<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout&lt;&lt;p[0]&lt;&lt;endl&lt;&lt;p[1]&lt;&lt;endl&lt;&lt;p[2];<br />
&nbsp; &nbsp; &nbsp; &nbsp; ReleaseDC(NULL,MemDC); DeleteDC(MemDC);<br />
&nbsp; &nbsp; &nbsp; &nbsp; DeleteObject(hBit); while (1) {}<br />
}</code><hr />
</div> gBit.bmp, the bitmap file selected into MemDC, is an entirely white 24-bit bitmap image, so I thought cout should display 255, but for some reason it displays some weird characters. Most probably p is not initialized since the same values are returned when I remove the line containing GetDIBits(). Am I using this function properly? What could I possibly be doing wrong here?</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?47-C-and-WinAPI">C++ and WinAPI</category>
			<dc:creator>Awais Chishti</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?537045-Trouble-with-GetDIBits()</guid>
		</item>
		<item>
			<title>Code hangs on using sendmail command of smtp ?</title>
			<link>http://forums.codeguru.com/showthread.php?537029-Code-hangs-on-using-sendmail-command-of-smtp&amp;goto=newpost</link>
			<pubDate>Thu, 16 May 2013 04:46:27 GMT</pubDate>
			<description><![CDATA[Hi,
  I m trying to send a mail via c++ code. I downloaded EASendMail component installer in ma system.

Then using this i wrote a code in vc++. I m sending a mail using a gmail id.I m able to send the mail correctly.
The issue i m facing is that the code hangs for the time it takes to send the mail.when  i get a notification tat the mail is sent , den the cursor becomes active.I send the receiver address to the function i m calling.

<code>
using namespace EASendMailObjLib; 
using namespace std;

int SendMail(LPTSTR RecieverID)
{ 
    ::CoInitialize( NULL ); 

    IMailPtr oSmtp = NULL; 
    oSmtp.CreateInstance( "EASendMailObj.Mail"); 
    oSmtp->LicenseCode = L"TryIt"; 

    // Set your gmail email address
  oSmtp->FromAddr = L"mygmailid@gmail.com"; 


    // Add recipient email address
 
	oSmtp->AddRecipientEx( RecieverID, 0 ); 

    // Set email subject
   oSmtp->Subject = L"simple email from Visual C++ with gmail account"; 

  oSmtp->BodyText = L"Hi :)";

	
	//adds attachment from local disk
    if(oSmtp->AddAttachment( L"images/imagename.bmp") != 0)
    {
		printf("Failed to add attachment with error: %s\r\n", (const TCHAR*)oSmtp->GetLastErrDescription());
       
    }

	
    // Gmail SMTP server address
    oSmtp->ServerAddr = L"smtp.gmail.com"; 

    // If you want to use direct SSL 465 port,
    // Please add this line, otherwise TLS will be used.
    // oSmtp->ServerPort = 465;

    // detect SSL/TLS automatically
    oSmtp->SSL_init(); 

    // Gmail user authentication should use your
    // Gmail email address as the user name.
       oSmtp->UserName =  L"mygmailid@gmail.com";
    oSmtp->Password =L"passowrd123"; 
	printf("Start to send email via gmail account ...\r\n" );
  
    if( oSmtp->SendMail() == 0 ) 
    { printf("email was sent successfully!\r\n");
   
    } 
    else 
    { printf("failed to send email with the following error: %s\r\n",(const TCHAR*)oSmtp->GetLastErrDescription());
     } 

    if( oSmtp != NULL ) 
        oSmtp.Release(); 

    return 0; 
} 
</code>


I want the control to be active so that I can continue with other processes while the sending the mail happens on the background.
Can anyone pls help me in this !!!
Thankx a ton in advance.....

Regards,
Sandhya.]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
  I m trying to send a mail via c++ code. I downloaded EASendMail component installer in ma system.<br />
<br />
Then using this i wrote a code in vc++. I m sending a mail using a gmail id.I m able to send the mail correctly.<br />
The issue i m facing is that the code hangs for the time it takes to send the mail.when  i get a notification tat the mail is sent , den the cursor becomes active.I send the receiver address to the function i m calling.<br />
<br />
&lt;code&gt;<br />
using namespace EASendMailObjLib; <br />
using namespace std;<br />
<br />
int SendMail(LPTSTR RecieverID)<br />
{ <br />
    ::CoInitialize( NULL ); <br />
<br />
    IMailPtr oSmtp = NULL; <br />
    oSmtp.CreateInstance( &quot;EASendMailObj.Mail&quot;); <br />
    oSmtp-&gt;LicenseCode = L&quot;TryIt&quot;; <br />
<br />
    // Set your gmail email address<br />
  oSmtp-&gt;FromAddr = L&quot;mygmailid@gmail.com&quot;; <br />
<br />
<br />
    // Add recipient email address<br />
 <br />
	oSmtp-&gt;AddRecipientEx( RecieverID, 0 ); <br />
<br />
    // Set email subject<br />
   oSmtp-&gt;Subject = L&quot;simple email from Visual C++ with gmail account&quot;; <br />
<br />
  oSmtp-&gt;BodyText = L&quot;Hi :)&quot;;<br />
<br />
	<br />
	//adds attachment from local disk<br />
    if(oSmtp-&gt;AddAttachment( L&quot;images/imagename.bmp&quot;) != 0)<br />
    {<br />
		printf(&quot;Failed to add attachment with error: %s\r\n&quot;, (const TCHAR*)oSmtp-&gt;GetLastErrDescription());<br />
       <br />
    }<br />
<br />
	<br />
    // Gmail SMTP server address<br />
    oSmtp-&gt;ServerAddr = L&quot;smtp.gmail.com&quot;; <br />
<br />
    // If you want to use direct SSL 465 port,<br />
    // Please add this line, otherwise TLS will be used.<br />
    // oSmtp-&gt;ServerPort = 465;<br />
<br />
    // detect SSL/TLS automatically<br />
    oSmtp-&gt;SSL_init(); <br />
<br />
    // Gmail user authentication should use your<br />
    // Gmail email address as the user name.<br />
       oSmtp-&gt;UserName =  L&quot;mygmailid@gmail.com&quot;;<br />
    oSmtp-&gt;Password =L&quot;passowrd123&quot;; <br />
	printf(&quot;Start to send email via gmail account ...\r\n&quot; );<br />
  <br />
    if( oSmtp-&gt;SendMail() == 0 ) <br />
    { printf(&quot;email was sent successfully!\r\n&quot;);<br />
   <br />
    } <br />
    else <br />
    { printf(&quot;failed to send email with the following error: %s\r\n&quot;,(const TCHAR*)oSmtp-&gt;GetLastErrDescription());<br />
     } <br />
<br />
    if( oSmtp != NULL ) <br />
        oSmtp.Release(); <br />
<br />
    return 0; <br />
} <br />
&lt;/code&gt;<br />
<br />
<br />
I want the control to be active so that I can continue with other processes while the sending the mail happens on the background.<br />
Can anyone pls help me in this !!!<br />
Thankx a ton in advance.....<br />
<br />
Regards,<br />
Sandhya.</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?47-C-and-WinAPI">C++ and WinAPI</category>
			<dc:creator>sandy2511</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?537029-Code-hangs-on-using-sendmail-command-of-smtp</guid>
		</item>
		<item>
			<title>Take screenshot of Window while in Taskbar</title>
			<link>http://forums.codeguru.com/showthread.php?536967-Take-screenshot-of-Window-while-in-Taskbar&amp;goto=newpost</link>
			<pubDate>Mon, 13 May 2013 23:06:44 GMT</pubDate>
			<description><![CDATA[Is it possible to take a screenshot of a window while it's in the taskbar? If yes,please give me some example code.]]></description>
			<content:encoded><![CDATA[<div>Is it possible to take a screenshot of a window while it's in the taskbar? If yes,please give me some example code.</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?47-C-and-WinAPI">C++ and WinAPI</category>
			<dc:creator>noatom</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?536967-Take-screenshot-of-Window-while-in-Taskbar</guid>
		</item>
		<item>
			<title>Cannot maximize window</title>
			<link>http://forums.codeguru.com/showthread.php?536965-Cannot-maximize-window&amp;goto=newpost</link>
			<pubDate>Mon, 13 May 2013 23:03:27 GMT</pubDate>
			<description><![CDATA[I just cannot maximize a certain window.I'm using ShowWindow,I tried with all the SW_ parameters,and nothing.And yes,I'm 100% the hwnd is the correct one.]]></description>
			<content:encoded><![CDATA[<div>I just cannot maximize a certain window.I'm using ShowWindow,I tried with all the SW_ parameters,and nothing.And yes,I'm 100% the hwnd is the correct one.</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?47-C-and-WinAPI">C++ and WinAPI</category>
			<dc:creator>noatom</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?536965-Cannot-maximize-window</guid>
		</item>
		<item>
			<title>WinUSB interface GUID and vid/pid clarification</title>
			<link>http://forums.codeguru.com/showthread.php?536875-WinUSB-interface-GUID-and-vid-pid-clarification&amp;goto=newpost</link>
			<pubDate>Thu, 09 May 2013 05:35:37 GMT</pubDate>
			<description><![CDATA[I am working on an app that uses USB protocol to implement HDLC protocol for exchanging messages between our GUI PC app and the traffic controller.
I am using WinUSB function driver and its API to talk to USB devices. I am a bit confused about the meaning of a device interface GUID and vid/pid specified in .inf file like this;

Code:
---------
[Dev_AddReg]
HKR,,DeviceInterfaceGUIDs,0x10000,"{00873fdf-61a8-11d1-aa5e-00c04fb1728b}"
 [Standard.NTamd64]
%DeviceName% =USB_Install, USB\VID_045E&PID_930A   ; Intel 82930
---------
Is this correct to say that:
1)	When I plug in a device(s) with vid/pid specified in .inf file Windows will associate the interface GUID with that device(s) and will load WinUSB (Winusb.sys) function driver (also specified in .inf file) and from then I can use the “SetupDi” family API to enumerate all plugged in devices with specified vid/pid , open them and send/receive the data to/from them.]]></description>
			<content:encoded><![CDATA[<div>I am working on an app that uses USB protocol to implement HDLC protocol for exchanging messages between our GUI PC app and the traffic controller.<br />
I am using WinUSB function driver and its API to talk to USB devices. I am a bit confused about the meaning of a device interface GUID and vid/pid specified in .inf file like this;<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">[Dev_AddReg]<br />
HKR,,DeviceInterfaceGUIDs,0x10000,&quot;{00873fdf-61a8-11d1-aa5e-00c04fb1728b}&quot;<br />
&nbsp;[Standard.NTamd64]<br />
%DeviceName% =USB_Install, USB\VID_045E&amp;PID_930A&nbsp;  ; Intel 82930</code><hr />
</div> Is this correct to say that:<br />
1)	When I plug in a device(s) with vid/pid specified in .inf file Windows will associate the interface GUID with that device(s) and will load WinUSB (Winusb.sys) function driver (also specified in .inf file) and from then I can use the “SetupDi” family API to enumerate all plugged in devices with specified vid/pid , open them and send/receive the data to/from them.</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?47-C-and-WinAPI">C++ and WinAPI</category>
			<dc:creator>Janusz</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?536875-WinUSB-interface-GUID-and-vid-pid-clarification</guid>
		</item>
		<item>
			<title>WinHttpAddRequestHeaders and Set-Cookie Funktion?</title>
			<link>http://forums.codeguru.com/showthread.php?536841-WinHttpAddRequestHeaders-and-Set-Cookie-Funktion&amp;goto=newpost</link>
			<pubDate>Wed, 08 May 2013 08:22:16 GMT</pubDate>
			<description><![CDATA[Hi,
i try to send/set cookie to the page before i get status/request of them with:
WinHttpAddRequestHeaders( hRequest, _T("Set-Cookie: cookietest=ct; expires=Thu, 13-Feb-2014 09:19:31 GMT; path=/;\r\n"), -1L, WINHTTP_ADDREQ_FLAG_ADD & WINHTTP_ADDREQ_FLAG_REPLACE);
but something goes wrong and i cant find what, does any one knows how to send cookies to server "before" request a web page?

Thanks in advance
break]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
i try to send/set cookie to the page before i get status/request of them with:<br />
WinHttpAddRequestHeaders( hRequest, _T(&quot;Set-Cookie: cookietest=ct; expires=Thu, 13-Feb-2014 09:19:31 GMT; path=/;\r\n&quot;), -1L, WINHTTP_ADDREQ_FLAG_ADD &amp; WINHTTP_ADDREQ_FLAG_REPLACE);<br />
but something goes wrong and i cant find what, does any one knows how to send cookies to server &quot;before&quot; request a web page?<br />
<br />
Thanks in advance<br />
break</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?47-C-and-WinAPI">C++ and WinAPI</category>
			<dc:creator>break;</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?536841-WinHttpAddRequestHeaders-and-Set-Cookie-Funktion</guid>
		</item>
		<item>
			<title>Beginner WinAPI question</title>
			<link>http://forums.codeguru.com/showthread.php?536767-Beginner-WinAPI-question&amp;goto=newpost</link>
			<pubDate>Mon, 06 May 2013 01:36:12 GMT</pubDate>
			<description><![CDATA[Hello, I was curious about what you guys think would be the appropriate windows controls to use to create an excel-like spreadsheet layout with some columns being text and some columns being a dropdown. I'd like to be able to either add rows or delete rows or just click to add data to the appropriate row. Any thoughts on where to begin? Thanks!]]></description>
			<content:encoded><![CDATA[<div>Hello, I was curious about what you guys think would be the appropriate windows controls to use to create an excel-like spreadsheet layout with some columns being text and some columns being a dropdown. I'd like to be able to either add rows or delete rows or just click to add data to the appropriate row. Any thoughts on where to begin? Thanks!</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?47-C-and-WinAPI">C++ and WinAPI</category>
			<dc:creator>drwbns</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?536767-Beginner-WinAPI-question</guid>
		</item>
		<item>
			<title>WM_NOTIFY for EDITTEXT (Edit Control)</title>
			<link>http://forums.codeguru.com/showthread.php?536723-WM_NOTIFY-for-EDITTEXT-(Edit-Control)&amp;goto=newpost</link>
			<pubDate>Fri, 03 May 2013 12:02:36 GMT</pubDate>
			<description><![CDATA[hey ho!

Would be grateful for any hint 
Is there any similar notification code to WM_NOTIFY but which will work with Edit Control?
WM_NOTIFY unfortunately is not sent for Edit control and what i want to do is to:
1. check if the notification comes from certain identifier (here: IDC_inv_comment)
2. if it was double clicked
3. if (1 && 2 == true) then call the function "writetextfromdb" passing that identifier among other parameters.

This is the code i tried to use, the same one i used for e.g. ListView but it's not working for my EditControl:


Code:
---------
  case WM_NOTIFY:
		switch((( LPNMHDR ) lParam )->code ) 
		{case NM_DBLCLK: 
		if(((( LPNMHDR ) lParam )->idFrom ) == IDC_inv_comment) 
		{writetextfromdb(hwnd, IDC_inv_comment, "t_invoices", "inv_dok_code"); }
		}break; break;
---------
WM_NOTIFY is simply not sent for EditControls.

cheers
berkov]]></description>
			<content:encoded><![CDATA[<div>hey ho!<br />
<br />
Would be grateful for any hint <br />
Is there any similar notification code to WM_NOTIFY but which will work with Edit Control?<br />
WM_NOTIFY unfortunately is not sent for Edit control and what i want to do is to:<br />
1. check if the notification comes from certain identifier (here: IDC_inv_comment)<br />
2. if it was double clicked<br />
3. if (1 &amp;&amp; 2 == true) then call the function &quot;writetextfromdb&quot; passing that identifier among other parameters.<br />
<br />
This is the code i tried to use, the same one i used for e.g. ListView but it's not working for my EditControl:<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">&nbsp; case WM_NOTIFY:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; switch((( LPNMHDR ) lParam )-&gt;code ) <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {case NM_DBLCLK: <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(((( LPNMHDR ) lParam )-&gt;idFrom ) == IDC_inv_comment) <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {writetextfromdb(hwnd, IDC_inv_comment, &quot;t_invoices&quot;, &quot;inv_dok_code&quot;); }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }break; break;</code><hr />
</div> WM_NOTIFY is simply not sent for EditControls.<br />
<br />
cheers<br />
berkov</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?47-C-and-WinAPI">C++ and WinAPI</category>
			<dc:creator>berkov</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?536723-WM_NOTIFY-for-EDITTEXT-(Edit-Control)</guid>
		</item>
		<item>
			<title><![CDATA[[DC's] - how can i create an empty DC with window size?]]></title>
			<link>http://forums.codeguru.com/showthread.php?536669-DC-s-how-can-i-create-an-empty-DC-with-window-size&amp;goto=newpost</link>
			<pubDate>Wed, 01 May 2013 09:20:31 GMT</pubDate>
			<description><![CDATA[
Code:
---------
struct ImageInfo
{    
    HBITMAP ImageImage;
    BITMAP Imagebm;
    HDC ImagehdcMem;
    HBITMAP ImageMaskImage;
    BITMAP ImageMaskbm;
    HDC ImageMaskhdcMem;
};

//...................
ImageInfo DoubleBuffer;
DoubleBuffer.ImagehdcMem  = CreateCompatibleDC (Console.WindowDC);//Console.WindowDC is window DC        
DoubleBuffer.ImageImage   = CreateCompatibleBitmap (Console.WindowDC,rec.right-rec.left ,  rec.bottom-rec.top); //rec is the window RECT
SelectObject (Console.WindowDC , Console.WindowHandle); //Console.WindowHandle is the window handle
TextOut(DoubleBuffer.ImagehdcMem,10,10, "Hello world",strlen("Hello world"));
BitBlt(Console.WindowDC,0,0,DoubleBuffer.Imagebm.bmWidth  , DoubleBuffer.Imagebm.bmHeight ,DoubleBuffer.ImagehdcMem,0,0,SRCCOPY);     
system("pause");
---------
why the text isn't show in window after use BitBlt()?]]></description>
			<content:encoded><![CDATA[<div><div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">struct ImageInfo<br />
{&nbsp; &nbsp; <br />
&nbsp; &nbsp; HBITMAP ImageImage;<br />
&nbsp; &nbsp; BITMAP Imagebm;<br />
&nbsp; &nbsp; HDC ImagehdcMem;<br />
&nbsp; &nbsp; HBITMAP ImageMaskImage;<br />
&nbsp; &nbsp; BITMAP ImageMaskbm;<br />
&nbsp; &nbsp; HDC ImageMaskhdcMem;<br />
};<br />
<br />
//...................<br />
ImageInfo DoubleBuffer;<br />
DoubleBuffer.ImagehdcMem&nbsp; = CreateCompatibleDC (Console.WindowDC);//Console.WindowDC is window DC&nbsp; &nbsp; &nbsp; &nbsp; <br />
DoubleBuffer.ImageImage&nbsp;  = CreateCompatibleBitmap (Console.WindowDC,rec.right-rec.left ,&nbsp; rec.bottom-rec.top); //rec is the window RECT<br />
SelectObject (Console.WindowDC , Console.WindowHandle); //Console.WindowHandle is the window handle<br />
TextOut(DoubleBuffer.ImagehdcMem,10,10, &quot;Hello world&quot;,strlen(&quot;Hello world&quot;));<br />
BitBlt(Console.WindowDC,0,0,DoubleBuffer.Imagebm.bmWidth&nbsp; , DoubleBuffer.Imagebm.bmHeight ,DoubleBuffer.ImagehdcMem,0,0,SRCCOPY);&nbsp; &nbsp;  <br />
system(&quot;pause&quot;);</code><hr />
</div> why the text isn't show in window after use BitBlt()?</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?47-C-and-WinAPI">C++ and WinAPI</category>
			<dc:creator>Cambalinho</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?536669-DC-s-how-can-i-create-an-empty-DC-with-window-size</guid>
		</item>
		<item>
			<title>Custom Control</title>
			<link>http://forums.codeguru.com/showthread.php?536593-Custom-Control&amp;goto=newpost</link>
			<pubDate>Mon, 29 Apr 2013 06:22:07 GMT</pubDate>
			<description>I need to create a custom control.  The control needs to be similar to the one used in Photoshop for curves adjustments.  I need the control where a user can draw a line or bezier curve.  I need to be able to read the y position of every point of the line at various spots along the x-axes. 

Thanks in advance, 
Jack Adkins</description>
			<content:encoded><![CDATA[<div>I need to create a custom control.  The control needs to be similar to the one used in Photoshop for curves adjustments.  I need the control where a user can draw a line or bezier curve.  I need to be able to read the y position of every point of the line at various spots along the x-axes. <br />
<br />
Thanks in advance, <br />
Jack Adkins</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?47-C-and-WinAPI">C++ and WinAPI</category>
			<dc:creator>left1none</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?536593-Custom-Control</guid>
		</item>
		<item>
			<title><![CDATA[[RESOLVED] timeSetEvent and timeKillEvent]]></title>
			<link>http://forums.codeguru.com/showthread.php?536543-RESOLVED-timeSetEvent-and-timeKillEvent&amp;goto=newpost</link>
			<pubDate>Fri, 26 Apr 2013 14:23:40 GMT</pubDate>
			<description><![CDATA[i'm trying build a timer inside of class:

Code:
---------
class subimages
{
    public: int ActualSubimage;
    public: int MilliSecondsTimer;
    public: int TotalSubimages;
    public: ImageInfo *SubImages;
    public: bool TransparentImages;
    private: bool blnAnimation;    
    private: MMRESULT timerID;


    private: void CALLBACK TimerFunction(UINT wTimerID, UINT msg,
    DWORD dwUser, DWORD dw1, DWORD dw2)
             {
    
            if (ActualSubimage == TotalSubimages)
                ActualSubimage = 0;
            else
                ActualSubimage = ActualSubimage + 1;
            
    ;
    }

    public: void AnimationStart()
    {
        blnAnimation = true;
        timerID =timeSetEvent(MilliSecondsTimer , 0, TimerFunction, (DWORD)this, TIME_PERIODIC);;    
    }

    public: void AnimationStop()
    {
        blnAnimation = false;
        timeKillEvent(timerID);
    }
.......................
---------
but i get these error:
"--------------------Configuration: Sprite2 - Win32 Debug--------------------
Compiling...
Test Sprite2.cpp
c:\users\joaquim\documents\visual c 98\sprite2\sprite2.h(55) : error C2664: 'timeSetEvent' : cannot convert parameter 3 from 'void (unsigned int,unsigned int,unsigned long,unsigned long,unsigned long)' to 'void (__stdcall *)(unsigned int,unsigned in
t,unsigned long,unsigned long,unsigned long)'
        None of the functions with this name in scope match the target type
Error executing cl.exe.

Sprite2.exe - 1 error(s), 0 warning(s)"
(i'm using VC++6)
i don't understand why the error(the documents that i read are limited):(
can anyone advice me?]]></description>
			<content:encoded><![CDATA[<div>i'm trying build a timer inside of class:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">class subimages<br />
{<br />
&nbsp; &nbsp; public: int ActualSubimage;<br />
&nbsp; &nbsp; public: int MilliSecondsTimer;<br />
&nbsp; &nbsp; public: int TotalSubimages;<br />
&nbsp; &nbsp; public: ImageInfo *SubImages;<br />
&nbsp; &nbsp; public: bool TransparentImages;<br />
&nbsp; &nbsp; private: bool blnAnimation;&nbsp; &nbsp; <br />
&nbsp; &nbsp; private: MMRESULT timerID;<br />
<br />
<br />
&nbsp; &nbsp; private: void CALLBACK TimerFunction(UINT wTimerID, UINT msg,<br />
&nbsp; &nbsp; DWORD dwUser, DWORD dw1, DWORD dw2)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (ActualSubimage == TotalSubimages)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ActualSubimage = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ActualSubimage = ActualSubimage + 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; ;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public: void AnimationStart()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; blnAnimation = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; timerID =timeSetEvent(MilliSecondsTimer , 0, TimerFunction, (DWORD)this, TIME_PERIODIC);;&nbsp; &nbsp; <br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; public: void AnimationStop()<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; blnAnimation = false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; timeKillEvent(timerID);<br />
&nbsp; &nbsp; }<br />
.......................</code><hr />
</div> but i get these error:<br />
&quot;--------------------Configuration: Sprite2 - Win32 Debug--------------------<br />
Compiling...<br />
Test Sprite2.cpp<br />
c:\users\joaquim\documents\visual c 98\sprite2\sprite2.h(55) : error C2664: 'timeSetEvent' : cannot convert parameter 3 from 'void (unsigned int,unsigned int,unsigned long,unsigned long,unsigned long)' to 'void (__stdcall *)(unsigned int,unsigned in<br />
t,unsigned long,unsigned long,unsigned long)'<br />
        None of the functions with this name in scope match the target type<br />
Error executing cl.exe.<br />
<br />
Sprite2.exe - 1 error(s), 0 warning(s)&quot;<br />
(i'm using VC++6)<br />
i don't understand why the error(the documents that i read are limited):(<br />
can anyone advice me?</div>

 ]]></content:encoded>
			<category domain="http://forums.codeguru.com/forumdisplay.php?47-C-and-WinAPI">C++ and WinAPI</category>
			<dc:creator>Cambalinho</dc:creator>
			<guid isPermaLink="true">http://forums.codeguru.com/showthread.php?536543-RESOLVED-timeSetEvent-and-timeKillEvent</guid>
		</item>
	</channel>
</rss>
