|
AFAIK console apps will always create the console. What I do when I want an app to run hidden the way you do is to create a windows app but do not create a window. Create a new win32 windows app, transfer all your code over to it renaming your main function to winmain . You also have to change the winmain parameters.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
From the description of your needs, the launcher should be a GUI app, not a console app. The app can do all the work in WinMain() and never create any windows.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
Kosh reminded me of some of the prima-donna programmers I've worked with. Knew everything but when you asked them a question; never gave you a straight answer.
-- Michael P. Butler in the Lounge
|
|
|
|
|
Thanks guys; this was the solution I was looking for. The other options showed the console window briefly; which was still undesirable. Thanks!
|
|
|
|
|
How about try this?
Q124103: "HOWTO: Obtain a Console Window Handle (HWND)"
and then in the main(), do a ShowWindow(SW_HIDE);
#include <windows.h>
#include <stdio.h>
HWND GetConsoleHwnd(void)
{
#define MY_BUFSIZE 1024 // Buffer size for console window titles.
HWND hwndFound; // This is what is returned to the caller.
char pszNewWindowTitle[MY_BUFSIZE]; // Contains fabricated
// WindowTitle.
char pszOldWindowTitle[MY_BUFSIZE]; // Contains original
// WindowTitle.
// Fetch current window title.
GetConsoleTitle(pszOldWindowTitle, MY_BUFSIZE);
// Format a "unique" NewWindowTitle.
wsprintf(pszNewWindowTitle,"%d/%d",
GetTickCount(),
GetCurrentProcessId());
// Change current window title.
SetConsoleTitle(pszNewWindowTitle);
// Ensure window title has been updated.
Sleep(40);
// Look for NewWindowTitle.
hwndFound=FindWindow(NULL, pszNewWindowTitle);
// Restore original window title.
SetConsoleTitle(pszOldWindowTitle);
return(hwndFound);
}
main()
{
ShowWindow(GetConsoleHwnd() , SW_HIDE);
while(1)
Sleep(10000);
}
Vipin Aravind - MVP
|
|
|
|
|
See this...
http://www.codeproject.com/win32/runsilent.asp[^]
Happy christmas friends. May the Love of My Lord and Saviour Jesus bring forth Joy and Happiness into your life too.
<marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" hspace="2" vspace="2">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
Hello,
I want to monitor the volume of my sound. I don't
ask for a complete analyzer, I just want to measure
the "amount of loudness".
Any ideas?
Thank you in advance,
Mat.
|
|
|
|
|
How can i add color to buttons in the dialog box
Thank u in advance
|
|
|
|
|
HI ,
you need to make ownerdraw buttons and capture the WM_DRAWITEM Were you can set the SetBkColor() etc ........
Regards
FarPointer
|
|
|
|
|
Hi,
I call this function: SetBkColor(RGB(255,255,255)); in WM_DRAWITEM , But i dont find the result.
Plz help me.
Thank u
|
|
|
|
|
Make those buttons owner draw buttons and trap the WM_DRAWITEM
in your constructor <br />
CBrush brush1;<br />
brush1.CreateSolidBrush(RGB(0,0,255)); <br />
Hope this solves your problem<br />
<br />
<br />
opps !!!!!!! Add this <br />
<code>
Regards
FarPointer
-- modified at 2:36 Monday 26th December, 2005
|
|
|
|
|
Manmohan_1983 wrote: I call this function: SetBkColor(RGB(255,255,255)); in WM_DRAWITEM
what about this section http://www.codeproject.com/buttonctrl/[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
what's the use of unsigned char? if char is going to be characters?? -a , +a ??
and also tell me who to display it in an AfxMessageBox
regards,
Rookie
Installing MFC...2% complete
|
|
|
|
|
You can use unsigned char (for example) to read single byte from file without re-interpreter it as integer (positive or negative values).
But, In typical programs, the use is quite the same.
To use the AfxMessageBox you can use it in the same way of the char.
But your question is strange:
the string is build with caratchars and they are translated in a defined numerical range: so if you want to display strange values (like 190) you will obtain only strange sign!!
Merry Christmas Have a nice code day
|
|
|
|
|
char is quite bad named because its name confuses too much the newbies.
of course, char goes to be used in strings, but first, that's not always true, and secondly, it does not serves only for that.
char in C/C++ is simply a signed byte, not more, not less. that means it can be used as a character (in strings), but also as an integer of 8 bits, or as a simple 8 bits array.
about the signature, yes, a char is by default signed, which means it contains values between [-128 ; +127].
but usually, the mainly used characters in the ascii tables are under the code 127 (over that, they are called extended char sets).
if you want more than that, you'll have to use UNICODE instead of ASCII, which stores a character on 16 bits instead...
to display a char string, simply use the "" notation, ,and the compiler will format your variable as needed ('\0' terminated)...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
toxcct wrote: char in C/C++ is simply a signed byte, not more, not less
It is simply a byte, but it can be signed or unsigned - it is left to compiler implementations to decide. For instance with VC++, char is signed by default unless the option /J is specified.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
-- modified at 16:10 Saturday 24th December, 2005
|
|
|
|
|
I'd suggesting creating a typdef as follows:
typedef unsigned char to BYTE;
BYTE's are pretty useful in walking through raw data streams, manipulating graphics by having to twiddle the bits of various pixels, etc.
Read more of what I have to say at http://directx9.blogspot.com/
|
|
|
|
|
hi....
I would like to Destroy MainFrame object Created by IMPLEMENT_DYNACREATE macro.coz, it gives memory leak when i close my apllecatin window.
plz...help he...how i colud do for this...
birajendu
CyberG India
Delhi
India
|
|
|
|
|
It deletes itself automatically after the window is destroyed. Check if you stopped your message pump prematurely.
My blogs:
http://blog.joycode.com/jiangsheng
http://blog.csdn.net/jiangsheng
http://bloglines.com/public/jiangsheng
Command what is yours
Conquer what is not
---Kane
|
|
|
|
|
I am creating a class for Bitmap.
I want to have detials regarding the RGBQUAD
which specifies the colors used in the bmp file
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
why reinventing the wheel ??
BITMAP structures already exist.
moreover, what is supposed to be the "quad" part of the name ?
RGB stands for red-green-blue ; quad is for...?
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
|
Hi,
Usually we creates the bitmap info directly from BITMAPINFO structure. But you can derive another structure from it. Then you will have access to RGBQUAD values. For knowing how to derive a structure from BITMAPINFO see the below code.
struct DIBINFO : public BITMAPINFO
{
RGBQUAD arColors[255]; // Adds an extra 255 entries to palette
operator LPBITMAPINFO() { return (LPBITMAPINFO) this; }
operator LPBITMAPINFOHEADER() { return &bmiHeader; }
RGBQUAD* ColorTable() { return bmiColors; }
};
Now instead of creating a Bitmap Info object of BITMAPINFO structure create it using DIBINFO structure. It is just simple as,
DIBINFO m_bitmapInfo;
Now you can change the RGBQUAD palette by changing the values in the arColors of the bitmap. For example here i am changing the palette to a gray scale one by filling same values at Blue, Green and Red.
for(int i = 0; i < 255; i++)
{
m_bitmapInfo.arColors[i].rgbBlue = i;
m_bitmapInfo.arColors[i].rgbGreen = i;
m_bitmapInfo.arColors[i].rgbRed = i;
m_bitmapInfo.arColors[i].rgbReserved = i;
}
There is another reserved member. It may be used in some other cases as Alpha. Normaly when you tell the color of a pixel you will specify 4 values.
They are,
1. Value of Red.
2. Value of Green.
3. Value of Blue.
4. Value of Alpha.
The alpha can be considered as the transparency.
Now while creating a bitmap pass the bitmap info as m_bitmapInfo. It will do the trick.
Thanks and Regards,
Amal P.
|
|
|
|
|
"As another example if running program on MSDOS machine we want to include file msdos.h otherwise a default.h file. A macro SYSTEM is set (by OS) to type of system so check for this: "
#if SYSTEM == MSDOS
#include <msdos.h>
#else
#include ``default.h''
#endif
--------------------
but how the value of "MSDOS" is obtained??
regards,
Rookie
Installing MFC...2% complete
|
|
|
|
|
Rokiee wrote: but how the value of "MSDOS" is obtained??
Try this
printf("MSDOS = %d", MSDOS);
Hope this is what you meant...
Happy christmas friends. May the Love of My Lord and Saviour Jesus bring forth Joy and Happiness into your life too.
<marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" hspace="2" vspace="2">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
sorry, i asked it wrong. i want to know like,
eg:
if(x==3)
{
//
}
else
{
}
here if only we know the value of 'x' we can check it right?? so i mean how do u get the value for "SYSTEM".? is it set somewhere out of the program??
regards,
Rookie
Installing MFC...2% complete
|
|
|
|