|
I have a console app that I'd like to run without the console popping up - no matter who calls it. I know normally, the calling app would use certain flags to hide it when calling CreateProcess() but the ability may not always be there for our users. They are calling it from within another app with scripting capabilities so they are not actually writing a C++ project to call out app. There may be a way to do it from that software (Citect) but I can't be sure.
Other than re-writing it as a Windows GUI app, is there anything else I can do to have it run without the console popping up?
|
|
|
|
|
Even if you find the console window and hide it, there'll still be a momentary flicker that'd be visible to most users. Instead - you only need to change main to WinMain and change the SUBSYSTEM linker setting to WINDOWS . As long as you don't create and show any UI, a WinMain app will be pretty much hidden (visually).
|
|
|
|
|
Nishant is right. I had the same problem and finally figured it out. It now works great without any screen flicker!
|
|
|
|
|
Windows Data Types: for examples:
ULONG_PTR
PDWORD_PTR
are undeclared identifier in MFC/VC++/Platform SDK!!!
But I check the <<platform sdk="" documentation="">> all these Windows Data Types
are declared in BaseTsd.h???
Whay? How can I got these Windows Data Type's declare?!!
Thanks
|
|
|
|
|
rat.crown wrote:
How can I got these Windows Data Type's declare?!!
As you've found, they are already declared in BaseTsd.h . Why are you wanting to redeclare them?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I download the file:PSDK-x86.exe from the microsoft website ( Windows® Server 2003 SP1 Platform SDK Web Install )
http://www.microsoft.com/downloads/details.aspx?FamilyId=A55B6B43-E24F-4EA3-A93E-40C0EC4F68E5&displaylang=en
Then I installed it on my computer. In the folder: C:\Program Files\Microsoft Platform SDK\Include , I got the file BaseTsd.h, But in the file, there are no the Data type declared!!!
Thanks
|
|
|
|
|
|
|
I download the file:PSDK-x86.exe from the microsoft website ( Windows® Server 2003 SP1 Platform SDK Web Install )
http://www.microsoft.com/downloads/details.aspx?FamilyId=A55B6B43-E24F-4EA3-A93E-40C0EC4F68E5&displaylang=en
Then I installed it on my computer. In the folder: C:\Program Files\Microsoft Platform SDK\Include , I got the file BaseTsd.h, But in the file, there are no the Data type declared!!!
Thanks
|
|
|
|
|
I've run into a conundrum. I want to monitor a directory with my program, say every second or even every minute, but I want to allow the user to continue to manipulate the dialog. The only way I know to wait a specified time is by using the Sleep command (i.e. Sleep(1000) waits for 1000 millisecond, or 1 second, to continue). I could continue to do something like CTime::GetCurrentTime(), and compare the new times with some previous time, but that still would hang the application, not allowing the user to press buttons in the mean time.
So, does anyone know how I can check on something every second or every minute, and yet not hang up the app?
|
|
|
|
|
Use SetTimer and then you can monitor the time usign the associated OnTimer event.
Elaine
The tigress is here
|
|
|
|
|
Start a second thread to do the checking for you.
Wait on an event, for 1000 milliseconds.
If you get WAIT_TIMEOUT, then the time limit has 'approximately' elapsed.
The event is used to signal from the main application threaed that your secondary 'timer' thread should exit.
If your secondary thread finds something 'interesting' it can post message back to main thread, or take whatever action it is you are monitoring.
|
|
|
|
|
Thanks for your helpful response.
However, I've had limited experience with threads. Is there a function or class I can look up in MSDN to get me started?
|
|
|
|
|
G****N CP! Why is it 'hanging' on me looking like my responses are 99.99999999999999999999999999% submitted
Look at some of the samples on threads here at CP.
There are some samples using MFC and others that do not.
I believe one of them even uses the ReadDirectoryChangesW API to monitor a directory for changes.
See here:
http://www.codeproject.com/file/directorychangewatcher.asp[^]
|
|
|
|
|
Use ReadDirectoryChangesW() and/or FindFirstChangeNotification() so that you don't needlessly tie up the CPU.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Hello,
I have found a code snippet on the internet which uses this both functions. The File includes the stdlib.h where this both functions should be defined. But they aren't.
Why aren't they defined ? Where can i download a stdlib.h file where they are defined ?
With best regards,
RedDragon2kx
|
|
|
|
|
Are you sure those functions, and the code snipet for that matter, are not targeted for a Unix platform? The Windows SDK has no such functions.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
a quick googling shows this to be a common definition:
#ifdef WIN32
#define lrand48(x) rand(x)
#define srand48(x) rand(x)
#endif
Cleek | Image Toolkits | Thumbnail maker
-- modified at 13:44 Monday 12th September, 2005
|
|
|
|
|
Chris Losinger wrote:
#define srand48(x) rand(x)
I would think that srand48() would resolve to srand() .
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
|
I need to display more than 5000 chars in a edit box.
It seems like MFC edit bos has a limit of 5000 chars.
any suggestions to get around this would be helpful.
thanks
Sanjay
|
|
|
|
|
Sanjay R. Zore wrote:
It seems like MFC edit bos has a limit of 5000 chars.
No such limit exists. What makes you think that an edit control is limited to 5000 characters?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
see CEdit::LimitText
unless you're on 16-bit Windows or Win 95, the only limit on edit control data size is the size of an unsigned 32 bit integer, which is somewhat larger than 5000...
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
i'm trying to run two separate threads. its working when i use an Integer to be passed as an argument to the thread. for example, if i send '1' one thread will keep on telling 1,1,1,1,1,1,1.
[tested using msgbox]
mean while, i send '2'. then another instance of the thread will start saying 2,2,2,2,2,2,
so u will get like 1,2,1,2,1,2,2,1,2,1,1.. like that.. its woking fine.
But if i pass a char[] parameter, its not working
ie,
if i pass "TEST",
it says , "TEST","TEST","TEST".......
meanwhile if i start another to say "CODE",
its destroys "TEST" and so two instance of "CODE" is displayed.
like instead of "TEST","CODE","TEST","CODE",... am getting like "CODE","CODE","CODE"...
plz tell me how to go..
thanks in advance
Thanks in advnace
V
|
|
|
|
|
Vivekuniq wrote:
plz tell me how to go.
You need thread synchronization for this to work. Place a critical section or mutex around your display routine so that only one thread can print at one time.
John
|
|
|
|