|
Vineas wrote:
I don't see why there should be any problem restoring to the original settings though.
A user might change these settings themselves in the control panel or something. If you save the old value, it might not be up-to-data. Therefore if you restore those values, the user might lose their own settings...
I wouldn't worry about that too much, since no user is going to change it every day and uninstall your software right after the change.
You might list this "feature" as a known bug or something.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Yeah, as long as ANOTHER program does not change them to something else in the meantime. That is ALWAYS the problem. Then, by definition, you are not 'restoring' the original settings, whatever you write back.
|
|
|
|
|
Turns out I didn't need to use the registry value anyway, the article at the link I put in earlier had a message that is sent to the top level window just before auto play is enacted. I ended up hooking this in a background thread whenever the CD burning dialogs are up, worked really well and didn't have to worry about messing up registry or a blocking AfxMessageBox call (one of the big problems I had once I figured out the message I needed to handle).
Thanks again for all the help, the code project has been a constant source of help and inspiration.
-----
In the land of the blind, the one eyed man is king.
|
|
|
|
|
Hi,
I'm currently writing a screensaver. I do not use the scrnsave.h template.
In order to open the configuration window properly I need to open my configuration dialog with a command line provided window handle as its parent. Unfortunately I cant provide a window handle to my dialogs constructor since it expects a CWnd derived object and I cannot create a CWnd object directly. How do I change the Dialog parent window handle?
Currently I open the dialog with:
CWatorSaverDlg dlg;
m_pMainWnd = &dlg;
What do I have to change?
Regards,
Ingo
|
|
|
|
|
You can instantiate a CWnd object.
Then use the Attach member to attach it to the HWND you have.
Use this CWnd as the parent for the dialog.
When the dialog is done, detach the CWnd from the HWND.
Then delete the CWnd.
CWnd* pTempParent = NULL;
pTempParent = new CWnd();
pTempParent->Attach(PassedHWnd);
...
CWatorSaverDlg dlg(pTempParent);
...
pTempParent->Detach();
delete pTempParent;
|
|
|
|
|
Hi,
Here's the problem: I wrote a chat program in which each user has a different color. Unfortunately, I don't know how to get these different colors to appear in the editbox I'm using for the main chat window.
How do I color a certain portion of text in an editbox to be different from other portions of text?
Thanks!
|
|
|
|
|
Use a rich edit control. See CRichEditCtrl::SetSelectionCharFormat().
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
I have a problem kinda similar to this:
I create a CRichEditCtrl using CreateEx, like this:
chat_window_rich.CreateEx(0, "Edit","", WS_TABSTOP | WS_CHILD | WS_VISIBLE | ES_MULTILINE | ES_AUTOVSCROLL |
ES_READONLY | WS_VSCROLL, W_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwnd, (HMENU)CHAT_WINDOW,NULL);
Then I try to set the text color using this:
CHARFORMAT cf;
::memset( &cf, 0, sizeof( cf ) );
cf.cbSize = sizeof( cf );
cf.dwMask = CFM_COLOR;
cf.crTextColor = RGB( 255, 160, 160 );
int test = SendMessage(chat_window_rich.GetSafeHwnd(), EM_SETCHARFORMAT, (WPARAM) SCF_ALL, (LPARAM) &cf );
But the SendMessage always fails, and the text isn't set. ??? Does anyone know what might be wrong?
Kelly Ryan
|
|
|
|
|
KellyR wrote:
chat_window_rich.CreateEx(0, "Edit",
If chat_window_rich is a CRichEditCtrl type why not use CRichEditCtrl::Create() instead of CWnd::CreateEx() as you are not specifying any extended styles? If you must use the form you are using then you have to specify the proper classname. You can use the macro RICHEDIT_CLASS or failing that the possible class names are "RichEdit", "RichEdit20A", or "RichEdit20W".
Right now, because you specified "Edit" as the class name you are creating a plain old edit control, not a rich edit control, that does not know what the EM_SETCHARFORMAT message is.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
YES!!!! IT WORKS!!!!
Thank you so much!!! I've been trying to get this damn thing to work for like 4 hours!
WOOHOOO
Kelly Ryan
|
|
|
|
|
You can have it as owner drawn and override WM_DRAWITEM, This would allow you to put the text in a way that you need.
<bold>- Nilesh
<italics>
"Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw
|
|
|
|
|
Nilesh K. wrote:
You can have it as owner drawn and override WM_DRAWITEM
You have done this with an edit control? I always thought WM_DRAWITEM was only for menus, buttons, and list and combo boxes.
Learn something new every day.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
I am trying to place a dialog directly on top of a window from another app.
I am trying to cope with some z-order issues. Of trying to get my little dialog to appear directly on top of another app's window.
The x-y position issues are just fine -- for testing I put my window at top-most and it looks great as long as the other app is #2.
Alternately, I'd be looking for a strategy to decide when the appropriate time is to hide my window... like when the region where'd i'd display myself is obscured.
Basically, it has to look as much like a built-in as possible.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.santacruznetworks.com">Santa Cruz Networks</A>
|
|
|
|
|
First use BringWindowToTop() to being the other application's window to the top. Then use SetWindowPos(hWnd, HWND_TOP, ...) to put your app's window right in front of the other.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
What will happen if I want to create a Socket giving it the IP of the machine where my program is not running. Will it be allowed or be nor allowed due to security. Actually, I want to communicate between two machine through Sockets .... but one machine runs on LAN and other is connected to Internet through direct modem ...
|
|
|
|
|
I doubt it would be allowed to do that way.
<bold>- Nilesh
<italics>"Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw
|
|
|
|
|
Ibraheem Khan wrote:
Actually, I want to communicate between two machine through Sockets .... but one machine runs on LAN and other is connected to Internet through direct modem ...
If you really want to communicate between two, you need Aa static IP and your ISP providing you support for connecting to that IP!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
I have created an SDI app and have drawn certain things on to the main window (lines, rectangels etc..). I would now like ot take that data, scale it down, and save it in a bitmap file. Is there a convenient way to simply take whatever the Redraw function does and make it draw the same thing on to a bitmap?
-bk
|
|
|
|
|
|
You need to create a memory bitmap at first and then drawing it on this memory bitmap,when finished,please convert CBitmap to bitmap file,I think the following sample codes to be useful to you (You cann't build it,it is only a sample):
BOOL CMyCanvasCore::DoDrawImage(CImage* pImage, CDC* pDC)
{
BOOL bSuccess = FALSE;
CDC dcMem;
CBitmap bmp;
CDC dcScreen;
dcScreen.Attach(::GetDC(0));
if (pDC == NULL)
{
pDC = &dcScreen;
}
dcMem.CreateCompatibleDC(pDC);
CRect rcVirtual(GetVirtualOrigin(), GetVirtualSize());
CSize szBitmap(rcVirtual.Width(), rcVirtual.Height());
PrepareDrawDC(pDC, FALSE);
pDC->LPtoDP(&szBitmap);
BOOL bBmpCreated = bmp.CreateCompatibleBitmap(pDC, szBitmap.cx, szBitmap.cy);
if (bBmpCreated)
{
dcMem.SelectObject(&bmp);
const CPoint ptOldLogOrg = GetLogOrigin();
CRect rcMargins;
GetMargins(rcMargins);
CSize szMargins(rcMargins.left, rcMargins.top);
FODPtoLP(&szMargins);
CPoint ptTopLeft(GetVirtualOrigin());
ptTopLeft.x += szMargins.cx;
ptTopLeft.y += szMargins.cy;
SetLogOrigin(ptTopLeft.x, ptTopLeft.y);
PrepareDrawDC(&dcMem, FALSE);
// Draw background.
DoDrawBackGround(&dcMem,rcVirtual);
GetCurrentModel()->OnDrawShapeNormal(&dcMem);
SetLogOrigin(ptOldLogOrg.x, ptOldLogOrg.y);
// pImage->MakeNewBitmap(&dcMem, &bmp);
bSuccess = TRUE;
}
dcScreen.Detach();
return bSuccess;
}
Jack
---------------------------------------------------------------------------------
XD++ MFC/C++ Flow/Diagram Library -- http://www.ucancode.net
|
|
|
|
|
|
I need to emulate Windows Task Manager CPU Usage and history applets and am lost on what where i should begin - any suggestions ? How would i create the freq bar - etc.
thanks
|
|
|
|
|
You can find a bunch of charting controls here[^]. Of course, you still need to first get at the information you want to display.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Using Win32, I need to "clip" a window - that is, draw only part of a window. I don't actually draw the window myself, but I wish to put it into a "clipping" region. An analogy would be the way a child MDI window can be clipped by it's parent.
Thanks for any help,
Rich
ps - if responding by email, remove the xxx from the middle of the email address.
|
|
|
|
|
I have some problem with simple code:
There is a secondary thread that create an object this object have the method above
bool AccDatabase::Insert(Articolo* m_pArticolo)
{
char *sql = (char*) malloc( 1024 );
sprintf( sql, "//insert etc");
try {
m_pDatabase->Execute( sql );
free( sql );
return true;
}
catch (CDaoException *e){e->Delete();}
return false;
}
if i create this object in the secondary thread and call on it the metod insert i have an error of NullSystemException while if i create the object in main thread and i call on it the metod insert i have no error and the execution is ok...
where is the matter?
Tnx
|
|
|
|