|
InternetGetConnectedState() will do it for you.
--Mike--
"alyson hannigan is so cute it's crazy" -- Googlism
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
1)
I added WS_MAXIMIZE in PreCreateWindow to my main MFC Frame window.
Works fine, maximizes at start like it should.
However, it is not maximized when OnCreate is called(At least GetWindowRect() doesn't see it like that), but I need to position some other windows relative to it in the maximized state.
How can I accomplish this?
2) How can I make child windows start out maximized? I tried WS_MAXIMIZE and MDIMaximize() of the frame window, but nothing happens with either...
|
|
|
|
|
Locked Ghost wrote:
(At least GetWindowRect() doesn't see it like that)
Use SystemParametersInfo(SPI_GETWORKAREA,...) to find out the size of a maximized top-level window.
Locked Ghost wrote:
How can I make child windows start out maximized?
I've not done a lot of MDI programming, but I would assume you'll have to wait until the frame window has been created and put on the screen before you can maximize any MDI child windows. If you are using the MFC document/view stuff, you could have your view tell the frame to maximize the child in OnCreateClient() .
Software Zen: delete this;
|
|
|
|
|
Gary R. Wheeler wrote:
Use SystemParametersInfo(SPI_GETWORKAREA,...) to find out the size of a maximized top-level window.
Hmm... it seems to be off by a few pixels. What could be causing this? Anything special I need to know about it?
Gary R. Wheeler wrote:
I've not done a lot of MDI programming, but I would assume you'll have to wait until the frame window has been created and put on the screen before you can maximize any MDI child windows. If you are using the MFC document/view stuff, you could have your view tell the frame to maximize the child in OnCreateClient().
MDIMaximize doesn't seem to do anything no matter where I call it from
|
|
|
|
|
The workarea is the rectangle that a window is the desktop window - any appbars that may be present.
So if you have your Windows Taskbar viewable without autohide, that would account for your few pixels of discrepency. Otherwise, if that is not the case could you give some more details.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Yes, I have the taskbar on without autohide...
but I still don't really understand where those few missing pixels come from... could you explain it?
|
|
|
|
|
What is your current screen resolution, and what are the values that are returned from the call to SystemParametersInfo?
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
I've refied the problem a bit.
It returns 0, 0 and the other one is right too.
However, GetWindowRect() on a maximized window returns negative values(-4, -4 i belive) for the first corner
Why?
|
|
|
|
|
How can I get the active view(or document)?
I need a window to access the active document, but I didn't find any clues about doing it anywhere...
|
|
|
|
|
Try this:
CFrameWnd::GetActiveView()
Gero
|
|
|
|
|
Whee thanks! I always miss the obvious :p
|
|
|
|
|
Need Nice OSDesktop!
I wrote the follwing code to write a sample text everywhere of desktop so on clock. But I can not delete it by my program!!!
You can test this in a simple DialogBase program.
Please guid me
void CMyProgDlg::OnShowResolution() <br />
{<br />
CString sTempMsg;<br />
<br />
hWnd = GetDesktopWindow()->GetSafeHwnd();<br />
hdc = ::GetWindowDC( hWnd );<br />
nSDC = SaveDC( hdc );<br />
<br />
DEVMODE dd;<br />
ZeroMemory(&dd, sizeof(dd));<br />
dd.dmSize = sizeof(dd);<br />
EnumDisplaySettings( NULL, ENUM_CURRENT_SETTINGS, &dd);<br />
<br />
CFont oldFont,newFont;<br />
LOGFONT lfA;<br />
ZeroMemory( &lfA, sizeof( LOGFONT ) );<br />
lstrcpy( lfA.lfFaceName, "Comics Sans MS" );
int nSize = 10;<br />
<br />
lfA.lfWeight = FW_DEMIBOLD;<br />
lfA.lfHeight = 2 * nSize;<br />
lfA.lfWidth = 1 * nSize;<br />
newFont.CreateFontIndirect( &lfA );<br />
<br />
SelectObject( hdc, newFont );<br />
<br />
<br />
SetBkMode(hdc, TRANSPARENT);
SetBkColor( hdc, NULL );
COLORREF oldColor = SetTextColor(hdc, RGB(170,255,50) );
SetTextAlign( hdc, TA_RIGHT);<br />
<br />
TEXTMETRIC tm;<br />
GetTextMetrics( hdc, &tm );<br />
<br />
int x = dd.dmPelsWidth-5 , y=35;<br />
int FarNextLine = tm.tmHeight;<br />
<br />
sTempMsg.Format( "My Display Setting..." );<br />
TextOut( hdc, x, y, sTempMsg, strlen( sTempMsg ) );<br />
<br />
<br />
<br />
y += 2*FarNextLine;<br />
sTempMsg.Format("Resolution : [%4d , %4d]",<br />
dd.dmPelsWidth, dd.dmPelsHeight );<br />
TextOut( hdc, x, y, sTempMsg, strlen( sTempMsg ) );<br />
<br />
y += FarNextLine;<br />
sTempMsg.Format("Color=%2dBits", dd.dmBitsPerPel );<br />
TextOut( hdc, x, y, sTempMsg, strlen( sTempMsg ) );<br />
<br />
y += FarNextLine;<br />
sTempMsg.Format("RefreshRate=%3d Hz", dd.dmDisplayFrequency );<br />
TextOut( hdc, x, y, sTempMsg, strlen( sTempMsg ) );<br />
<br />
SetTextColor(hdc, oldColor );<br />
<br />
}<br />
|
|
|
|
|
|
when i call this dll funciton in vb ,it is saying cant find dll entry point.i have only one cpp file which has code as below.
what is the error.what should i do.
i want to call createwindow function .
#include "stdafx.h"
#include "Shellapi.h"
extern "C"__declspec(dllexport) void __stdcall CreateWindowFunction(void);
extern "C" __declspec(dllexport) BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
hModule=hModule;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
extern "C" __declspec(dllexport) void __stdcall CreateWindowFunction()
{
MessageBox(NULL,"Called","CreateWindowFunction",MB_OK);
}
|
|
|
|
|
I wrote a new program and distributed it freely to my user.
I upgrade my program frequently. But I can't email it to my user frequently.
Therefore, please someone write me a simple code that how can my program has the following option: "Check for newer version every x day".
|
|
|
|
|
anata wrote:
Therefore, please someone write me a simple code that how can my program has the following option
I'm pretty sure that noone is goint to write the program for you, but I'll bet that a lot of people is going to answar your questions if you ask "How can I do this", instead of "write it for me"...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Ok Anders and other programmers,
"How can I do that ... ?", please.
That job must be hide until detect new version.
|
|
|
|
|
Please help to find a source for bitmap editor like used in MFC
and by the way, does anyone know how to serialize CDC with all its components together wist other info like ints, chars, etc.
my mail is:alex_kuleshov@hotmail.com
|
|
|
|
|
Will loading a bitmap that is part-of RC using resource ID render? Have bug in OnDraw. In debug, the data bits in the HBITMAP are null. Hence, a BitBlt transfers nothing to DC. Any code clips or thoughts on how to render a CBitmap loaded from resouce ID would be appreciated? Note: The bitmap is > 256 bits, so IDE claims it can't render it in editor. In any other editors, the image renders.
michael
|
|
|
|
|
Hi All:
I have 3 questions on using MFC to do some GUI stuff. I am currently building a simulation, thus, I need to show some feedback to the user once the simulation starts. For example, I could be simulating a bouncing ball. Once the user clicks "Start", the simulation will run based on certain changing parameters (like speed of ball, height of ball etc) and feedback graphically to the user through a display window.
Qn1. May I know how can I make the display window refresh from my application? I understand that WM_PAINT should not be called from our own application.
Qn2. May I know what is the most efficient way of refreshing a device context? Currently, I am only updating a portion or pieces of the device context every timestep. What I am doing now is to "draw" the background first (so as to erase), then followed by going through what needs to be drawn onto the device context every timestep. I feel that there should be a better approach. The refresh needs to be pretty fast so that the user will not see any fickleness.
Qn3. I would like to write some sentences onto the device context. I am using "CDC::TextOut" in this case. May I know how then can I control the size and type of the font?
Due to company policy, I am not using the Doc/View approach in VC++ 6. I am manually coding in the various stuff like menus etc. Sorry if some of the questions is a bit naive as I am really new to MFC. Urgently needing help due to tight schedule.
Thank you very much in advance.
|
|
|
|
|
tanuki22 wrote:
May I know how can I make the display window refresh from my application?
Use CWnd::Invalidate() to schedule repainting of the window. Call CWnd::UpdateWindow() then if you want to repaint the window immediately.
tanuki22 wrote:
The refresh needs to be pretty fast so that the user will not see any fickleness.
Use double buffering - draw to the memory DC first and then switch the content from memory DC to display DC using BitBlt - see this[^].
tanuki22 wrote:
May I know how then can I control the size and type of the font?
Use CDC::SelectObject().
Pavel
Sonork 100.15206
|
|
|
|
|
hi everyone,
how do you manually highlight a node in a tree control? say i have a treectrl with 5 nodes.. if i want to have node 4 get highlighted everytime i start the program, how do i do it?
|
|
|
|
|
Use the TVM_SELECTITEM message to select an item.
--Mike--
"alyson hannigan is so cute it's crazy" -- Googlism
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Hi folks
How do i add new folder button in browse for folder dialog box...need help????
Sansingh
|
|
|
|
|