?
Solved

Hi C++ GURU's I have a question on launching applications within an application

Posted on 2003-02-27
4
Medium Priority
?
213 Views
Last Modified: 2010-04-17
Hello everyone,

this is my first post and with it a question.
How do you launch an application and have it run within your applications window.

Example:
I have a CScrollView class and I want to launch an app within that view lets say the calc app. Therefore when I use the scrollbar it scrolls the calc app. Also when I minimize/maximize the view the calc app reflects these changes.

Thank you in advance for the info.
Cheers
Jim
0
Comment
Question by:JimOliveira
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 6

Assisted Solution

by:PlanetCpp
PlanetCpp earned 150 total points
ID: 8037125
You can use SetParent
let's say you want to do this with calc.exe,
first off we need to get the handle to calc.exe that's runing now.
HWND calc = FindWindow("SciCalc","");
now where did that come from?
SciCalc is the classname to the main window in calc.exe
i got that by opening spy++ (a visual studio tool, or get any APISpy) when you click find window and hold that target icon over calcs window youll see the classname. handles change each time classnames do not change ever.
so now we have the hwnd assuming that calc.exe is running, add code to check if calc == 0
now you need the handle to the window you want to put calc in, lets sya you have that in the "scrollwin" variable
SetParent(calc,scrollwin);
and now calc will move to be inside your scrollwin window as a child, if you minimize scrollwin, calc goes with it and etc.
if you want to be able to set it back, setparent returns the previous parent of the handle you send it, so you can save it to return the window later.
make sure you DO NOT close your program without first closing the calculator. so save the handle, or better yet get it again (if you change the view to scientific or vice-versa the handle changes, watch for these things) then close calc before you close the scroll window or itll error in windows.
0
 

Author Comment

by:JimOliveira
ID: 8041016
PlanetCpp

It seems that HWND calc = FindWindow("SciCalc","");
returns NULL.

Do you know what I am doing wrong?

Cheers
Jim
0
 
LVL 6

Accepted Solution

by:
PlanetCpp earned 150 total points
ID: 8043356
as long as the calc program was running it should have returned the handle. if it was running then use spy++ and check thee main classname for calc, it was SciCalc on win xp.
0
 

Expert Comment

by:CleanupPing
ID: 9447463
JimOliveira:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

Featured Post

Introducing Priority Question

Increase expert visibility of your issues by participating in Priority Question, our latest feature for Premium and Team Account holders. Adjust the priority of your question to get emergent issues in front of subject-matter experts for help when you need it most.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Six Sigma Control Plans

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question