|
any methods that converts my process ID got(from createprocess functions) to a window handle.
First of all don't use *convert*, second open Spy++ and open up IE then you will see that IE has lots windows, not just one window (toolbars,menus ...) so the question is which window's handle you want
what do you want to do anyway ?
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
As Monty v2.0 said, a mapping from a process to a HWND is a one to many mapping. Here's how you would go about doing it however:
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
{
DWORD dwProcessID;
GetWindowThreadProcessId(hwnd, &dwProcessID)
if ( dwProcessID == lParam )
{
{
return TRUE;
}
CloseHandle(pi.hThread);
WaitForInputIdle(pi.hProcess, INFINITE);
CloseHandle(pi.hProcess);
EnumWindows(&EnumWindowsProc, pi.dwProcessId);
I have not actually tested this code but the idea is sound.
Now that I've given this example here's some advice - DON'T USE IT (unless you have no choice)! You should look into controlling IE through OLE Automation.
Steve
|
|
|
|
|
Hi All,
I have my own application(EXE). My application has the ability to launch another process like calculator etc etc. Now, I create a new toolbar button and on click of that I launch Internet Explorer. It launches fine. Now my doubt is whether I can have the entire control of this new process(Internet Explorer) launched? Meaning that can I control the Internet Explorer the way I want.
Its a bit urgent. Please can anyone respond me at the earliest?
Thanks
|
|
|
|
|
There are many ways to control IE one them is BHO. Here[^] is a perfect example.
You can also Host an IE instance in you Dialog (using activex IE control)
There is also DDE[^] approach.
you have to decide what suits your need
Hope it helps
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
Thanks for the information.
But I just want to handle the control flow from IE to my application. That is I need to do certain tasks based on whether IE is clicked/my application is clicked.Say for example, I am launching IE as a process from my application. IE is currently active. Now, if I get back to my applicaton from this IE will I be able to detect the change in control from IE to my application.
|
|
|
|
|
Subramaniam s.V. wrote: But I just want to handle the control flow from IE to my application. That is I need to do certain tasks based on whether IE is clicked/my application is clicked.Say for example, I am launching IE as a process from my application. IE is currently active. Now, if I get back to my applicaton from this IE will I be able to detect the change in control from IE to my application.
That my friend didn't make sense
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
Hello,
I have a programming problem which require a great degree of parallel programming, but i not too sure about using multithreading, thus i made use of an alternate method which seem to work so far... I compile 3 different win32 applications A,B and C. Both A and B will output some values to 2 output files a and b using the fprintf method. C will access these 2 files a and b, and output a file c, which would then be read by B again to conduct some operations. I would like to ask:
1.are there any foreseeable problems which i do not know of for using this method ?
2.Would the 3 applications be running almost in parallel this method, or will there be a delay between each of them ? Is the delay significant if any ?
3.Would the multithreading method be better ? What are the advantages and disdvantages between the 2 ?
|
|
|
|
|
bad design dude !
why are you not sure about using threads, they are much easier to manage then 3 full blown applications.
How would an application know when to read a file?
What happens if one of the crashes (it can happen )
all in all the design doesn't give you a warm and fuzzy feeling
Stick with threads and pass data structures around don't use files, use Critical sections, Events and other such stuff to time the threads right, much better way IMHO.
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
For one i am not too sure about using threads...so far my experience with thread have been rather negative...i cant seem to find any good references around for multithreading.
The application doesnt need to know exactly when to read the file since it is constantly being updated by the 3 applications. Also, i am quite confident that they wouldnt crash...
hmm..but is will running 3 applications take up more resources as compared to threading a single one ?
|
|
|
|
|
BeakX wrote: i am quite confident that they wouldnt crash...
3 application accessing the same file and updating its contents i wouldn't be so sure but its your program if you feel confident go ahead.
but this was a great oppurtunity to learn multithreading cause if you do this for a living(or plan to) you would surely need to implement threads in future
just my 2 cents
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
Problems in multithreaded code only occur if both threads touch the same resource without synchronization - this applies equally to EXE's that share a resource, it's just that its harder to share such things a memory across processes. Assuming you're not using anything such as shared memory and given that you've divided the problem into 3 EXE's there's obviously not much in the way of shared resources - In this case you don't stand to lose much (if anything) by using three threads instead, but you gain efficiency as a thread is considerably more lightweight then a process.
Steve
|
|
|
|
|
I don't know if this is possible. I have a large vector of structs, each struct contains contains several arrays of strings. I need a way to store this vector to disc.
My first attempt was to store the data within Excel sheets since I have excel support added into my app anyway, but this is proving to be a little problematic. I first have to open each book and read in the data on each sheet which can be a lengthy process.
When the program starts the vector of structs is filled, on exit the user is then offered a chance to save any changes. Is there a faster/easier way to store this data?
|
|
|
|
|
you can try storing the vector in an XML file, its structured and easy to write and read.
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
If you can't serialize it, then you could use a chunk file...
|
|
|
|
|
|
i am making a dialog base application and i want to set a button on title bar and also set window position when click on maximize button.
Bankey Khandelwal
Software Engineer
|
|
|
|
|
I think http://www.codeproject.com/buttonctrl/CustomBitmapButtonDemo.asp
helpful for you
|
|
|
|
|
|
http://www.codeproject.com/dialog/skinedcaptionbars.asp
|
|
|
|
|
|
Hi,
I am having some problem in using SHBrowseForFolder,in VC++6.0..
I want to access Makenewdir button while doing SHBrowseForfolder.For that we need to enable some flags like BIF_NEWDIALOGSTYLE.But for me, its giving me undeclared identifier.can we access this button in SHBrowseForFolder in VC++6.0 or not.
can anybody help me out in this.
Thanks in Advance.
|
|
|
|
|
Try updating the windows headers with the latest windows SDK. Or you can just manually add the correct information to the source file you are using.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
I test in the follow code in the Visuall studio .Net 2003
It's work and in the window is button Make New Folder
BROWSEINFO p;
ZeroMemory ( (PVOID) &p,sizeof (BROWSEINFO));
p.ulFlags=BIF_NEWDIALOGSTYLE;
p.hwndOwner=this->m_hWnd;
p.lParam = (LPARAM)this; // pass address of object to callback function
SHBrowseForFolder(&p);
|
|
|
|
|
I tried whatever u said.but in my System, its giving BIF_NEWDIALOGSTYLE is undeclared identifier. should i install any SDK's for that.
Thanks.
|
|
|
|
|
Whats the messasge? or whats error?
|
|
|
|