|
Hello to all,
I am having three questions in MFC,
1)In MDI (Multiple Document Interface) application whenever we minimize or maximize application's main outer window then which function gets called which indicates that window is maximized or minimized and where it is?
2)Is there any flag value or any other value, through which I can know the current state of my application's main window means I can know that whether my main window is in maximized state or in minimized state? and if there is such a value then how can we get that value and where?
3)Suppose my application is running and application's main outer window is in maximized state and now if I opened another non MFC application(e.g. Notepad or MS-Word) without minimizing my MFC application then on screen, that non MFC application will overcome my MFC application and now if I want to see my MFC application once again then I have to click on icon of my MFC application which is on taskbar,so as to display my MFC application once again on screen.Now my question is that, in such situation, programatically (through coding) can we check whether our MFC application is being displayed on screen or not? I mean is there any way through which we can know that whether our MFC application is being displayed on screen or not?
It is urgent so can anybody help me please?.It is really urgent
Thanks and Regards,
Anay
|
|
|
|
|
AnayKulkarni wrote: 1)In MDI (Multiple Document Interface) application whenever we minimize or maximize application's main outer window then which function gets called which indicates that window is maximized or minimized and where it is?
When ever your window is maximized or minimized, the window will get WM_SYSCOMMAND message. so handle the WM_SYSCOMMAND message of the MainFrame class to know when your window is being maximized or minimized.
AnayKulkarni wrote: 2)Is there any flag value or any other value, through which I can know the current state of my application's main window means I can know that whether my main window is in maximized state or in minimized state? and if there is such a value then how can we get that value and where?
From the wParam of WM_SYSCOMMAND, you can know that. check MSDN[^] for more details.
AnayKulkarni wrote: which we can know that whether our MFC application is being displayed on screen or not?
I guess your requirment is to know whether the current window is active window or not. In that case you can handle the WM_ACTIVATEAPP[^] message in your main frame class and track activation and inactivation of your application...
AnayKulkarni wrote: It is really urgent
hmm..Other wise I wouldnt have answered
|
|
|
|
|
Yes,it worked.Thanks a lot for your valuable help.Thank you very much.
Thanks and Regards,
Anay
|
|
|
|
|
AnayKulkarni wrote: 1)In MDI (Multiple Document Interface) application whenever we minimize or maximize application's main outer window then which function gets called which indicates that window is maximized or minimized and where it is?
Your window will receive a WM_WINDOWPOSCHANGING message.
AnayKulkarni wrote: 2)Is there any flag value or any other value, through which I can know the current state of my application's main window means I can know that whether my main window is in maximized state or in minimized state? and if there is such a value then how can we get that value and where?
Such as IsZoomed() or IsIconic() ?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi All,
My exceptions are to write and read data simultaneously.As data is written it should be read by another process.For this I am using the PIPE implementation.
I wrote the following code snippet for this but it is not working
Please let know where i am wrong
Thanks
HANDLE rHandle, wHandle ;
DWORD dw ;
DWORD dw1 ;
void WriteData(LPVOID)
{
char wBuff[512];
strcpy(wBuff, "HELLO world this program for reading the pipe\n ") ;
for( ; ; )
{
Sleep(1);
if(WriteFile(wHandle, wBuff, strlen(wBuff), &dw, NULL))
{
printf("Total %d byts written\n", dw);
}
else
{
printf("Could not write the buffer Last error:%d\n ", GetLastError());
break;
}
}
}
void ReadData(LPVOID)
{
char wBuff[512];
int i =0 ;
strcpy(wBuff, "HELLO world this program for reading the pipe\n ") ;
for( ; ; )
{
Sleep(1);
if(ReadFile(rHandle, wBuff, strlen(wBuff), &dw1, NULL))
{
printf("Total %d byts read\n", dw1 );
}
else
{
printf("Could not read the buffer Last error:%d\n ", GetLastError());
break;
}
}
}
void main()
{
HANDLE aThread;
DWORD ThreadID;
int i;
if(CreatePipe( &rHandle, &wHandle, NULL, 0))
{
CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE) WriteData, NULL, 0, &ThreadID);
CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE) ReadData, NULL, 0, &ThreadID);
}
}
|
|
|
|
|
See here[^]
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
singh_nav wrote: As data is written it should be read by another process
You're using the pipe in threads, not processes, may be that's the problem
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Thanks for the input.
Can't i use the PIPE in the same process ?
|
|
|
|
|
You certainly can. But if it's in the same process, why use a pipe at all? You can use something much simpler, even a raw array, if you like, so long as you're careful about synchronization[^].
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Thanks for the info,
Actually , I have used the array in my sample program there i have to synchronize it.
Now i want to check that how to use the pipe and will it signal to read Thread automatically as it is written.
Please provide any link or sample so i could implement it in the same process.
Thanks
|
|
|
|
|
There is an article about pipes in the Code Project here[^]. Check out the Intra-process Communication part of the article, that's what you need. Hope that helps.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Thank you very much
This is exactly i wanted for.
|
|
|
|
|
No problem
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Hi,
I have application that performs some administrative activities such as hooking mouse, keyboard and some application APIs. It is running properly in Admin user i.e. the user is having full Administrative priviledges with UAC enabled and some Admin Approval mode policies enabled. But this activities will not work if I run the same application in standard user profile with with UAC enabled and some Admin Approval mode policies enabled. However, standard user will not have full admin priviledges to perform these activities.
I would like to do the same activities in standard user profile. Please let me know is there any way to implement this in VC++.
Thanks
SNI
jhghjghj
|
|
|
|
|
If your process requires elevated privileges, then it
needs to run elevated, right?
A standard user is going to need credentials to get past UAC AFAIK.
UAC wouldn't be effective if you could code your way around it.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Yes u r right and I'm running this application with admin credentials i.e. built in administrator account. even though it is not loading driver in standard user profile if UAC is enabled.
jhghjghj
|
|
|
|
|
Do you just need the app to run elevated?
If so you can do that with a manifest entry.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
yes we can do that using manifest file but problem with manifest file is that, if we configure that process should run with admin credentials then it will always prompt user to provide admin PASSWORD. Please correct me if i'm wrong.
Also I tried this with sample program where i'm providing requestLevel = 'requireAdministrator' but it is not working. If you know proper way to do it pls let me know. while compiling program it gives warning that requestPriviledge tag is bypasses or not consider.
jhghjghj
|
|
|
|
|
I have ported my aplication to .Net and compile my code with manifest file. one of my application requires admin credentials so i have configured it as requestLevel = 'requireAdministrator' and while running this application it will prompt for admin password. when user provides this pass word then I am able to perform admin activities.
But i dont want to know admin password the end user. Please let me know is there any way in vista by which we can provide admin credentials to the processes without user intervention.
jhghjghj
|
|
|
|
|
Hi All
I want to create a .txt file and set it size like 10mb.Can any one give me artical.Plz help me
|
|
|
|
|
You can use of CStdioFile Class or CFile class for make file but I dont think its possible to set size. its possible with Naveen's answer.
modified on Wednesday, October 15, 2008 1:56 AM
|
|
|
|
|
Hamid. wrote: I dont think its possible to set size
it is possible with CFile::SetLength[^] function.
|
|
|
|
|
I forgot it. 
|
|
|
|
|
|
Can you tell us what are you trying to achieve? What purpose does it server to manually set the size of a file?
-Saurabh
|
|
|
|