|
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
|
|
|
|
|
See here. Use of an edit control is optional.
You may also want to look at SetFilePointer() followed by SetEndOfFile() .
"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,
I got some difficulity how to move bitmap image in my application
basically, the algorithm is like this,
I've got CDC as m_MapDC and it already being created and DrawPoint basically use for draw truck in the mapDC but the result is there is no truck in the map
However, If I use CPen class instead of using CBitmap, I can see the line is moving from one point to other point. Any body have suggestions
void Ctrainc::DrawPoint()
{
CBitmap btruck;
CBitmap *pbtruck = NULL;
pbtruck = (CBitmap*)m_MapDC.selectObject(&btruck);
m_MapDC.MoveTo(m_PrevTruckPoint.m_iX,m_PrevTruckPoint.m_iY);
//move to the new pos
m_MapDC.LineTo(m_CurrTruckPoint.m_iX,m_CurrTruckPoint.m_iY);
m_MapDC.SelectObject(pOrbtruck);
btruck.DeleteObject();
}
Regards,
Arif Liminto
|
|
|
|
|
To draw a bitmap on (x,y) position you need to:
(1) Create a memory DC, via CDC::CreateCompatibleDC .
(2) Select the bitmap into the memory DC.
(3) Use the CDC::BitBlt method.
See here [^] for a code sample.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|