|
I tried to fined "0xFFFF000 and 0x1FFFF000 masks".
I will appreciate if you can send me a link
|
|
|
|
|
hai to everybody
i am doing a program in C++ and it executed successfull but while i enter the values it not be visible
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<process.h>
char buf[20],p[20],cos[20];
int mutex,i,k,c,n;
class ipc
{
public:
ipc()
{
mutex=0;
}
void prosig()
{
mutex=mutex+1;
}
void consig()
{
mutex=mutex-1;
}
int buffer(int mutex)
{
if(mutex==0)
return 1;
else
return 0;
}
void producer()
{
int c;
c=buffer(mutex);
if(c==1)
{
cout<<"producer can produce item & give $ for end \n";
i=0;
while((p[i]=getch())!='$')
{
buf[i]=p[i];
i++;
}
k=i;
prosig(); cout<<"production successfully done/n";
}
else
{
cout<<"buffer is full cannot produce\n";
}
}
void consumer()
{
int c;
c=buffer(mutex);
if(c==0)
{
cout<<"consumer can consumer item\n";
for(i=0;i<k;i++)
cos[i]=buf[i];
cout<<"consumer item is ";
for(i=0;i<k;i++)
cout<<cos[i]<<endl;
consig();
cout<<"successfully done\n";
}
else
cout<<"buffer is empty. cannot consume.\n";
}
};
void main()
{
ipc p1;
int op;
clrscr();
do
{
cout<<"1:Producer.\n";
cout<<"2:Consumer.\n";
cout<<"3:Exit.\n";
cout<<"\t\t Enter your option:";
cin>>op;
switch(op)
{
case 1:
p1.producer();
break;
case 2:
p1.consumer();
break;
case 3:
exit(0);
break;
}
}
while(op<=3);
getch();
}
i think for the above underlined word not allow to visible the text while running the program
|
|
|
|
|
check with this
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<process.h>
char buf[20],p[20],cos[20];
int mutex,i,k,l,n;
class ipc
{
public:
ipc()
{
mutex=0;
}
void prosig()
{
mutex=mutex+1;
}
void consig()
{
mutex=mutex-1;
}
int buffer(int mutex)
{
if(mutex==0)
return 1;
else
return 0;
}
void producer()
{
int c;
c=buffer(mutex);
if(c==1)
{
cout<<"producer can produce item& give$ for end \n";
i-0;
while((p[i]=getchar())!='$')
{
buf[i]=p[i];
i++;
}
k=i;
prosig();
cout<<"production successful done \n";
}
else
{
cout<<"buffer is full cannot produce \n";
}
}
void consumer()
{
int c;
c=buffer(mutex);
if(c==0)
{
cout<<"consumer can consume item \n";
for(i=0;i<k;i++)
cos[i]=buf[i];
cout<<"consumed item is";
for(i=0;i<k;i++)
cout<<cos[i]<<endl;
consig();
cout<<"successfully done \n";
}
else
cout<<"buffer is empty cannot consume \n";
} //fn
}; //class
void main()
{
ipc p1;
int op;
clrscr();
do
{
cout<<"1:producer.\n";
cout<<"2:consumer.\n";
cout<<"3:exit.\n";
cout<<"\t\t Enter your option:";
cin>>op;
switch(op)
{
case 1:
p1.producer();
break;
case 2:
p1.consumer();
break;
case3:
exit(0);
break;
}
}
while(op<=3); //do
getch();
}
|
|
|
|
|
How can i select font in HDC..ie i have font structure which is stored in CFont pointer..
now can i select this font in HDC...
|
|
|
|
|
Take a look at SelectObject[^]. Be careful to reset the font to its previous value after usage.
|
|
|
|
|
Do you mean you have a CFont object and no CDC object, only a HDC and want to use the font in the DC? If so:
SelectObject(the_hdc, (HFONT)(*the_font_pointer)); should do the trick. (Don't forget error handling and storing and resetting the previous font to the DC too...)
p.s: If you would like to have a CDC object that "represents" your HDC, you can use CDC::Attach[^] to attach a CDC object to your HDC, just don't forget to also use CDC::Detach[^] if you are done with it because CDC's destructor will try to delete the DC.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
(Don't forget error handling and storing and resetting the previous font to the DC too...)
Please let me know how can i do the same..
|
|
|
|
|
HFONT originalFont = (HFONT)::SelectObjeft(the_hdc, (HFONT)(*the_cfont_pointer));
...perform drawing or whatever you wish to do with the DC and the font here...
::SelectObject(the_hdc, originalFont);
With error handling i just generally meant checking your pointers and handles against NULL and so on, just the usual stuff.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Thanks for ur reply..
if i used only...below line..
(HFONT)::SelectObjeft(the_hdc, (HFONT)(*the_cfont_pointer));
and if do not do..
::SelectObject(the_hdc, originalFont);
may i know the disadvantage
|
|
|
|
|
Your font will still be selected in the device context, which means that if some other text is written on the screen, it will be with your font and not the default font.
|
|
|
|
|
Well, first of all, why you should do it is because the documentation[^] clearly states so:
This function returns the previously selected object of the specified type. An application should always replace a new object with the original, default object after it has finished drawing with the new object.
Aside of this, i believe if you don't do it, it can lead to resource leaks. For example, when you later on destroy your CFont object, it will try to call DeleteObject on the font resource, however, since this font is still selected into your DC, it will fail, but your CFont gets destroyed anyways, and since this CFont was your only "connection" to the actual font resource (your CFont's m_hFont member held the handle to this resource), you loose control over it, it will sit in memory, taking up space in Windows's resource pool, and never get freed up (unless it gets destroyed when your application quits, i believe the system now does that, it didn't used to in the old WIn95-98 times i think). There are probably many other possibilities how one can screw up things by forgetting to restore graphic tools, but i am not aware of them, never did any "research" about this topic really.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
I had wrote a dialog based application. I want to hide main dialog at startup. I use ShowWindow( SW_HIDE ) function in InitDialog of DialogBox, but it is not working
Kindly help !!!
thanks in advance
-kk.tvm-
|
|
|
|
|
Try setting "Visible" to "FALSE" on your dialog in the resource editor.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
|
Well, if you haven't changed it, then by default a dialog based application calls DoModal on the dialog and DoModal has -as far as i can tell from the code- showing the dialog hardcoded into it. This generally makes
sense since usually there's no point in having an Invisible MODAL dialog in your application.
However, I can think of 3 things you could try:
1. Write your own DoModal, using the MFC code (copy-pasting) but removing the "show the dialog" part. Not a very nice solution but might work...
2. When displaying your dialog, either change its size to 0 or move it outside of the user's screen (in OnInitDialog) so the user doesn't actually see the dialog when it comes up, and in OnInitDialog post some message (WM_APP for example) to your dialog and in the message's handler, hide your dialog and restore the right position or size. This is an even uglier solution if you ask me...
3. Don't use domodal, change your app to use a modeless dialog, this you can create invisible and it won't be shown "automatically", i'd go this path if i were you, changing the application to use a modeless dialog instead of the modal one isn't too much trouble and it is the most elegant solution.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
thanks for your solutions
-kk.tvm-
|
|
|
|
|
kk.tvm wrote: I use ShowWindow( SW_HIDE ) function in InitDialog of DialogBox, but it is not working
Until InitDialog() has returned, the dialog window is not shown. So, don't be surprised if that fails.
Instead, put that ShowWindow(SW_HIDE) call as the first line within your dialog's OnPaint() handler. BTW, may I politely ask why are you hiding the dialog window?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Hi Rajesh
It worked, but not smooth. I developed a system tray application, it will run automatically when system starts. So i like to avoid screen appearance when starting
thank u very much
-kk.tvm-
|
|
|
|
|
What do you mean "not smooth"? If you're using a tray application, and you want the dialog to be shown at some point of time, you may have to slightly tweak this approach. Because, if you're hiding the window within the OnPaint() handler, the window will NEVER be shown! (My assumption was that you never want the dialog to be shown).
But, you can use a boolean data member to decide if or not to hide the window.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
|
use the ShowWindow( SW_HIDE ) at the end of the oninit function, so your dialog is fully initialized and can react approbiate. Think about howthe user restores the dialog
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
|
If you want to advertise, pay for it like others do. This forum is exclusively for C++/MFC queries. Your post will be removed.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
I am developing an application to play mp3 files using directshow .I want to show visualization like windows media player .But I am not getting how do i this . Is there any filter or any technique to show visualization in custom mp3 player.
|
|
|
|
|
what's the meaning of 'visualization'?
it's my pleasure to make friend with you.
|
|
|
|