Click here to Skip to main content
15,905,508 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Help to modify dialog style using ModifyStyleEx() Pin
bosfan19-Feb-07 21:49
bosfan19-Feb-07 21:49 
GeneralRe: Help to modify dialog style using ModifyStyleEx() Pin
bosfan19-Feb-07 22:15
bosfan19-Feb-07 22:15 
GeneralRe: Help to modify dialog style using ModifyStyleEx() Pin
prasad_som19-Feb-07 22:31
prasad_som19-Feb-07 22:31 
AnswerRe: Help to modify dialog style using ModifyStyleEx() Pin
David Crow19-Feb-07 6:14
David Crow19-Feb-07 6:14 
GeneralRe: Help to modify dialog style using ModifyStyleEx() Pin
bosfan19-Feb-07 21:27
bosfan19-Feb-07 21:27 
QuestionRe: Help to modify dialog style using ModifyStyleEx() Pin
David Crow20-Feb-07 2:33
David Crow20-Feb-07 2:33 
AnswerRe: Help to modify dialog style using ModifyStyleEx() Pin
bosfan20-Feb-07 2:37
bosfan20-Feb-07 2:37 
GeneralRe: Help to modify dialog style using ModifyStyleEx() Pin
David Crow20-Feb-07 2:52
David Crow20-Feb-07 2:52 
GeneralRe: Help to modify dialog style using ModifyStyleEx() Pin
bosfan20-Feb-07 4:46
bosfan20-Feb-07 4:46 
QuestionWindows SDK Communication Question Pin
Jethro6319-Feb-07 4:53
Jethro6319-Feb-07 4:53 
AnswerRe: Windows SDK Communication Question Pin
Roger Stoltz19-Feb-07 5:13
Roger Stoltz19-Feb-07 5:13 
GeneralRe: Windows SDK Communication Question Pin
Jethro6319-Feb-07 7:53
Jethro6319-Feb-07 7:53 
QuestionComBSTR Question Pin
Like2Byte19-Feb-07 3:41
Like2Byte19-Feb-07 3:41 
AnswerRe: ComBSTR Question Pin
prasad_som19-Feb-07 6:00
prasad_som19-Feb-07 6:00 
GeneralRe: ComBSTR Question Pin
Like2Byte19-Feb-07 7:21
Like2Byte19-Feb-07 7:21 
AnswerRe: ComBSTR Question Pin
Stephen Hewitt19-Feb-07 17:40
Stephen Hewitt19-Feb-07 17:40 
GeneralRe: ComBSTR Question Pin
Like2Byte20-Feb-07 3:51
Like2Byte20-Feb-07 3:51 
QuestionCLISTBOX Owner Drawn ListBox , DrawText does not return correct height. Pin
Killer319-Feb-07 3:35
Killer319-Feb-07 3:35 
Questionfile input program Pin
klutez12319-Feb-07 3:19
klutez12319-Feb-07 3:19 
AnswerRe: file input program Pin
David Crow19-Feb-07 3:22
David Crow19-Feb-07 3:22 
AnswerRe: file input program Pin
toxcct19-Feb-07 3:23
toxcct19-Feb-07 3:23 
GeneralRe: file input program Pin
jhwurmbach19-Feb-07 3:32
jhwurmbach19-Feb-07 3:32 
GeneralRe: file input program Pin
Sebastian Schneider19-Feb-07 3:59
Sebastian Schneider19-Feb-07 3:59 
Questiondrawing pixels in a different game Pin
Parallan19-Feb-07 2:34
Parallan19-Feb-07 2:34 
AnswerRe: drawing pixels in a different game [modified] Pin
Newbie0019-Feb-07 4:11
Newbie0019-Feb-07 4:11 
You can draw pixels on the whole area of your screen, by locking on the display context device

//this example draws sloping straight line

case WM_PAINT:<br />
            hdc=CreateDC("DISPLAY",NULL,NULL,NULL); <br />
            ///othe lines of your program<br />
            MoveToEx(hdc,15,15,NULL);<br />
            LineTo(hdc,150,150);<br />
            DeleteDC(hdc);<br />
           break;


You can draw on the window you choose with it's process PID using these functions:
long lp=0;<br />
EnumWindows((WNDENUMPROC)EnumProc,lp); //enum all windows <br />
                                       //using EnumProc function <br />
                                       //defined below as example<br />
bool __stdcall EnumProc(HWND hWnd,/*LPARAM*/long/*lp*/)<br />
{<br />
   unsigned long* pPid;   //LPDWORD<br />
   unsigned long result;      //DWORD<br />
   void *hg;                  //HGLOBAL<br />
   unsigned long id;<br />
<br />
   if(hWnd==NULL)<br />
      return false;<br />
<br />
   hg = GlobalAlloc(GMEM_SHARE,sizeof(unsigned long));<br />
   pPid = (unsigned long *)GlobalLock(hg);<br />
<br />
   result = GetWindowThreadProcessId(hWnd,pPid);<br />
<br />
   if(result){<br />
    if(*pPid==MyPID) //if enumed pPid==your concrete PID <br />
                     //defined somewhere outside <br />
     {<br />
      WindowYouWantToDrawOn=hWnd;<br />
      return false;<br />
     }<br />
   }<br />
   else{<br />
      GlobalUnlock(hg);<br />
      GlobalFree(hg);<br />
      return false;<br />
   }<br />
   GlobalUnlock(hg);<br />
   GlobalFree(hg);<br />
   return true;<br />
}<br />
//If you chose correct PID you have got your desired handle to the <br />
//window you want to draw on<br />
//next you can get the desired window's context device <br />
hdc=GetWindowDC(WindowYouWantToDrawOn);

And now you can use your new hdc to draw pixels on the concrete window but I don't know how to synchronize your drawing program with some other program's window and it's refresh method.






-- modified at 5:56 Tuesday 20th February, 2007

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.