|
How can I make a simple shell with c or c++ . have you any program
about shell writen in c or c++.
|
|
|
|
|
ok ok, i stop after this one
my question (cross posting avoided again) is this one[^]
any suggestion on how one can set the focus again to an already existing ainstance of a program ?
thanks to all of you in advance
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
toxcct wrote:
(cross posting avoided again)
Oops, I Posted my answer there!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
toxcct wrote:
any suggestion on how one can set the focus again to an already existing ainstance of a program ?
Something like:
if (bFound)
{
if (it's a popup window)
SetForegroundWindow(handle to the popup window);
if (it's an icon)
ShowWindow(handle to the popup window, SW_RESTORE);
return FALSE;
}
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
thanks david, but firstly, Alok answer satisfied my plainly (with code), and secondly, your sample is not exactly what i need.
anyway, i apreciate.
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
toxcct wrote:
...your sample is not exactly what i need.
Strange, as it has always worked for me. After you find that the mutex exists, indicating that the application is already running, it's simply a matter of restoring the window.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
oh sorry, i didn't understood your *code* at first time.
DavidCrow wrote:
SetForegroundWindow(handle to the popup window);
ShowWindow(handle to the popup window, SW_RESTORE);
hum well, how do you get handle to the popup window ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
toxcct wrote:
how do you get handle to the popup window ?
Use EnumWindows() .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
This is how I limit my apps to a single instance and activate the first instance if another is run.
HANDLE hm = CreateMutex(NULL, TRUE, "Mutex Name");<br />
DWORD dw = GetLastError();<br />
if(dw == ERROR_ALREADY_EXISTS)<br />
{<br />
SetForegroundWindow(FindWindow("ClassName", "WindowName"));<br />
return(0);<br />
}
There are probably better ways but this is the simplest I know and has always worked just fine.
|
|
|
|
|
interesting code.
but what do ClassName and WindowName represent exactly in your above line code ?
<code>SetForegroundWindow(FindWindow("ClassName", "WindowName"));</code>
thanks in advance.
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
ClassName is the name of the type of class of the window you are looking for. Such as the name you used when you called RegisterClass .
WindowName is the name of the window you wish to find. This is the window title. Such as "The Code Project - Free Source Code and Tutorials - Internet Explorer".
Read the MSDN entry for FindWindow , that should explain it better than me.
Hope this is helpful.
|
|
|
|
|
hi codeprojecter,
it's me again... (and it's not the end )
i asked this[^] for making a background from a bitmap "mosaïc-ed".
as i don't like cross posting, i dont post the entiere message but the link, but as i may i faster answers here...
it's for you guys. i'm ready !
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
If you can paint a bitmap once, it is pretty simple to do it multiple times, but with different corner
positions...
void PaintMosaic (CDC *pDC, CRect rc, CDC &m_DCPic, CSize m_PicSize)
{
CPoint pt;
GetClientRect (&rc);
for (ptOrigin.y = rc.top; ptOrigin.y < rc.bottom; ptOrigin.y += m_PicSize.cy)
{
for (ptOrigin.x = rc.left; ptOrigin.x < rc.right; ptOrigin.x += m_PicSize.cx)
{
pDC->BitBlt (ptOrigin.x,ptOrigin.y, m_PicSize.cx, m_PicSize.cy, &m_DCPic, 0,0, SRCCOPY);
}
}
}
I've not given you the bits for loading a bitmap, selecting it into a memory dc, etc, as you can
get those from the origina article you linked to.
Iain.
|
|
|
|
|
oh yes
as you say now, it becomes more clear in my mind...
in fact, i'm not familiar with such graphic stuff, that's why i was lost. but now, i would find my way.
thanks very much
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
what is endl?
what's the difference between endl and \n?
|
|
|
|
|
Hello,
endl also flushes the buffer, "\n" does not.
Blog[^]
|
|
|
|
|
so, which is better? or in which case, i should use endl and which i should use \n?
|
|
|
|
|
Thant depends on what you want. If you want that your output doesn't hang around in some buffer, use endl . If you can afford that your output doesn't become visible right away, use "\n".
Consider the following piece of code:
<br />
for( int i = 0; i < 1000; i++ )<br />
{<br />
std::cout << i << std::endl<br />
<< OtherOutput << std::endl;<br />
}<br />
std::cout << "Finished" << std::endl;<br />
The above code snippet is not very optimized. It has to wait for the ouput to flush all the data at every endl! So in this loop you take a great performance hit. The next code snippet is better:
for( int i = 0; i < 1000; i++ )
{
// some heavy calculation
std::cout << i << "\n"
<< OtherOutput << "\n";
}
std::cout << "Finished" << std::endl;
This code runs faster and it flushes the output buffer only when needed (when it's full) and when your calculation is finished.
Hope this helps
Blog[^]
|
|
|
|
|
Hello!
I have some problems with a Picture Control in MFC. I'm trying to fill it with a color selected in a CColorDialog. Do I have to create a monochrome CBimap object and then place it in the control? Is there a way to paint inside the picture control using maybe a device context? I'm using a CStatic class to interact with the control.
Thank You!
|
|
|
|
|
Check out the WM_CTLCOLOR notification message
« Superman »
|
|
|
|
|
Heh! This must be it. Thanks a lot!
|
|
|
|
|
All the text controls change their background color but not the picture control! Is there something special about it? I tryed to set the type Custom Draw but nothing works.... I'm sure that I must to do something special with it but I can't figure out what!
Thanks!
|
|
|
|
|
I have an RPC server which listens on TCP/IP endpoints for servicing client requests. It has been working fine all along, until today where on one of our client's PCs (running on W2K SP4), the server fails during its initialization.
On analysis of the error logs, I found that the when the RPC server registers its protocol sequence and end-points, it receives the error 1721 (not enough resources available for completion...). I don't understand what's causing this.
Any ideas
|
|
|
|
|
Make sure the dependencies your service has on other services are set up correctly. Maybe in this particular instance, your service is trying to start before another dependent service is running.
|
|
|
|
|
hi everyone,
my question is quite simple. i have both Visual Studio 6 and Visual Studio .NET 2003 installed on my computer.
i programmed a little tool in MFC with VC++6.
then, i'd like to burn it on a CD for someone who don't have VS installed. I must provide the MFC dll.
What DLL should i provide with my program ? MFC40.dll, MFC42.dl, MFC71.dll ???
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|