|
Here are the style adjustments I make to a modeless dialog.
pTemplateEx ->style |= WS_MINIMIZEBOX | WS_SYSMENU;
pTemplateEx ->exStyle |= WS_EX_APPWINDOW;
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
U mean register or registry, cos there's a difference u know!
Papa
Murex Co.
|
|
|
|
|
For registry access u can call from ur CWinApp object if ure using MFC,
GetProfileInt
WriteProfileInt
GetProfileString
WriteProfileString
By the way, what are u using??
Papa
Murex Co.
|
|
|
|
|
|
Hello! I'm trying, by code, to insert the '\n' or 0x0D or chr(13) into a EditBox to format the data comingo from a Database.
Anyone have a clue on how to do this?
Thank you for your time!
|
|
|
|
|
Try \n\r that should do it!
Papa
Murex Co.
|
|
|
|
|
there are a few ways. the easiest is to add the "\r\n" to the data then do a SetWindowText to add all the data at once. (you need the '\r', or the edit box will draw a little square for the '\n').
CString inData;
inData = from database
inData+="\r\n";
myEdit.SetWindowText(inData);
-c
Cheap oil. It's worth it!
|
|
|
|
|
sData = ...
sData += "\n";
m_cEdit.SetWindowText(sData);
|
|
|
|
|
Chris was rigth, i must insert "\r\n", to make the line feed. Thank you all!
|
|
|
|
|
Hi,
I have window A (which might be a dialog or a SDI) and window B which is a dialog. Window A creates window B modally.
I wanna have a button on window B which closes both window B and window A regardless of whether it is dialog or SDI but I dunno how.
Thanks for your help.
R.
|
|
|
|
|
U can do it several ways, but guess the simplest object oriented way would be to pass a pointer of the dialog A to the dialog B, and all the button would have to do is to call:
OnOK();
m_pointerToDialogA->OnOK();
Papa
Murex Co.
|
|
|
|
|
|
Pas de quoi! If u need anything just post it!
Papa
Murex Co.
|
|
|
|
|
Hi, im used to doing gfx programming with DX or OGL but now I have to do some stuff in GDI. Im currently having a tearing problem in GDI. Normally in DirectDraw I would use the function to wait for the vertical refresh ( vsync ) but in GDI I don't know what to do... Is there a similar function in the Win32 SDK ?
Thank you for any help you can provide.
|
|
|
|
|
I dont think MS has a provision for vsync in windows gdi... which really sucks.
// Rock
|
|
|
|
|
GDI was never at all intended to do that type of stuff.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Wow this is bad, I am only putting a huge rect on the screen then a smaller one on top of the first and I get tearing... boy GDI aint so great then.
|
|
|
|
|
Hi,
in a dialog which requests repeated WM_PAINT (by not validating client area) you get nasty little side effects. The repeated WM_PAINT prevents another window (the parent which does the message pump) to get redrawn sometimes. For example after maximize/restoring dialog the parent window is not repainted.
You can get an code example on NeHe's OpenGL page. It uses the mentioned repeated WM_PAINT method, which has some advantages if running a standalone window.
Okie... back to my problem. I tried several things to force an update of my parent window:
Attempt number 1
UpdateWindow(hWndParent);
No success, nothing happens.
Attempt number 2
RedrawWindow(hWnd, 0, 0, RDW_NOINTERNALPAINT);<br />
RedrawWindow(hWndParent, 0, 0, RDW_INTERNALPAINT | RDW_UPDATENOW | RDW_INVALIDATE);
Failure. Spy++ shows that as long as WM_PAINTs get created for my dialog, the parent window can not get a WM_PAINT. Yes, every other message is send, but no WM_PAINT is created. *sigh*
Attempt number 3
In my WM_PAINT handler I validate the client area and send a custom message:
PostMessage(hWnd, WM_CONTINUEPAINTSOON, 10, 0);
which will then again trigger WM_PAINT with
InvalidateRect(hWnd, NULL, FALSE);
Hopeless idea. Also tried to delay a new WM_PAINT by decreasing the wParam value until it's 0 and meanwhile create another WM_CONTINUEPAINTSOON (did you see the 10 above?). No change to the good, just causing more brawl on the message queue.
Attempt number 4
This time my WM_PAINT handler validates the client area and calls:
SetTimer(hWnd,1,0,NULL);
Then my WM_TIMER handler will invalidate the client area and so again trigger WM_PAINT.
Well, this time it works somehow, more bad. Of course my dialog update is poor (I mean the frame rate sux!). Which is no wonder, because SetTimer() has a low granularity ...I think arround 55 ms (I got ca 20 FPS).
Any ideas for a solution? Basically I eighter need to force the window parent to update (which I failed with attempt 1-3)
-or-
I need to stop the repeated WM_PAINT to give another window a chance for WM_PAINT and then retrigger my WM_PAINTs.
Thx for help, sorry for long posting! Feel free to ask question or ask for executable for testing.
Moak
|
|
|
|
|
Wasn't that a beginner question?
okie, I try with a worker thread.....
|
|
|
|
|
yep, worker thread works fine (and is just a few lines extra code)
|
|
|
|
|
I have a pointer defined in my header:
unsigned char *m_pData;
In my class constructor I initialize the pointer:
pData = NULL;
In my class source code I allocate memory:
m_pData = new unsigned char[m_fileLen];
In my destructor I delete the memory:
if(m_pData != NULL)
delete [] m_pData;
I keep getting memory leaks when the app is closed...I have set breakpoints and the delete in the destructor is being called. Why am I getting these leaks?
|
|
|
|
|
I hade a typo in the post, should read
m_pData = NULL;
Why am I leaking...need a can of stop leak
|
|
|
|
|
i'll ask an obvious question: how many times are you doing the allocation?
-c
Cheap oil. It's worth it!
|
|
|
|
|
Another obvious question: is the class that contains this code being dynamically allocated, and if so, is that class instance being deleted?
Peace!
-=- James.
"Some People Know How To Drive, Others Just Know How To Operate A Car."
[Get Check Favorites 1.4 Now!]
|
|
|
|
|
Obviously ure allocating it more than once, make sure ure not losing any pointer over there, as a general rule the delete operator should be called as much as the new operator!
(Could be exceptions)
Papa
Murex Co.
|
|
|
|