Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 21st, 2006, 2:57 PM   #11
badbasser98
Hobbyist Programmer
 
Join Date: Mar 2005
Location: United States
Posts: 124
Rep Power: 4 badbasser98 is on a distinguished road
You mean in this location?



Thanks,
-BB98
__________________
Learning to use C++ and loving every minute of it.
badbasser98 is offline   Reply With Quote
Old Apr 21st, 2006, 3:10 PM   #12
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Nope, this 'un :



Since it ainnapparent'ly there, look here:



If all else fails, see if the boogers let you do this in the makefile:
LIBS =  -L"C:/Dev-Cpp/lib"  -mwindows 
CXXFLAGS = $(CXXINCS)   -mwindows
CFLAGS = $(INCS)   -mwindows
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Apr 21st, 2006, 3:21 PM   #13
badbasser98
Hobbyist Programmer
 
Join Date: Mar 2005
Location: United States
Posts: 124
Rep Power: 4 badbasser98 is on a distinguished road
Well, it does have it in the compiler options. However, it does not prevent the console from opening. I have a GUI that installs an update.exe when that button is clicked. I used a system(file path); call. Is there a better way that does not create a console window?

Thanks for the help DaWei
__________________
Learning to use C++ and loving every minute of it.
badbasser98 is offline   Reply With Quote
Old Apr 21st, 2006, 3:28 PM   #14
jayme
Professional Programmer
 
jayme's Avatar
 
Join Date: Nov 2005
Location: Canada
Posts: 495
Rep Power: 0 jayme is an unknown quantity at this point
Send a message via MSN to jayme
If you don't need the console, and you don't want the app to show anything on the screen just use winapi and hide the window.
__________________

Quote:
Originally Posted by Mohamed Jihad
Durka durka!
Due to incorrect calculations during the middle ages, our calendar actually begins a few years after Jesus' birth. Thus the real 6/6/6 happened a few years back. The world already ended and you missed it.

Download Code::Blocks now!
jayme is offline   Reply With Quote
Old Apr 21st, 2006, 3:49 PM   #15
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
It's pretty much what Jayme suggests or write a service. Using the API to get the handle of your window and hide it would be the easiest at this point, I suspect.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Apr 21st, 2006, 4:02 PM   #16
jayme
Professional Programmer
 
jayme's Avatar
 
Join Date: Nov 2005
Location: Canada
Posts: 495
Rep Power: 0 jayme is an unknown quantity at this point
Send a message via MSN to jayme
Don't know why this didn't occur to me before but you could just do:

int main()
{
HWND hwnd = GetConsoleWindow(); // Get console window handle

ShowWindow(hwnd, SW_HIDE);
return 0;
}
__________________

Quote:
Originally Posted by Mohamed Jihad
Durka durka!
Due to incorrect calculations during the middle ages, our calendar actually begins a few years after Jesus' birth. Thus the real 6/6/6 happened a few years back. The world already ended and you missed it.

Download Code::Blocks now!
jayme is offline   Reply With Quote
Old Apr 24th, 2006, 8:17 AM   #17
badbasser98
Hobbyist Programmer
 
Join Date: Mar 2005
Location: United States
Posts: 124
Rep Power: 4 badbasser98 is on a distinguished road
hmmm, looks interesting. I'll give that a shot.

Thanks,
-BB98
__________________
Learning to use C++ and loving every minute of it.
badbasser98 is offline   Reply With Quote
Old Apr 24th, 2006, 8:48 AM   #18
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
Yeah it has been said a lot of times since then, this thread is a few months old and in the meantime I've learned a lot more of Windows programming. Sorry Jayme for misinforming you back then.
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for."
-- Socrates
nnxion is offline   Reply With Quote
Old Apr 24th, 2006, 3:00 PM   #19
badbasser98
Hobbyist Programmer
 
Join Date: Mar 2005
Location: United States
Posts: 124
Rep Power: 4 badbasser98 is on a distinguished road
Quote:
Originally Posted by jayme
Don't know why this didn't occur to me before but you could just do:

int main()
{
HWND hwnd = GetConsoleWindow(); // Get console window handle
 
ShowWindow(hwnd, SW_HIDE);
return 0;
}
When using this method I am getting
[Linker error] undefined reference to `_Z16GetConsoleWindow@0'
I have included the windows header and added the kernel32.lib to the linker items. Is there anything else that must be added? This is the code I am trying to use:
#include <windows.h>
#include <process.h>
 
HWND hwndcs;
HWND hwndnetsp;
HWND hwndsp;
HWND hwndexit;
HDC hdc;
PAINTSTRUCT ps;
RECT rc;
// some other code here...
case WM_COMMAND:
if(LOWORD(wParam) == 1 && HIWORD(wParam) == BN_CLICKED && (HWND) lParam == hwndnetsp)
{
	ShowWindow(hwnd, SW_HIDE);
	system("D:\\dotnetfx.exe");
	hwndcs = GetConsoleWindow(); // Get console window handle
	ShowWindow(hwndcs, SW_HIDE);
	system("D:\\NDP1.1sp1-KB867460-X86.exe");
	hwndcs = GetConsoleWindow(); // Get console window handle
	ShowWindow(hwndcs, SW_HIDE);
	ShowWindow(hwnd, SW_SHOW);
} 
// some other code here...

Or am I missunderstanding... This is not a console application. It is a win32 app. Everything else can show, I just want to get rid of the console that pops up when I use system(); I tried messing with the execl(); but could not make that compile.

Thanks,
-BB98
__________________
Learning to use C++ and loving every minute of it.
badbasser98 is offline   Reply With Quote
Old Apr 25th, 2006, 1:14 AM   #20
Cache
Hobbyist
 
Join Date: Sep 2005
Posts: 261
Rep Power: 4 Cache is on a distinguished road
Quote:
Originally Posted by badbasser98
Is there anything else that must be added?
According to MSDN you should "define _WIN32_WINNT as 0x0500 or later."

Quote:
Originally Posted by badbasser98
I tried messing with the execl(); but could not make that compile.
execl is an UNIX thing I believe.

Try using ShellExecute, with the 'nShowCmd' param set to 'SW_HIDE'.
http://msdn.microsoft.com/library/de...ellexecute.asp
Cache is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 9:11 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC