|
Tommy Svensson wrote:
Q1a: Why does a dialog based MFC app take appr. 1200KB of working memory?!
Because it loads the MFC dll, so there is a big price for entry into an MFC app. A Win32 app will be leaner, but more complex to code.
Tommy Svensson wrote:
Q1b: I created an exact copy of this MFC dialog app with Delphi with the exact same functionality and it only aquires 150 KB of RAM... How come Delphi (Pascal) outperforms the living sh*t out of a regular C++ app?
It doesn't. You're just not aware of where the 1200kb came from. A 'regular' C++ app and an MFC app are two different things. Try it using WTL or Win32 and you'll see differently.
Tommy Svensson wrote:
Feels weird to develop with C++ when Delphi seems to rock the world!
HAHAHAHAHAHAHAHAHAHAHAHAA !!!!! Go develop in Delphi then.
Tommy Svensson wrote:
Can threading help me here...?
No, not really. I would be reporting outside of that inner loop - no-one needs status reports THAT quickly. I'd report at about the 'c' loop.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002
|
|
|
|
|
Hello every one !
I'd like to use a CListCtrl in my application, but the way it is displayed is not useful for me because it should be blue instead of gray.
I looked in previous posts but I haven't found what I'm looking for : getting the scrollbars from the CListCtrl with the function GetScrollBarCtrl(...) is almost impossible, according to me...
If someone has tried to do something approaching, please answer me because I don't know where I should look...
Thank you in advance
Joe
|
|
|
|
|
you can try reading this
http://msdn.microsoft.com/msdnmag/issues/01/11/c/c0111.asp
|
|
|
|
|
Thank you for your answer.
I read that and if I understand well, I shall begin a CScrollBar child class from scratch...
I think I will handle it in another way....
I actually began in this way :
A <--- This a button to scroll up
| <--- This a background bmp
|
[] <--- This a button (the box showing the current position in every scrollbar)
| <--- This the same background bmp
V <--- This another button to scroll down
It's a bit messy but I've already done that for a slider, and that works well, so why not ?...
My only problem is to get rid of those f*#@^" srollbars inside the CListCtrl
(disabling them by checking the 'No scroll' check box won't help : I won't be able to send some WM_VSCROLL to the CListCtrl...)
If anyone has any idea...
|
|
|
|
|
In my MDI application, I have a need to send a message from one open document to another (also open, but of a different class). I believe the way to do this is to get the parent frame (pointer) and then use EnumChildWindows() to get handles to all the child windows (presumably from ALL open documents) and use the callback function to analyse the titles of each window to find the correct one. My code is as follows:-
void CIRCDoc::OnTapeMove()
{
// TODO: Add your command handler code here
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
HWND hWndParent = pFrame->GetSafeHwnd();
//pFrame->SetWindowText("Hello Mum !!"); // DOES set mainframe title
BOOL bResult = FALSE;
LPARAM lParam = (LPARAM)(&bResult);
BOOL rc = EnumChildWindows(hWndParent, EnumChildProc, lParam);
}
BOOL CALLBACK CIRCDoc::EnumChildProc(HWND hwnd, LPARAM lparam)
{
TCHAR* pSaveText = new TCHAR[20+1];
BOOL rc = GetWindowText(hwnd,pSaveText,20);
DWORD wErrorResult = 0;
if(!rc)
wErrorResult = GetLastError();
delete pSaveText;
return TRUE; // keeps enumeration going
//SendMessage(hwnd,WM_SETTEXT,0,(LPARAM)"Test");
}
Although I get non-zero values for hwnd returned, the call to GetWindowText always fails and GetLastError() gives me ERROR_INVALID_PARAMETER. The other thing that I don't understand is that I get 10 calls to EnumChildProc even though there are only 2 documents open within the MDIFrame window. I'll almost certainly kick myself afterwards, but can anybody show me where I've gone wrong ?? What's wrong with my code ??
Doug
|
|
|
|
|
Use this other HWND as the root for EnumChildWindows :
void CIRCDoc::OnTapeMove()
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
HWND hWndParent = pFrame->m_hWndMDIClient;
...
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I tried the suggestion of using m_hwndMDIClient as the argument for EnumChildWindows(), but I still get the same failure on GetWindowText() contained within the EnumChildProc(). (For reference, the failure return by GetLastError() is ERROR_INVALID_PARAMETER).
I've checked that the GetWindowText() works O.K. on pFrame, so the error MUST be on the hwnd parameter of EnumChildWindows(). However, using m_hwndMDIClient, I now only get 4 calls to EnumChildProc() rather than the previous 10, but the value of hwnd is the same on all 4 !! What IS going wrong with the enumeration ???? (Apologies if this seems trivial, but I've never enumerated windows before !)
My updated code is as follows :-
void CIRCDoc::OnTapeMove()
{
// TODO: Add your command handler code here
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
//pFrame->SetWindowText("Hello Mum !!"); // DOES set mainframe title
BOOL bResult = FALSE;
LPARAM lParam = (LPARAM)(&bResult);
// BOOL rc = EnumChildWindows(hWndParent, EnumChildProc, lParam);
rc = EnumChildWindows(pFrame->m_hWndMDIClient, EnumChildProc, lParam);
}
BOOL CALLBACK CIRCDoc::EnumChildProc(HWND hwnd, LPARAM lparam)
{ TCHAR* pSaveText = new TCHAR[20+1];
BOOL rc = GetWindowText(hwnd,pSaveText,20);
DWORD wErrorResult = 0;
if(!rc)
wErrorResult = GetLastError();
delete pSaveText;
return TRUE; // keeps enumeration going
//SendMessage(hwnd,WM_SETTEXT,0,(LPARAM)"Test");
}
Doug
|
|
|
|
|
How I add button(text) on toolbar(IE) more than one ?
Please give me some example that using TB_ADDSTRING, TB_INSERTBUTTON.
Thanks a lot for your kindness
|
|
|
|
|
hi .. can any one tell me how to use splash screens in my programme
ive tried using class ceditview.. but to no avail.
telll me how to manage this.. and if some one could give ma the code ... dat will be great then
looking forward from all the gurus of code
|
|
|
|
|
|
take a look here
http://www.codeproject.com/dialog/index.asp#General
or more specifically
http://www.codeproject.com/dialog/splasher.asp
hope this helps.
Or u can just use a thread to close a modaless dialog box after a certain amount of time.
|
|
|
|
|
aldeba wrote:
Or u can just use a thread to close a modaless dialog box after a certain amount of time.
Actually, it's easier to just set a timer from within the modeless dialog. When the timer fires, the dialog is closed.
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hello,
I need to obtain the list of installed applications as it appears in "control panel/installed applications".
Is there any way to programmatically retrieve that list?
Thank you.
DL
|
|
|
|
|
The Complete List of Installed Softwares kept in Registry
HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\UNINSTALL
Enumerate all the keys under the node....
Renjith-The CPian.
|
|
|
|
|
I want something like CFormView, but instead of creating forms from resources. I've to create the child controls dynamically (by using CreateEx ). How can i do it ?
|
|
|
|
|
Take a look at my scrollbar example which creates a control dynamically in the view. The same methods applies for CEdit/CStatic etc...
http://www.codeproject.com/useritems/Scrollbar.asp
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
I use Visual Studio with C++ and I'm trying to compile a project with multiple source files. Here's what I want to know: what are the rules about linking multiple source files? How do I specify a variable as accessible throughout all functions in all source files? I thought extern was supposed to do that. How and where do I put functions, global variables, macros, universal header file #includes and everything else?
|
|
|
|
|
Anonymous wrote:
I thought extern was supposed to do that
And extern did not do it ? It works usually pretty well.
Anonymous wrote:
How and where do I put functions, global variables, macros, universal header file #includes and everything else?
Try putting the whole in this very order :
#include
macros
functions
in the .cpp
and
#include
classes
in the .h
What are global variable ?
~RaGE();
|
|
|
|
|
I don't understand how code pages work with double-byte languages (e.g. Korean). I see how every other language can fit into a code page containing 256 characters because most languages are less than 40 characters. However, I see that Korea's code page is 949 and is 256 characters. How can this be, because there are thousands of Korean ideographs? Same for Chinese: it has 10,000 characters, so how can they only use a regular code page?
|
|
|
|
|
In Win2000, we could use Active Directory and Group Policy to install and maintain softwares. But how we could create and access the group policy to deploy or publish software in VC++ programming ???
Thank a lot.
Randall
|
|
|
|
|
hi all,
pls try to answer my question, thanks!
i found that the AfxBeginThread failed to create thread for my function after a long run.
in my program, i need to run a thread, terminated after few mins and restart it.
however, i found it failed to restart after it run for few days (around 3000 times restart).
it just return the NULL pointer to me. eventually, it crashed as i terminate the thread with such pointer.
so, anyone know any reason a AfxBeginThread failed to create thread?
(if i don't know the reason, it is hard for me to try any debug method. since i can't monitor the bug as it occurs after long run.)
thanks,
jim
|
|
|
|
|
HEY
i heard that AfxBeginThread() has some problems related with the releasing of memory when u terminate the thread.(releasing the kernal thread object).i think that may be the reason...but
_beginthreadex() is safe and smart among the thread functions...no probs even if u restart 10 ^300000 times..!!haha
Renjith-The CPian.
|
|
|
|
|
thank you for your answer!
but, would you give me some idea about _beginthreadex()?
thanks,
jim
|
|
|
|
|
Surely..
_beginthreaex(void* Security,unsigned int stacksize,unsigned __stdcall*startAddressof ur thread Function,void *argumentList,unsigned initflag,unsigned* threadID);
that function will returnes the ThreadHandle...
Renjith-The CPian.
|
|
|
|
|
hi,
i am using MFC. it seems that _beginthreadex() can't be use in MFC program...
do you have any idea?
thanks,
jim
|
|
|
|