Click here to Skip to main content
15,900,725 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
AnswerRe: postfix increment c++ question Pin
Christian Graus22-Dec-06 12:54
protectorChristian Graus22-Dec-06 12:54 
QuestionDifference in settings on laptop and destop, VC++.net 2003 Pin
minad_78621-Dec-06 2:34
minad_78621-Dec-06 2:34 
AnswerRe: Difference in settings on laptop and destop, VC++.net 2003 Pin
led mike21-Dec-06 4:54
led mike21-Dec-06 4:54 
Questioncan anybody tell me where ....? Pin
Banks K21-Dec-06 1:35
Banks K21-Dec-06 1:35 
AnswerRe: can anybody tell me where ....? Pin
led mike21-Dec-06 4:46
led mike21-Dec-06 4:46 
QuestionValue classes and structs Pin
kristmun20-Dec-06 21:47
kristmun20-Dec-06 21:47 
AnswerRe: Value classes and structs Pin
led mike21-Dec-06 4:50
led mike21-Dec-06 4:50 
QuestionConverting a IntPtr to HWND ? Pin
Fritzables20-Dec-06 17:08
Fritzables20-Dec-06 17:08 
Ok, on previous posts you may have noticed that I have been playing around with processes and the like.

I have created a Console application that fires up NOTEPAD and access the menus but I need to ensure that it remains as the ForegroundWindow.

To do this I need to acquire the Handle of the process that I started then apply it to the ForegroundWindow property - this is where I am having trouble.

The following is how I start NOTEPAD then return it's MainWindowHandle which is a IntPtr:
<br />
IntPtr Hnd;<br />
<br />
Process^ Proc = gcnew Process;<br />
Proc->StartInfo->FileName = "NOTEPAD.EXE";<br />
Proc->Start();<br />
Proc->WaitForInputIdle();<br />
Hnd = Proc->MainWindowHandle;<br />


Now when I include the following line:
SetForegroundWindow(Hnd);

I get the following error when compiling:
<br />
error C2664: 'SetForegroundWindow' : cannot convert parameter 1 from 'System::IntPtr' to 'HWND'


Can I conver a IntPtr to a HWND ?

Pete
AnswerRe: Converting a IntPtr to HWND ? Pin
User 58385220-Dec-06 18:38
User 58385220-Dec-06 18:38 
GeneralRe: Converting a IntPtr to HWND ? Pin
Fritzables21-Dec-06 10:41
Fritzables21-Dec-06 10:41 
QuestionPassing Reference to Thread Delegate Pin
ricecake20-Dec-06 8:54
ricecake20-Dec-06 8:54 
QuestionDispatching based on Names Pin
ComplexLifeForm19-Dec-06 21:33
ComplexLifeForm19-Dec-06 21:33 
AnswerRe: Dispatching based on Names Pin
bsaksida19-Dec-06 22:16
bsaksida19-Dec-06 22:16 
GeneralRe: Dispatching based on Names Pin
ComplexLifeForm20-Dec-06 0:15
ComplexLifeForm20-Dec-06 0:15 
AnswerRe: Dispatching based on Names Pin
led mike20-Dec-06 4:46
led mike20-Dec-06 4:46 
QuestionReading &amp; Writing Config Files Pin
mactick19-Dec-06 20:36
mactick19-Dec-06 20:36 
AnswerRe: Reading &amp; Writing Config Files Pin
bsaksida19-Dec-06 22:21
bsaksida19-Dec-06 22:21 
QuestionRe: Reading & Writing Config Files Pin
mactick19-Dec-06 23:22
mactick19-Dec-06 23:22 
AnswerRe: Reading & Writing Config Files Pin
bsaksida19-Dec-06 23:29
bsaksida19-Dec-06 23:29 
QuestionRe: Reading &amp; Writing Config Files Pin
mactick19-Dec-06 23:34
mactick19-Dec-06 23:34 
AnswerRe: Reading &amp;amp; Writing Config Files Pin
bsaksida20-Dec-06 0:24
bsaksida20-Dec-06 0:24 
AnswerRe: Reading & Writing Config Files Pin
led mike20-Dec-06 4:33
led mike20-Dec-06 4:33 
QuestionHi!!! Pin
alijon19-Dec-06 18:39
alijon19-Dec-06 18:39 
AnswerRe: Hi!!! Pin
kristmun19-Dec-06 20:07
kristmun19-Dec-06 20:07 
AnswerRe: Hi!!! Pin
Mark Salsbery20-Dec-06 12:41
Mark Salsbery20-Dec-06 12:41 

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.